-
Notifications
You must be signed in to change notification settings - Fork 926
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display JSON and protobuf request and response specification in `DocS…
…ervice` (#4322) Motivation: A `@RequestObject` bean can be converted as a specification of an annotated service. Neither response nor POJO request are shown in a `DocService`. Only gRPC and Thrift `DocService` can display the full specifications of input and output types. This PR aims to generalize a way to create a `StructInfo` from a range of types by offering `NamedTypeInfoProvider` which can be dynamically loaded via SPI or explicitly set using `DocServiceBuilder`. A data type that depends on a specific library, such as protobuf, Thrift, ScalaPB can extend this interface and inject custom implementations. Modifications: - Designed `NamedTypeInfoProvider` interface to let users customize how to create a `StructInfo` from the given type descriptor. The following implementations are added for the default behavior. - `JsonNamedTypeInfoProvider` - `ThriftNamedTypeInfoProvider` - `ProtobufNamedTypeInfoProvider` - `ScalaPbNamedTypeInfoProvider` - Add `DocServiceBuilder.nameTypeInfoProvider()` in order to override the default `NamedTypeInfoProvider`s. - Moved some code related to `StructInfo` in `*DocServicePlugin` to `*NamedTypeInfoProvider` Result: - You can now see the specification of an annotated service made of a JSON object or protobuf can be viewed in `DocService`. - Fixes #4309
- Loading branch information
Showing
67 changed files
with
5,460 additions
and
964 deletions.
There are no files selected for viewing
200 changes: 109 additions & 91 deletions
200
.../main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedDocServicePlugin.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.