menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

JSONForms

JSON Forms is a JSON Schema based approach for creating forms and comes with support for React, Angular and Vue. Support here is free, but might involve some delay in the replies based on our current workload for paying customers. We also offer PROFESSIONAL SUPPORT packages to get you started quickly with JSON Forms and to help you with any questions and technical difficulties for JSON Forms with guaranteed response time and in-depth technical solutions. For details please see our web page linked below.

Channels
Team

custom error messages

April 22, 2021 at 8:17am

custom error messages

April 22, 2021 at 8:17am
Hi,
we have integrated jsonforms with react app, can you please share the examples how to integrated ajv for custom error messages.
thanks

April 22, 2021 at 8:57am
Hi. You can use ajv-errors for that. Note that we currently use Ajv v6, therefore you also need to use ajv-errors v1. You can use the createAjv function exported from /core to create your Ajv instance, customize it with ajv-errors and then pass it as a prop to JsonForms.
thanks for the quick response I have installed ajv-errors v1
first I have a added a property called errorMessage in my schema ie: errorMessage : "test message" and then const ajv = createAjv(); const validate = ajv.compile(schema); and finally passing ajv obj as props to jsonforms
im still seeing the default messages
are my steps are correct please help me. thanks