-
Notifications
You must be signed in to change notification settings - Fork 59
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
Generating json schema from generated classes out of protobuf request #369
Comments
Hi @Rustem, Can you provide an example for the generated Java class? I didn't have this requirement myself yet, to generate a JSON schema based on a generated Java class from a protobuf description.
That being said, there are ways to "clean up" the JSON schema for the generated classes here, e.g.,
To not waste my time, in case you opt for the direct conversion, I'll not go into more detail for now. 😉 Let me know, if you still want better hints for the points above. |
Thanks @CarstenWickner , I explored those libraries your referenced. In fact my current implementation is based on protoc-gen-jsonschema, but it works only in compile time. To scale the system i need runtime java protobuf-jsonschema generator and yours is the best I found so far. Would you mind to share how to ignore certain fields? I found in your documentation that i can do something like this? Btw , I think use-case like mine when we use your lib to transform some schema to a json-schema through generated java classes could be a good use-case.
Also sharing a java class with all relevant information:
|
Hi team, could you please help me with few issues related to protobuf->java object -> json schema using your tool. I tried to generate json schema out of protobuf generated java class.
It comes with you extra fields and some unnecessary fields that i d like to skip.
it generates fields ending with
_
because the class implements them this way. For example generated class for fielddrid
has private fielddrid_
and has public functiongetDrid()
. I tried different presets, it does not work.Another issue is additional fields like
memoizedIsInitialized
andmemoizedHashCode
that i d like to exclude from generated schema.Example proto:
Example code
Example output:
The text was updated successfully, but these errors were encountered: