Closed oliver closed 1 year ago
Hello @oliver, thanks for raising this.
We aready have some specific cases for generating Google protobuf types. This probably be added without too much hassle. I'll take a look.
Hi @oliver, I've made a PR for this: https://github.com/chrusty/protoc-gen-jsonschema/pull/145
Would you be able to try that branch out and tell me if this does what you're after?
Yes, I'll give it a try tomorrow. Thanks for the quick PR!
Hey @oliver, I've made a new release containing the update: https://github.com/chrusty/protoc-gen-jsonschema/releases/tag/1.4.1
Great, much appreciated! Thank you for this project, it's really useful for me!
When using the
google.protobuf.ListValue
type from struct.proto, Protobuf will actually use an array in JSON, but the generated JSON Schema does not reflect that.E.g. for this .proto file:
and this C++ code:
the following JSON will be written:
But the JSON Schema generated by protoc-gen-jsonschema describes that
some_list
is an object with avalues
member. When validating the created JSON string against the generated Schema file, validation fails.I guess this happens because Protobuf has special code for serializing these well-known types to/from JSON.