Didn't mention but I'm using the Go official library On Saturday, 29 October 2022 at 08:35:16 UTC+3 Idan Asulin wrote:
> I'm trying to implement data contract logic. > I've 2 services switching messages with each other. > Service A send messages in some format + the file descriptor proto of the > .proto file used to generate it. Service B gets them both, the message and > the file descriptor proto and has to ensure the message doesn't break the > schema defenition. > What I've did until now is to create a dynamic message instance using the > descriptor proto and tried to unmarshal the message into the dynamic > message instance, and in case no error occurred during the unmarshal > process it counts as a success (message doesn't break the schema). > > 1. Is it ok to rely on the unmarshal function in order to decide whether > the message is ok? > 2. I noticed that even in case I'm sending messages with totally different > schemas the unmarshal succeed. the only way I found to cause the unmarshal > to fail is by sending proto2 messages with missing required fields. > So is it by design that every message can be unmarshled using a totally > different schema definition? > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/59f6cb9f-33ae-4fc1-ba07-93d3d8c90431n%40googlegroups.com.