Skip to content

feat: add support for groups in @Schema and @Operation (fixes #4928) - #5278

Open
balu1225 wants to merge 2 commits into
swagger-api:masterfrom
balu1225:master
Open

feat: add support for groups in @Schema and @Operation (fixes #4928)#5278
balu1225 wants to merge 2 commits into
swagger-api:masterfrom
balu1225:master

Conversation

@balu1225

@balu1225 balu1225 commented Aug 18, 2026

Copy link
Copy Markdown
  • Added groups attribute to @Schema and @operation
  • Populated x-groups extension in generated OpenAPI Spec
  • Added tests ValidationGroupTest and OperationGroupsTest

Pull Request

Thank you for contributing to swagger-core!

Please fill out the following information to help us review your PR efficiently.


Description

This PR adds support for the groups() attribute in both @Schema and @Operation annotations, allowing them to be serialized into the OpenAPI specification via the x-groups extension.

  • Added Class<?>[] groups() default {}; to the @Schema annotation.
  • Added Class<?> groups() default Void.class; to the @Operation annotation.
  • Updated AnnotationsUtils and ModelResolver in swagger-core to extract groups correctly and serialize them.
  • Updated Reader in swagger-jaxrs2 to map the groups property from @Operation to the x-groups extension on the final OpenAPI Operation object.

Fixes: #4928

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

  • Added ValidationGroupTest to swagger-core to verify that x-groups correctly propagates on standard fields and primitives in Schemas.
  • Added OperationGroupsTest to swagger-jaxrs2 to verify that x-groups correctly generates as a string for Operations.
  • Note for reviewers: PetResourceTest#testSetOfClasses was observed to be failing on upstream master independently of these changes. All feature-specific tests are passing.

balu1225 and others added 2 commits August 17, 2026 21:26
…-api#4928)

- Added groups attribute to @Schema and @operation
- Populated x-groups extension in generated OpenAPI Spec
- Added tests ValidationGroupTest and OperationGroupsTest
@ewaostrowska ewaostrowska added the backlog label Aug 20, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lack of Friendly Support for Parameter Validation Grouping

2 participants