Skip to content

Commit

Permalink
Pass errorSchema from ArrayField to ArrayFieldTemplate (rjsf-team#4094)
Browse files Browse the repository at this point in the history
* Pass errorSchema from ArrayField to ArrayFieldTemplate

* Update CHANGELOG.md
  • Loading branch information
vstenvik committed Feb 19, 2024
1 parent e2e37b7 commit ce05ea2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ should change the heading of the (upcoming) version to include a major version b

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

# @rjsf/utils
## @rjsf/core

- [#4091](https://github.com/rjsf-team/react-jsonschema-form/issues/4091) Added `errorSchema` to `ArrayFieldTemplate` props.

## @rjsf/utils

- [#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.
- [#4091](https://github.com/rjsf-team/react-jsonschema-form/issues/4091) Added `errorSchema` to the `ArrayFieldTemplateProps` type.

## Dev / docs / playground

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

- Added test configuration and script to the Playground.

# 5.17.0

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/fields/ArrayField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
uiSchema,
title: fieldTitle,
formContext,
errorSchema,
rawErrors,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ The following props are passed to each `ArrayFieldTemplate`:
- `title`: A string value containing the title for the array.
- `formContext`: The `formContext` object that you passed to Form.
- `formData`: The formData for this array.
- `errorSchema`: The optional validation errors for the array field and the items within it, in the form of an `ErrorSchema`
- `rawErrors`: An array of strings listing all generated error messages from encountered errors for this widget
- `registry`: The `registry` object.

Expand Down
2 changes: 2 additions & 0 deletions packages/utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ export type ArrayFieldTemplateProps<
formContext?: F;
/** The formData for this array */
formData?: T;
/** The tree of errors for this field and its children */
errorSchema?: ErrorSchema<T>;
/** An array of strings listing all generated error messages from encountered errors for this widget */
rawErrors?: string[];
/** The `registry` object */
Expand Down

0 comments on commit ce05ea2

Please sign in to comment.