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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/7bcafa1b-d264-48be-a3a9-68ef25500ad1n%40googlegroups.com.

Reply via email to