mobx-react-form icon indicating copy to clipboard operation
mobx-react-form copied to clipboard

SVK / ajv validated deep nested fields do not work

Open a--hoang opened this issue 6 years ago • 1 comments

When initializing a form with a JSON schema (as per the SVK documentation at HERE, nested fields do not work - only the top level fields work. For example:

The following is valid json schema:

{
    "$schema": "http://json-schema.org/schema#",

    "type": "object",

    "properties": {
        "form_name": {
            "type": "string",
            "default": "interest form",
            "enum": ["interest form"]
        },
        "contact_person": {
            "title": "Contact Person",
            "description": "Company's Point of Contact",
            "type": "object",
            "properties": {
                "first_name": {
                    "title": "First Name",
                    "description": "Contact Person's First Name",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 30,
                },
                "last_name": {
                    "title": "Last Name",
                    "description": "Contact Person's Last Name",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 30,
                },
            },
            "required": ["first_name", "last_name"],
        },
}

However, this fails to create the fields form.$('contact_person.first_name') and form.$('contact_person.last_name')

Instead, some of the tests specify that the schema should define the above nested field like so:

{
// Invalid JSON Schema
...
    "contact_person.first_name": { (etc) }
}

I've found a fix for this issue and will be opening a PR shortly, will update soon!

a--hoang avatar Apr 02 '18 20:04 a--hoang

@a--hoang hey! what about the PR? Anyway, the SVK plugin does not support deep nested fields yet.

foxhound87 avatar Feb 19 '19 22:02 foxhound87

Now SVK handle deep nested fields

foxhound87 avatar Dec 03 '23 09:12 foxhound87