Skip to content

Commit ce05ea2

Browse files
authored
Pass errorSchema from ArrayField to ArrayFieldTemplate (#4094)
* Pass errorSchema from ArrayField to ArrayFieldTemplate * Update CHANGELOG.md
1 parent e2e37b7 commit ce05ea2

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ should change the heading of the (upcoming) version to include a major version b
2222

2323
- Added support for `UiSchema` `"ui:rows"` option for `textarea` elements, fixing [#4070](https://github.com/rjsf-team/react-jsonschema-form/issues/4070).
2424

25-
# @rjsf/utils
25+
## @rjsf/core
26+
27+
- [#4091](https://github.com/rjsf-team/react-jsonschema-form/issues/4091) Added `errorSchema` to `ArrayFieldTemplate` props.
28+
29+
## @rjsf/utils
2630

2731
- [#4080](https://github.com/rjsf-team/react-jsonschema-form/issues/4080) - BREAKING CHANGE: Removed the `base64` object from the `@rjsf/utils` package. Note that this is a breaking change if you relied on the `base64` object exported by `@rjsf/utils`. Since this change caused [#4080](https://github.com/rjsf-team/react-jsonschema-form/issues/4080), and was only internally used by playground code, we are shipping this change in a patch release.
32+
- [#4091](https://github.com/rjsf-team/react-jsonschema-form/issues/4091) Added `errorSchema` to the `ArrayFieldTemplateProps` type.
2833

2934
## Dev / docs / playground
3035

3136
- [#4080](https://github.com/rjsf-team/react-jsonschema-form/issues/4080) - Moved the `base64` encoder/decoder object to the Playground package.
32-
- Added test configuration and script to the Playground.
33-
37+
- Added test configuration and script to the Playground.
3438

3539
# 5.17.0
3640

packages/core/src/components/fields/ArrayField.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
787787
uiSchema,
788788
title: fieldTitle,
789789
formContext,
790+
errorSchema,
790791
rawErrors,
791792
};
792793

packages/docs/docs/advanced-customization/custom-templates.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ The following props are passed to each `ArrayFieldTemplate`:
104104
- `title`: A string value containing the title for the array.
105105
- `formContext`: The `formContext` object that you passed to Form.
106106
- `formData`: The formData for this array.
107+
- `errorSchema`: The optional validation errors for the array field and the items within it, in the form of an `ErrorSchema`
107108
- `rawErrors`: An array of strings listing all generated error messages from encountered errors for this widget
108109
- `registry`: The `registry` object.
109110

packages/utils/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ export type ArrayFieldTemplateProps<
601601
formContext?: F;
602602
/** The formData for this array */
603603
formData?: T;
604+
/** The tree of errors for this field and its children */
605+
errorSchema?: ErrorSchema<T>;
604606
/** An array of strings listing all generated error messages from encountered errors for this widget */
605607
rawErrors?: string[];
606608
/** The `registry` object */

0 commit comments

Comments
 (0)