swagger-api / swagger-api/swagger-core

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

Open
#4,993 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog Bug
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

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

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached sample and notes, especially User.java and the @ArraySchema usage referencing ThingAssignment. Compare the generated OpenAPI 3.1 output with the OpenAPI 3.0 output enabled by springdoc.api-docs.version=openapi_3_0, then review swagger-core issue 4679. Done means the 3.1 schemas include ThingAssignment and the consuming array reference resolves without Swagger UI errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.