Skip to content

Adds nested schema attributes support with dot notation (v2)

Sébastien Demanou requested to merge thiagof:nested-attribute-names into master

Created by: thiagof

This code change allows schema definition with dot notation for nested data values.

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "business_name": {
            "type": "string", 
            "minLength": 8, 
            "maxLength": 80, 
            "attrs": {
                "placeholder": "User Email"
            }
        },
        "user.email": {
            "type": "string", 
            "minLength": 8, 
            "maxLength": 80, 
            "attrs": {
                "placeholder": "User Email"
            }
        },
        "user.name": {
            "type": "string", 
            "minLength": 8, 
            "maxLength": 80, 
            "attrs": {
                "placeholder": "User First and Second Name"
            }
        },
    },
    "additionalProperties": false,
    "required": ["name", "email", "password", "termsAccepted"]
}

this schema to work on a dataset like this

{
    "business_name": "ACME",
    "user": {
        "name": "Jon Doe",
        "email": "jon@acme.us"
    },
}

Merge request reports

Loading