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:
In 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
Description of the problem/issue
This project illustrates the problem. When having polymorphic types and using the
swagger-gradle-pluginto 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:
And this was the expected output in 2.2.40:
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.41Earliest version the bug appears in (if known):
2.2.41Steps to Reproduce
Expand the project attached and execute:
In order to compare the differences between
2.2.41and2.2.40, modify the gradle script to downgrade the dependency toswagger-core.Expected Behavior
Subtypes should include a composite schema to the parent type like so
Actual Behavior
Subtypes are created as independent models with no reference to the parent:
Logs / Stack Traces
none
Additional Context
Checklist