You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a polymorphic api with 3 hierarchy levels (super, intermediate and child) the oneOfs for super are only generated for intermediate and not for child.
AFAIU the correct @JsonSubTypes annotations (w.r.t. spring doc) only include subtypes for the direct subclass (Correct me if I am wrong).
However with this hierarchy if we have a spring controller with Superclass as response type, the generated oneOf statement in the yaml looks the following:
What version of spring-boot you are using: 3.2.5
What modules and versions of springdoc-openapi are you using: 2.5.0 [springdoc-openapi-starter-common, springdoc-openapi-starter-webmvc-api and springdoc-openapi-starter-webmvc-ui]
The text was updated successfully, but these errors were encountered:
If you agree with me that this would be the correct mapping, I offer to create a PR and fix it myself.
My solution proposal would be to extend the PolymorphicModelConverter to also search for subtypes of subtypes recursivly (or rather iteratively).
Describe the bug
For a polymorphic api with 3 hierarchy levels (super, intermediate and child) the oneOfs for super are only generated for intermediate and not for child.
To Reproduce
Assume the following api model.
AFAIU the correct @JsonSubTypes annotations (w.r.t. spring doc) only include subtypes for the direct subclass (Correct me if I am wrong).
However with this hierarchy if we have a spring controller with
Superclass
as response type, the generatedoneOf
statement in the yaml looks the following:However, one would expect (and e.g. our frontend generator otherwise produces wrong clients)
What version of spring-boot you are using: 3.2.5
What modules and versions of springdoc-openapi are you using: 2.5.0 [springdoc-openapi-starter-common, springdoc-openapi-starter-webmvc-api and springdoc-openapi-starter-webmvc-ui]
The text was updated successfully, but these errors were encountered: