Support for inheritance and polymorphism in DocService
I'm using DocService to document our API. Currently, the response classes of the annotated HTTP service use inheritance and polymorphism. There doesn't seem to be any support for this case at the moment. It would be great if Armeria automatically detect annotations like @JsonSubTypes. Or, it's good to create a new annotation to specify it manually. Below is an example of a Discriminator in Swagger.
- https://swagger.io/docs/specification/v3_0/data-models/inheritance-and-polymorphism/
Hi! I’m interested in working on this feature and would like to confirm the preferred direction.
In springdoc-openapi, I’ve run into an issue where polymorphism
(oneOf / discriminator) is expressed twice when both Jackson annotations and @Schema are
introspected simultaneously (due to swagger-core processing both).
(My question/answer thread: link1, related issue: link2)
I also found an old discussion about Swagger support in Armeria (link3),
but I’m not sure what the final decision was.
For DocService, I see two possible approaches:
-
Generate polymorphism strictly from Jackson annotations
(@JsonTypeInfo,@JsonSubTypes,@JsonTypeName) -
Introduce Armeria-specific annotations
as an explicit override or extension point.
I’d like to hear advice or the direction the Armeria team would prefer.
If nobody is currently working on this, I’d be happy to take it on.
I prefer using Jackson annotations rather than introducing a new annotation for it.