-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Description of the problem/issue
This project illustrates the problem. When having polymorphic types and using the swagger-gradle-plugin to generate the OpenAPI descriptor file, subtypes are missing the combined schema reference (allOf) to the parent type.
This is the current output in 2.2.41:
"DateAttributeTypeImpl" : {
"type" : "object",
"properties" : { }
}And this was the expected output in 2.2.40:
"DateAttributeTypeImpl" : {
"type" : "object",
"allOf" : [ {
"$ref" : "#/components/schemas/AttributeType"
} ]
}I debugged and the first pass of the model resolver for the parent type populates the reference correctly, however the model is redefined here and the reference is lost. I don't know enough of the model resolution to isolate a fix.
I suspect it might be a regression introduced while resolving #5003
Affected Version
2.2.41
Earliest version the bug appears in (if known):
2.2.41
Steps to Reproduce
Expand the project attached and execute:
./gradlew clean resolveIn order to compare the differences between 2.2.41 and 2.2.40, modify the gradle script to downgrade the dependency to swagger-core.
Expected Behavior
Subtypes should include a composite schema to the parent type like so
"DateAttributeTypeImpl" : {
"type" : "object",
"allOf" : [ {
"$ref" : "#/components/schemas/AttributeType"
} ]
}Actual Behavior
Subtypes are created as independent models with no reference to the parent:
"DateAttributeTypeImpl" : {
"type" : "object",
"properties" : { }
}Logs / Stack Traces
none
Additional Context
Checklist
- I have searched the existing issues and this is not a duplicate.
- I have provided sufficient information for maintainers to reproduce the issue.