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
This commit is contained in:
commit
21bc8726d6
|
@ -431,7 +431,7 @@ Kotlin::
|
||||||
|
|
||||||
A `ConstraintViolation` on `Person.name()` is adapted to a `FieldError` with the following:
|
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)
|
- Message arguments `"name"`, `10`, and `1` (the field name and the constraint attributes)
|
||||||
- Default message "size must be between 1 and 10"
|
- Default message "size must be between 1 and 10"
|
||||||
|
|
||||||
|
@ -439,14 +439,14 @@ To customize the default message, you can add properties to
|
||||||
xref:core/beans/context-introduction.adoc#context-functionality-messagesource[MessageSource]
|
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
|
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
|
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::
|
Properties::
|
||||||
+
|
+
|
||||||
[source,properties,indent=0,subs="verbatim,quotes",role="secondary"]
|
[source,properties,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||||
----
|
----
|
||||||
Size.student.name=Please, provide a {0} that is between {2} and {1} characters long
|
Size.peron.name=Please, provide a {0} that is between {2} and {1} characters long
|
||||||
student.name=username
|
person.name=username
|
||||||
----
|
----
|
||||||
|
|
||||||
A `ConstraintViolation` on the `degrees` method parameter is adapted to a
|
A `ConstraintViolation` on the `degrees` method parameter is adapted to a
|
||||||
|
|
Loading…
Reference in New Issue