react-jsonschema-form
react-jsonschema-form copied to clipboard
How to get `rawErrors` for parent schema or `errorSchema` in custom BaseInputTemplate
Prerequisites
- [X] I have read the documentation
What theme are you using?
core
What is your question?
I am specifying a custom BaseInputTemplate
and ObjectFieldTemplate
in my project. My schema is complex enough that I have a nested properties inside of a allOf/if/then
schema. See example: https://stackblitz.com/edit/vitejs-vite-srg8et?file=src%2FApp.tsx
In the example above, when you submit without entering any information you will see validation failed. But the inputs will not be in an error state since we do not have anything in the rawErrors
prop being passed to the BaseInputTemplate
.
How do I get the rawErrors
from the parent schema (in this case it would be usernameAndPassword
) in this field? Alternatively is it possible to pass the full errorSchema
to the BaseInputTemplate
instead?
note: I understand I can get the errorSchema
from ErrorListTemplate
but this means I would need to pass it down via context which I don't think is ideal.
If you switch the auth type to "SSO" and submit without entering information you will observe the input in a error state.