You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose title property for validated fields (#4700)
* Expose title property for validated fields
* Update docs and examples with new exposed title property
* Change documentation entry wording
* Remove missed debugger statement in playground
* Fix unit tests and update CHANGELOG.md
* Update changelog
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
15
15
should change the heading of the (upcoming) version to include a major version bump.
16
16
17
17
-->
18
-
19
18
# 6.0.0-beta.14
20
19
21
20
## @rjsf/core
@@ -26,6 +25,7 @@ should change the heading of the (upcoming) version to include a major version b
26
25
## @rjsf/utils
27
26
28
27
- Updated `UiSchema` type to support dynamic array item UI schemas - the `items` property can now be either a `UiSchema` object or a function that returns a `UiSchema` ([#4706](https://github.com/rjsf-team/react-jsonschema-form/pull/4706))
28
+
- Added `title` property to `RJSFValidationError`[PR](https://github.com/rjsf-team/react-jsonschema-form/pull/4700)
29
29
30
30
## @rjsf/chakra-ui
31
31
@@ -56,6 +56,10 @@ should change the heading of the (upcoming) version to include a major version b
56
56
- Added comprehensive documentation for dynamic UI schema feature with TypeScript examples ([#4706](https://github.com/rjsf-team/react-jsonschema-form/pull/4706))
57
57
- Updated array documentation to reference the new dynamic UI schema capabilities ([#4706](https://github.com/rjsf-team/react-jsonschema-form/pull/4706))
58
58
59
+
## @rjsf/validator-ajv8
60
+
61
+
- Updated `transformRJSFValidationErrors()` to include the `title` property of a field with error fixing #4504 with [PR](https://github.com/rjsf-team/react-jsonschema-form/pull/4700)
Copy file name to clipboardExpand all lines: packages/docs/docs/usage/validation.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -382,6 +382,7 @@ Each element in the `errors` list passed to `transformErrors` is a `RJSFValidati
382
382
-`property`: optional string in Javascript property accessor notation to the data path of the field with the error. For example, `.name` or `.first-name`.
383
383
-`schemaPath`: optional JSON pointer to the schema of the keyword that failed validation. For example, `#/fields/firstName/required`. (Note: this may sometimes be wrong due to a [bug in ajv](https://github.com/ajv-validator/ajv/issues/512)).
384
384
-`stack`: full error name, for example ".name is a required property".
385
+
-`title`: optional string containing title property for the field with error.
message: 'You need to be 18 because of some legal thing',
16
16
});
17
17
}
18
+
if(error.name==='required'){
19
+
returnObject.assign({},error,{
20
+
message: `${error.title} is a required field`,
21
+
});
22
+
}
18
23
returnerror;
19
24
});
20
25
};
@@ -25,7 +30,12 @@ const validation: Sample = {
25
30
description:
26
31
'This form defines custom validation rules checking that the two passwords match. There is also a custom validation message when submitting an age < 18, which can only be seen if HTML5 validation is turned off.',
0 commit comments