Skip to content

feat(common): map the array schema of a content annotation - #17

Merged
grubmeshi merged 2 commits into
spring-boot-3.xfrom
feature/content-array-schema
Oct 26, 2026
Merged

grubmeshi merged 2 commits into
spring-boot-3.xfrom
feature/content-array-schema

Conversation

@grubmeshi

Copy link
Copy Markdown
Collaborator

@Content(array = @ArraySchema(schema = @Schema(implementation = X.class))) now becomes a media type schema type: array with items referencing X, like swagger-core reads it. The outer schema takes minItems, maxItems, uniqueItems, extensions and the arraySchema annotation (description, nullable, …).

Why: the library only read Content.schema(). meshfed-api declares its 422 and 500 @ApiResponse content this way, and those responses had no schema in the spec.

A @Content that sets both schema and array fails the spec build, because swagger-core's precedence between the two is surprising.

The first commit moves the handling of the @ArraySchema fields out of TypeResolverForCollectionLikeTypeSupport so that both places use it.

Tests: a 422 response in app59 (App59ApiResponseController) and DefaultContentAnnotationMapperTest for the conflict.

🤖 Generated with Claude Code

grubmeshi and others added 2 commits October 26, 2026 22:37
The content annotation mapper needs the same handling of minItems, maxItems,
uniqueItems and extensions as the collection type resolver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
swagger-core reads @content(array = @ArraySchema(...)) as an array schema, but
the library only read Content.schema(), so such a response had no schema.
Setting both schema and array fails the spec build, because swagger-core's
precedence between them is surprising.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grubmeshi
grubmeshi force-pushed the feature/content-array-schema branch from 8a562cf to 6a1018c Compare October 26, 2026 21:57
@sonarqubecloud

Copy link
Copy Markdown

@grubmeshi
grubmeshi merged commit 6a1018c into spring-boot-3.x Oct 26, 2026
3 of 4 checks passed
@grubmeshi
grubmeshi deleted the feature/content-array-schema branch October 26, 2026 22:02
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