react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

Pass errorSchema from ArrayField to ArrayFieldTemplate

Open vstenvik opened this issue 1 year ago • 1 comments

Prerequisites

What theme are you using?

core

Is your feature request related to a problem? Please describe.

I would like to show errors inside a custom ArrayFieldTemplate, but rawErrors is undefined and the template does not get the errorSchema from the ArrayField

Describe the solution you'd like

Passing the errorSchema from ArrayField to ArrayFieldTemplate would solve this for me. However, it is not quite clear to me why the rawErrors prop is undefined. The template will contain objects, so that might be the reason?

Describe alternatives you've considered

No response

vstenvik avatar Feb 14 '24 11:02 vstenvik

@vstenvik The rawErrors array represents the errors for only that level in the hierarchy and not below. Passing through the errorSchema as an optional field makes sense (in order to maintain backwards compatibility). If you are willing to provide a fix, update the ArrayFieldTemplateProps in @rjsf/utils, the documentation as well as the ArrayField implementation in @rjsf/core

Thanks!

heath-freenome avatar Feb 16 '24 20:02 heath-freenome

@heath-freenome thanks, that makes sense! I'll try to provide a PR shortly.

vstenvik avatar Feb 19 '24 08:02 vstenvik