镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Migrate validation to reference implementation of the Jakarta Validation API - #1593

Open
aleksandy wants to merge 1 commit into
playframework:masterfrom
aleksandy:feature/1592-hibernate-validation
Open

aleksandy wants to merge 1 commit into
playframework:masterfrom
aleksandy:feature/1592-hibernate-validation

Conversation

@aleksandy

@aleksandy aleksandy commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Replace the oVal-based validation engine with an internal engine built on top of Hibernate Validator, the Jakarta Validation 3.1 reference implementation.

All of this was done without breaking the public play.data.validation API or observable behaviour: error keys, validation.* message keys, message parameter order, @Valid cascade errors, and the programmatic Validation API all passed the existing sample and unit test suites.

  • play.data.validation annotations are no longer oVal @Constraint meta-annotations; they are evaluated by PlayValidator, which provides the full context (PlayValidationContext / FieldValidationContext / MethodParameterValidationContext replace oVal contexts) they need, while standard jakarta.validation constraints on beans and action method parameters are delegated to Hibernate Validator
  • @Valid cascades recursively with cycle protection and preserves the legacy error behaviour and keys: an object-level "validation.object" error is reported for every failed @Valid application (parameter, field or collection), plus per-item errors for collection elements
  • AbstractAnnotationCheck replaces net.sf.oval AbstractAnnotationCheck; the message variables cache now preserves the order of the source map (LinkedHashMap instead of HashMap) so %2$s/%3$s message parameters keep their positions
  • the Jakarta Validation factory is built with ParameterMessageInterpolator, so no Unified EL implementation is required on the classpath (expressly and jakarta.el-api are intentionally not shipped: play resolves its validation messages through its own Messages, not through EL); JPAPlugin exposes the factory to Hibernate via jakarta.persistence.validation.factory so ValidationMode.AUTO bootstraps without EL
  • dependencies: net.sf.oval:oval removed, org.hibernate.validator:hibernate-validator:9.1.1.Final added; oVal patch files and log4j logger entry cleaned up
  • sample tests migrated to the new isSatisfied(validatedObject, value, context) signature

#1592

Replace the oVal-based validation engine with an internal engine built on top of
Hibernate Validator, the Jakarta Validation 3.1 reference implementation.

All of this was done without breaking the public play.data.validation API or observable behaviour: error keys, validation.* message keys, message parameter order, @Valid cascade errors, and the programmatic Validation API all passed the existing sample and unit test suites.
@mergify

mergify Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@aleksandy

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

queue

☑️ Command disallowed due to command restrictions in the Mergify configuration.

Details
  • sender-permission >= write

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