Prevent additionalErrors from appending and show only latest error

I am using setAdditionalErrors to display custom validation errors in my form.


However, when the JSON schema validation also produces errors, the new errors are appended to the existing ones instead of replacing them. This leads to multiple error messages being displayed simultaneously on the UI, which affects the overall user experience.

My requirement is to ensure that only the most recent error is displayed (i.e., new errors should override any existing errors rather than being appended).
For example, I have a form with around 100 fields. After making an API call, the backend returns validation errors that I display on the UI. Later, when the UI triggers its own validation errors, both sets of errors appear together. One possible approach is to manually clear the previous errors for a specific field before setting new ones, but this does not scale well for large forms.
Is there any built-in way to replace existing errors when using additionalErrors, or any recommended approach to manage this efficiently for large forms?

Versions and dependepncy
@jsonforms/core": “^3.4.0”,
@jsonforms/material-renderers”: “^3.4.0”,
@jsonforms/react”: “^3.4.0”,

Hi @SatendraRaghav,

The additionalErrors are usually used “in addition” to the regular errors. So your backend API could for example only return errors which are not shown by JSON Forms already.

Alternatively you can run JSON Forms without any validation and use additionalErrors for all errors. For this you can run the validation which is usually done by JSON Forms manually and consolidate with the backend errors.