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
I reproduced the problem with a test in springdoc-openapi code base - please see the branch changes - and was able to get the field in the API definition. Unfortunately, the schema is still not generated properly. The issue is that at the moment when calculateSchema is called, the information about the original parameter class (ConcreteParameterObject from the example above) is already lost and we only have the declaring class for the getter (AbstractParameterObject). Obviously, there is not enough information to resolve the type information and wrong schema gets generated (or not at all for the enum case).
The text was updated successfully, but these errors were encountered:
Thank for your search and contribution.
I have added your proposed change.
There is an error related to swagger-core: swagger-api/swagger-core#3858
A NPE is thrown by Jackson, in the swagger-core call from ModelResolver._addEnumProps(ModelResolver.java:944)
But i think, your fix should be working for other cases, and you have workarounds for enum inheritance.
You can also test this enhancement using the latest snapshot.
Please have a look at this commit and tell if it covers your case ?
Hi @bnasslahsen, thank you for the solution. Yes, it covers the case. Hopefully once the Swagger issue is resolved, @Parameter(schema=@Schema(type = "string", allowableValues = {"ONE", "TWO"}) ) workaround can be removed and schema gets generated based on the types.
Consider the following use-case, where
@ParameterObject
refers to a class that extends a parametrized class:Expected schema should contain the
genericField
definition, but it does not:I reproduced the problem with a test in
springdoc-openapi
code base - please see the branch changes - and was able to get the field in the API definition. Unfortunately, the schema is still not generated properly. The issue is that at the moment whencalculateSchema
is called, the information about the original parameter class (ConcreteParameterObject
from the example above) is already lost and we only have the declaring class for the getter (AbstractParameterObject
). Obviously, there is not enough information to resolve the type information and wrong schema gets generated (or not at all for the enum case).The text was updated successfully, but these errors were encountered: