mobx-react-form
mobx-react-form copied to clipboard
SVK / ajv validated deep nested fields do not work
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 hey! what about the PR? Anyway, the SVK plugin does not support deep nested fields yet.
Now SVK handle deep nested fields