swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

[Bug]: Regression: class specified in @ArraySchema.schema.implementation not rendered in schemas

Open arungitan opened this issue 3 months ago • 3 comments

Description of the problem/issue

we are using Springdoc with the swagger-core dependency. we were using @ArraySchema successfully in Springdoc 2.6 (default 3.0 openapi output from swagger) but once we moved to springdoc 2.8 (default 3.1 openapi output from swagger), the implementation class specified in @ArraySchema.schema is not rendered at all.
So the swagger UI fails with errors like:

"Resolver error at responses.200.content.*/*.schema.items.$ref
Could not resolve reference: Invalid object key "ThingAssignment" at position 2 in "/components/schemas/ThingAssignment": key not found in object"

Affected Version

2.2.36

Earliest version the bug appears in (if known): not known

Steps to Reproduce

See attached zip file with app and notes. (The sample uses 2.2.36 but I also tried 2.2.38 with the same failure)

Expected Behavior

Should render the ThingAssignment in the Schemas section and emit the reference to array of ThingAssignment for the consuming class (User.java in the sample).

Actual Behavior

(see notes from zip) Emitted the array reference but does not render the implementation class schema (ThingAssignment) In prior versions with 3.0 output format, it was working fine.

Logs / Stack Traces

no logs but see notes in zip for the emitted output.

Additional Context

  • By overriding the output format from the default 3.1 to 3.0, the problem goes away. springdoc.api-docs.version=openapi_3_0
  • This swagger-core issue looks related but not sure if it fixes the problem for this issue as well, and if so, when will the fix be released? https://github.com/swagger-api/swagger-core/issues/4679
  • issue originally raised against springdoc:
    https://github.com/springdoc/springdoc-openapi/issues/3097

Checklist

  • [ x] I have searched the existing issues and this is not a duplicate.
  • [ x] I have provided sufficient information for maintainers to reproduce the issue.

arungitan avatar Oct 11 '25 01:10 arungitan

Sample app and notes: swagger-core-bug-sample.zip

arungitan avatar Oct 11 '25 01:10 arungitan

The issue seems to stem from this change, where Schema-annotations are ignored if using the 3.1 parser. I have created a branch were I have been able to restore expected functionality, but as I do not completely understand the background for detaching annotations for the 3.1 resolver, it is not a proper solution.

Mattias-Sehlstedt avatar Oct 11 '25 17:10 Mattias-Sehlstedt

Same behavior in version 2.2.40

jalborscodeoscopic avatar Dec 02 '25 10:12 jalborscodeoscopic