You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to put a feature request for this todo to be implemented and exposed as a command line parameter. Specifically, as a parameter on buf convert.
My use case is that I am using buf convert to validate textpb files against my protobuf definitions. We have found that having samples of valid instances of protos along with the schema definitions helps our team understand the semantic intention of the schemas. To support this process we have implemented validation of those samples using buf convert which helps capture:
Basic invalid formats
Type errors on fields
In addition we want to reject samples which have extra fields on them. In our use case those extra fields are almost always caused by spelling mistakes on a field that does exist in the schema. In addition if the field with the spelling error is a message type all child fields get no validation at all potentially allowing type errors to slip through.
We have implemented a hacky solution using convert to output textpb and then using diff but this is a brittle solution (subject to the detrand randomness and requiring our samples to match the formatting of the proto textpb marshaller which might change with future versions). If we had a --error-on-unknown flag we could simplify our system making it more reliable and flexible.
The text was updated successfully, but these errors were encountered:
bufdev
changed the title
Feature request: Option on buf convert to set DiscardUnknown to false when unmarshalling input
Option on buf convert to set DiscardUnknown to false when unmarshalling input
Jun 27, 2024
I'd like to put a feature request for this todo to be implemented and exposed as a command line parameter. Specifically, as a parameter on
buf convert
.My use case is that I am using
buf convert
to validate textpb files against my protobuf definitions. We have found that having samples of valid instances of protos along with the schema definitions helps our team understand the semantic intention of the schemas. To support this process we have implemented validation of those samples using buf convert which helps capture:In addition we want to reject samples which have extra fields on them. In our use case those extra fields are almost always caused by spelling mistakes on a field that does exist in the schema. In addition if the field with the spelling error is a message type all child fields get no validation at all potentially allowing type errors to slip through.
We have implemented a hacky solution using convert to output
textpb
and then usingdiff
but this is a brittle solution (subject to the detrand randomness and requiring our samples to match the formatting of the proto textpb marshaller which might change with future versions). If we had a --error-on-unknown flag we could simplify our system making it more reliable and flexible.The text was updated successfully, but these errors were encountered: