Skip to content

Validation annotations on @PathVariable/@RequestParam are ignored in generated OpenAPI schema + 'date' support - #299

Merged
wodrobina merged 5 commits into
ePages-de:masterfrom
wodrobina:Suport-date
Jul 30, 2026
Merged

Validation annotations on @PathVariable/@RequestParam are ignored in generated OpenAPI schema + 'date' support #299
wodrobina merged 5 commits into
ePages-de:masterfrom
wodrobina:Suport-date

Conversation

@wodrobina

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves generated API specs by (1) applying documented Bean Validation constraints to OpenAPI parameter schemas (path/query/header) and (2) adding explicit DATE field support in the JSON Schema generator, with corresponding sample endpoints and tests.

Changes:

  • Apply validationConstraints from parameter descriptors to OpenAPI parameter schemas (min/max length, pattern, minimum/maximum).
  • Add DATE type support in JSON Schema generation as type: string with format: date, plus optional format validation.
  • Add sample controller + integration tests demonstrating constrained request params/path variables and the resulting documentation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
samples/restdocs-api-spec-sample/src/test/java/com/epages/restdocs/apispec/sample/ProductSearchIntegrationTest.java Adds sample integration tests that document/query/path parameter constraints via validationConstraints.
samples/restdocs-api-spec-sample/src/main/java/com/epages/restdocs/apispec/sample/ProductSearchController.java Adds sample endpoints annotated with Bean Validation constraints on @RequestParam/@PathVariable.
restdocs-api-spec-openapi3-generator/src/test/kotlin/com/epages/restdocs/apispec/openapi3/OpenApi3GeneratorTest.kt Adds assertions that parameter constraints are reflected in generated OpenAPI schemas.
restdocs-api-spec-openapi3-generator/src/main/kotlin/com/epages/restdocs/apispec/openapi3/OpenApi3Generator.kt Implements constraint-to-schema mapping for OpenAPI parameter schemas.
restdocs-api-spec-jsonschema/src/test/kotlin/com/epages/restdocs/apispec/jsonschema/JsonSchemaFromFieldDescriptorsGeneratorTest.kt Adds tests for DATE schema generation and stricter error messages for unsupported types.
restdocs-api-spec-jsonschema/src/main/kotlin/com/epages/restdocs/apispec/jsonschema/JsonSchemaFromFieldDescriptorsGenerator.kt Implements DATE field schema generation and improves unsupported-type error messaging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

wodrobina and others added 2 commits July 30, 2026 11:36
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@wodrobina
wodrobina merged commit 295992f into ePages-de:master Jul 30, 2026
1 check passed
@wodrobina
wodrobina deleted the Suport-date branch July 30, 2026 10:30
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.

Validation annotations on @PathVariable/@RequestParam are ignored in generated OpenAPI schema

3 participants