Skip to content

docs: improve validation section for service module. - #2625

Open
TomCools wants to merge 1 commit into
TimefoldAI:mainfrom
TomCools:docs/improve-service-validation-section
Open

docs: improve validation section for service module.#2625
TomCools wants to merge 1 commit into
TimefoldAI:mainfrom
TomCools:docs/improve-service-validation-section

Conversation

@TomCools

Copy link
Copy Markdown
Contributor

Removed TODO in the validation section and improved the general explainer of the docs.

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

Updates the Timefold Solver Service REST API documentation to remove a TODO and expand guidance on request validation and OpenAPI generation.

Changes:

  • Adds guidance encouraging structural validation via OpenAPI annotations.
  • Replaces a TODO with a more detailed explanation of influencing the generated OpenAPI spec via @Schema and Bean Validation annotations.
Suppressed comments (1)

docs/src/modules/ROOT/pages/running-timefold-solver/service/rest-api.adoc:547

  • The statement that @Schema constraints are enforced at runtime needs to be qualified because the request schema validation is profile/feature gated (dev/test only, and can be disabled), otherwise readers may assume it applies in production.
The `@Schema` annotation lets you document a field (`description`), and its attributes such as `required`, `pattern`, `minimum` and `maximum` are also enforced at runtime: an incoming request that violates them is rejected with a `400` response before it reaches your model.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 328 to +329
By default, validation on the input is based on the xref:./rest-api.adoc#openAPISpecification[OpenAPI Specification annotations].
Most of the structural validations (e.g. required fields, minimum number of items in collections, etc.) should be implemented using those annotations.

@rsynek rsynek Aug 31, 2026

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.

Ad Copilot comment: fair remark, but unless we explain how and when we perform the JSON schema validation in the platform and locally, it just raises more questions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we create a separate profile then? Because having this validation disabled by default in the JAR is sort of weird.

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.

We can enable JSON validation locally regardless of the Quarkus profiles and have there a property to opt-out. The platform would need to set the property, because JSON validation is done by the gateway before the model pod starts.

@triceo
triceo removed their request for review August 31, 2026 09:46
Comment on lines +549 to +550
Alternatively, you can express the same constraints using https://jakarta.ee/specifications/bean-validation/[Jakarta Bean Validation] annotations (such as `@NotNull`, `@Size` or `@Min`/`@Max`) instead of, or in combination with, `@Schema`.
Quarkus picks these up as well: they are reflected in the generated OpenAPI specification and enforced in the same way.

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.

True, but do we want to mention it? For people who are not familiar with OpenAPI and Bean Validation, it's another choice to make.

People who already know Quarkus and these standards don't need us to tell them.

Comment on lines 328 to +329
By default, validation on the input is based on the xref:./rest-api.adoc#openAPISpecification[OpenAPI Specification annotations].
Most of the structural validations (e.g. required fields, minimum number of items in collections, etc.) should be implemented using those annotations.

@rsynek rsynek Aug 31, 2026

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.

Ad Copilot comment: fair remark, but unless we explain how and when we perform the JSON schema validation in the platform and locally, it just raises more questions.

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.

3 participants