fix(ext-jackson): a constraint says what it wants in its own words #22

Merged
Relism merged 1 commits from fix/validation/constraint-messages into master 2026-09-23 14:51:29 +00:00
Owner

The constraint compiler ignored the message an annotation declares and always wrote its own, so a failed @Pattern answered the caller with a regex.

It now uses the annotation's message whenever one is set, keeping the plain description for jakarta's default — which is a resource bundle key, not something to put in front of whoever sent the request.

@Pattern(regexp = "[A-Za-z0-9_][A-Za-z0-9_.-]{0,254}", message = "uses up to 255 letters, digits, _, . and -")
{"error": "key uses up to 255 letters, digits, _, . and -", "status": 422}

This is what makes moving a check out of a service and onto the type it belongs to cost nothing: the wording moves with it.

🤖 Generated with Claude Code

The constraint compiler ignored the `message` an annotation declares and always wrote its own, so a failed `@Pattern` answered the caller with a regex. It now uses the annotation's message whenever one is set, keeping the plain description for jakarta's default — which is a resource bundle key, not something to put in front of whoever sent the request. ```java @Pattern(regexp = "[A-Za-z0-9_][A-Za-z0-9_.-]{0,254}", message = "uses up to 255 letters, digits, _, . and -") ``` ```json {"error": "key uses up to 255 letters, digits, _, . and -", "status": 422} ``` This is what makes moving a check out of a service and onto the type it belongs to cost nothing: the wording moves with it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Relism added 1 commit 2026-09-23 14:51:28 +00:00
The compiler ignored the message a constraint declares and always wrote its
own, so a failed @Pattern answered the caller with a regex. It now uses the
annotation's message whenever one is set, and keeps the plain description for
jakarta's default, which is a resource bundle key and not something to put in
front of whoever sent the request.

This is what makes moving a check out of a service and onto the type it
belongs to cost nothing: the wording moves with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Relism merged commit 6a6431c528 into master 2026-09-23 14:51:29 +00:00
Relism deleted branch fix/validation/constraint-messages 2026-09-23 14:51:29 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Relism/Flash5#22