armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Add support to export flat json schemas

Open Dogacel opened this issue 2 years ago โ€ข 4 comments

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 flat option to the json schema generation for method information.
  • Add a method to generate $defs block for a service specification based on all structs.
  • Slight refactoring to extract visited out-of-function signatures to the class body.
  • Omit description if 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

Dogacel avatar Apr 22 '23 19:04 Dogacel

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

Dogacel avatar Apr 27 '24 03:04 Dogacel

๐Ÿ” 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

github-actions[bot] avatar Apr 27 '24 03:04 github-actions[bot]

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 ๐Ÿ™‚

Dogacel avatar Apr 30 '24 14:04 Dogacel