Skip to content

fix: pass along type_use annotations to swagger(-core)#3300

Open
tthornton3-chwy wants to merge 1 commit into
springdoc:mainfrom
tthornton3-chwy:bugfix/pass-along-type-use-annotations-to-swagger-core
Open

fix: pass along type_use annotations to swagger(-core)#3300
tthornton3-chwy wants to merge 1 commit into
springdoc:mainfrom
tthornton3-chwy:bugfix/pass-along-type-use-annotations-to-swagger-core

Conversation

@tthornton3-chwy

Copy link
Copy Markdown

Summary

Preserve top-level TYPE_USE annotations when Springdoc flattens @ParameterObject fields into query parameters.

Previously, GenericParameterService only forwarded annotations from parameterized type arguments. That meant annotations like JSpecify-style @nullable on an array type, e.g. Status @nullable [] status, were dropped before schema extraction. Swagger-core therefore never saw the nullable signal and generated only type: "array".
This change forwards both:

  • annotations on the field’s AnnotatedType itself
  • annotations on parameterized type arguments

That allows OpenAPI 3.1 nullable array query parameters to generate:
"type": ["array", "null"]

Change Plan

  • Updated GenericParameterService.resolveTypeAndTypeAnnotationsForParameter(...) to use a new helper that collects annotations from the full AnnotatedType.
  • Kept the existing parameterized type-argument annotation behavior intact.
  • Added a WebMVC OpenAPI 3.1 regression test app using a flattened @ParameterObject with a runtime TYPE_USE @nullable annotation on an array query parameter.
  • Added the expected JSON snapshot showing type: ["array", "null"] with enum array items.

Test Plan

Ran the test suite with the new tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant