Custom error message with i18n

Based on i18n preview documentation and previous topics, I have tried out custom error message. It is working for single fields. However, it is not working when i tried to custom error message for fields inside the array.

I have also tried out the ajv-errors for fields inside an array in react. It is not working.

Please advise on custom error message in jsonforms

i18n preview documentation: i18n - JSON Forms
Unclear of how to implement ajv-errors to display customer error messages below the label/input element - #9 by Icenwharth

  1. Single fields (Working)
    image
    image

  2. Fields in array (Not working)


schema.json

    const schema = {
        type: "object",
        properties: {
            comments: {
                type: "array",
                items: {
                    type: "object",
                            properties: {
                                message: {
                                    type: "string",
                                    maxLength: 5,
                                },
                                enum: {
                                    type: "string",
                                    enum: ["foo", "bar"],
                                },
                            }
                },
            },
        },
    };

uischema.json

    const uischema = {
        type: "VerticalLayout",
        elements: [
            {
                type: "Control",
                scope: "#/properties/comments",
            },
        ],
    };

Hi @newbieJson,

Sadly the internationalization support is currently only implemented for the regular bindings, not for the cell bindings. This is why it doesn’t work for you.

Until this is implemented you will need to handle the internationalization yourself via custom cell renderers. Of course you can reuse the core JSON Forms internationalization utils for that.

If applicable to you, you could use the “array layout” renderer instead of the “array table” renderer. The array layout renderer renders each array item in an own collapsible section. There only the regular renderers are used which have full internationalization support.