Add support to export flat json schemas
Motivation:
Nested JSON schemas might be hard to read. Especially if we want to introduce OpenAPI spec generation, the ability to generate the $defs block independently can be super useful.
Modifications:
- Add
flatoption to the json schema generation for method information. - Add a method to generate
$defsblock for a service specification based on all structs. - Slight refactoring to extract
visitedout-of-function signatures to the class body. - Omit
descriptionif empty. (Gist is not up-to-date, but should be fine because unit tests verify).
Result:
- Closes #4743
- See generated schemas for grpc service here: https://gist.github.com/Dogacel/bfa94713eb3202d4a1f02f057ad1a066
I know it has been a year however I had a second look into this PR and it LGTM ๐
I would like to work on fixing the JSON suggestions for Well known types as described in the official documentation: https://protobuf.dev/programming-guides/proto3/#json
Please LMK if it is OK to merge this and for me to continue working on fixing the JSON schema problems.
@minwoox
๐ Build Scanยฎ (commit: 9319c0cbf673e53e6835f950ccaee678457d996a)
| Job name | Status | Build Scanยฎ |
|---|---|---|
| build-windows-latest-jdk-21 | โ | https://ge.armeria.dev/s/ieoqg4575aadk |
| build-self-hosted-unsafe-jdk-8 | โ | https://ge.armeria.dev/s/u2ji7mf425hxq |
| build-self-hosted-unsafe-jdk-21-snapshot-blockhound | โ | https://ge.armeria.dev/s/32myz3y5mf2bs |
| build-self-hosted-unsafe-jdk-17-min-java-17-coverage | โ | https://ge.armeria.dev/s/xphzlfqnqqrjo |
| build-self-hosted-unsafe-jdk-17-min-java-11 | โ | https://ge.armeria.dev/s/zwm6lady6mxnq |
| build-self-hosted-unsafe-jdk-17-leak | โ | https://ge.armeria.dev/s/d5m2kwmnjodiu |
| build-self-hosted-unsafe-jdk-11 | โ | https://ge.armeria.dev/s/z44cwfoiciclm |
| build-macos-12-jdk-21 | โ | https://ge.armeria.dev/s/f7aepgyju7vbo |
LGTM and sorry for taking so long until I review this PR, @Dogacel ๐
No problem, I kinda left it as it is last year because I wasn't planning to work on DocService related stuff anytime soon ๐