Skip to content

Commit 21bc872

Browse files
committed
Merge pull request #33354 from GoncaloPT
* pr/33354: Polish "Fix error codes in Customizing Validation Errors section" Fix error codes in Customizing Validation Errors section Closes gh-33354
2 parents a31945f + df7ac9b commit 21bc872

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

framework-docs/modules/ROOT/pages/core/validation/beanvalidation.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -431,22 +431,22 @@ Kotlin::
431431

432432
A `ConstraintViolation` on `Person.name()` is adapted to a `FieldError` with the following:
433433

434-
- Error codes `"Size.student.name"`, `"Size.name"`, `"Size.java.lang.String"`, and `"Size"`
434+
- Error codes `"Size.person.name"`, `"Size.name"`, `"Size.java.lang.String"`, and `"Size"`
435435
- Message arguments `"name"`, `10`, and `1` (the field name and the constraint attributes)
436436
- Default message "size must be between 1 and 10"
437437

438438
To customize the default message, you can add properties to
439439
xref:core/beans/context-introduction.adoc#context-functionality-messagesource[MessageSource]
440440
resource bundles using any of the above errors codes and message arguments. Note also that the
441441
message argument `"name"` is itself a `MessagreSourceResolvable` with error codes
442-
`"student.name"` and `"name"` and can customized too. For example:
442+
`"person.name"` and `"name"` and can customized too. For example:
443443

444444
Properties::
445445
+
446446
[source,properties,indent=0,subs="verbatim,quotes",role="secondary"]
447447
----
448-
Size.student.name=Please, provide a {0} that is between {2} and {1} characters long
449-
student.name=username
448+
Size.peron.name=Please, provide a {0} that is between {2} and {1} characters long
449+
person.name=username
450450
----
451451

452452
A `ConstraintViolation` on the `degrees` method parameter is adapted to a

0 commit comments

Comments
 (0)