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

Feat: Allow raising errors from within a custom whatever(#2718)

Open abdalla-rko opened this issue 9 months ago • 1 comments

Reasons for making this change

I introduced a raiseFieldErrors method to raise errors from within a custom component(see #2718).

The current behavior allows errors to be raised from custom components and when the form onChange is triggered, we clear the custom raised errors. I appreciate any feedback on this approach. If everything looks good, I'll write tests and implement this in other themes.

Checklist

  • [ ] I'm updating documentation
  • [ ] I'm adding or updating code
    • [ ] I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • [ ] I've updated docs if needed
    • [ ] I've updated the changelog with a description of the PR
  • [ ] I'm adding a new feature
    • [ ] I've updated the playground with an example use of the feature

abdalla-rko avatar May 09 '24 00:05 abdalla-rko

@abdalla-rko If the goal is to update the errorSchema via a custom widget, maybe it makes sense to update the onChange in WidgetProps to function similarly to the onChange in FieldProps, where the errorSchema can be updated as it is flows through the schema hierarchy. Feel free to join the next meeting so we can talk about it. Or reach out to me on Discord

heath-freenome avatar May 10 '24 19:05 heath-freenome

@abdalla-rko are you still working on this?

nickgros avatar Jul 12 '24 19:07 nickgros

Hi @heath-freenome, Sorry for taking too long. I think the initial implementation is now like you suggested updating the errorSchema using onChange in the custom widget. Let me know if it's good and then I'll update the docs and other themes if needed.

abdalla-rko avatar Jul 14 '24 12:07 abdalla-rko