-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
hook a visitor into protogen to implement schema-aware payload parsing #919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Can't understand quite clearly what does "validation of command-line usage (rather than library usage)" means. Is it for input validation when a user tries to do protogen.exe --decode command? Why rather than library usage? |
@SamiSadfa I simply mean: I haven't tested that the command-line scenario works at all, let alone that it does the correct thing. The main logic is in the library and is validated via unit tests, but the console exe needs validation too. In particular, that |
protogen.exe output: It seems like it's working |
"support for packed primitive values (note this is based on reader.WireType being String for a primitive value (i.e. not string, bytes, group or message) and not on anything related to field)" I am not sure where the support for packed primitives can be implemented. Also, is there a correlation between implementing packed primitives support and repeated fields? I am not really versed in Protobuf packed primitives. Can you please point me to some documentation/code I need to check through to implement this support? |
"what output (if any) for unknown fields?" |
…tobuf-net into protogen-decode
Scenarios:
protoc --decode
to walk a payload+schema and understand the contentsdynamic
or similar, ideally in a way that is usable from other common serializers, for example as a transcoderCurrently this is implemented via:
DecodeVisitor
- has the logic to iterate over a payload while tracking a schemaTextDecodeVisitor : DecodeVisitor
- provides aprotoc --decode
style raw text dump of the interpreted payload contentsObjectDecodeVisitor : DecodeVisitor
- provides anExpandoObject
-based object-model from the interpreted payloadWork items:
protogen
(global tool)stdout
) for output-h
and///
; a new page under/docs
would be good too, though).google.protobuf.Duration
,.google.protobuf.Timestamp
, for example).google.protobuf.Timestamp
, for example) (note: this might not apply if we get the well-known-types support to map to regular .NET types that already have the correct handling)struct.proto
andwrappers.proto
ObjectDecodeVisitor
? currently usesint
, but: is that right? should it be an option on the object, i.e.new ObjectDecodeVisitor { Enums = EnumMode.Name }
? (which would presumably use the name when possible, and the integer as fallback) - Google lib writes names, reads either names or integersreader.WireType
beingString
for a primitive value (i.e. notstring
,bytes
,group
ormessage
) and not on anything related tofield
)map
scenariosObjectDecodeVisitor
: default values and presence tracking; i.e. in proto3 a non-presence-tracked field with value zero/false/etc is not transmitted, but that is still the expected value (if it is presence-tracked, then it is transmitted if assigned)ObjectDecodeVisitor
: option to usejson_name
rather thanname
(whenjson_name
specified)ObjectDecodeVisitor
seems... weird