-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate external errors in form #1937
Integrate external errors in form #1937
Conversation
9584e7e
to
fc54e9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good already!
Can you add an example to the example app which adds/removes multiple additional errors on the click of a button?
packages/core/src/reducers/core.ts
Outdated
) => (state: JsonFormsCore): ErrorObject[] => { | ||
const errors = state.errors ?? []; | ||
const additionalErrors = state.additionalErrors ?? []; | ||
return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide' ? [...additionalErrors] : [...errors, ...additionalErrors]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide' ? [...additionalErrors] : [...errors, ...additionalErrors]); | |
return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide' ? additionalErrors : [...errors, ...additionalErrors]); |
Add support for specifying external errors via `additionalErrors: ajv.ErrorObject[]` prop. The additional errors are merged with the validation errors and are supplied to the affected controls. The additional errors are not affected by the validationMode like the validation errors are and it is the responsability of the framework user to update the prop when applicable (e.g. on ValidationMode changes). Fixes eclipsesource#1926 Contributed on behalf of STMicroelectronics Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
fc54e9a
to
fb89b1e
Compare
Thank you for the review, Stefan! I updated the code and added examples for React (material and vanilla) and vue-vanilla. The contributed example should work with the angular examples as well when they'll support displaying buttons for the contributed actions like the React app (it's currently not the case). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thank you!
Add support for specifying external errors via
additionalErrors: ajv.ErrorObject[]
prop.The additional errors are merged with the validation errors and are
supplied to the affected controls. The additional errors are not
affected by the validationMode like the validation errors are and it is
the responsability of the framework user to update the prop when
applicable (e.g. on ValidationMode changes).
Fixes #1926
Contributed on behalf of STMicroelectronics