From 43217bdf069ae05abd8a6262c5e7ef0f8edfabc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Silva?= Date: Thu, 8 Aug 2024 16:50:13 +0100 Subject: [PATCH 1/2] Fix error codes in Customizing Validation Errors section See gh-33354 --- .../modules/ROOT/pages/core/validation/beanvalidation.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc b/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc index fde40f0d8fa..4473372832b 100644 --- a/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc +++ b/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc @@ -431,7 +431,7 @@ Kotlin:: A `ConstraintViolation` on `Person.name()` is adapted to a `FieldError` with the following: -- Error codes `"Size.student.name"`, `"Size.name"`, `"Size.java.lang.String"`, and `"Size"` +- Error codes `"Size.person.name"`, `"Size.name"`, `"Size.java.lang.String"`, and `"Size"` - Message arguments `"name"`, `10`, and `1` (the field name and the constraint attributes) - Default message "size must be between 1 and 10" From df7ac9b308b13f1d340bbb1c2b80b5241d0c9172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Fri, 9 Aug 2024 09:03:05 +0200 Subject: [PATCH 2/2] Polish "Fix error codes in Customizing Validation Errors section" See gh-33354 --- .../modules/ROOT/pages/core/validation/beanvalidation.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc b/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc index 4473372832b..7126f9570fe 100644 --- a/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc +++ b/framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc @@ -439,14 +439,14 @@ To customize the default message, you can add properties to xref:core/beans/context-introduction.adoc#context-functionality-messagesource[MessageSource] resource bundles using any of the above errors codes and message arguments. Note also that the message argument `"name"` is itself a `MessagreSourceResolvable` with error codes -`"student.name"` and `"name"` and can customized too. For example: +`"person.name"` and `"name"` and can customized too. For example: Properties:: + [source,properties,indent=0,subs="verbatim,quotes",role="secondary"] ---- -Size.student.name=Please, provide a {0} that is between {2} and {1} characters long -student.name=username +Size.peron.name=Please, provide a {0} that is between {2} and {1} characters long +person.name=username ---- A `ConstraintViolation` on the `degrees` method parameter is adapted to a