jsonschema - "required" keyword in JSON schema -


i got below schema http://json-schema.org/examples.html, want know if required keyword can come @ top level. or can come within properties if there property of type object.i not find thing related in specification http://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.3.

{     "title": "example schema",     "type": "object",     "properties": {         "firstname": {             "type": "string"         },         "lastname": {             "type": "string"         },         "age": {             "description": "age in years",             "type": "integer",             "minimum": 0         }     },     "required": ["firstname", "lastname"] } 

so below example valid schema

{      "title":"example schema",    "type":"object",    "properties":{         "firstname":{            "type":"string"       },       "lastname":{            "type":"string"       },       "age":{            "type":"object",          "properties":{               "minage":{                  "type":"number"             },             "maxage":{                  "type":"number"             },             "required":[                  "minage",                "maxage"             ]          }       }    },    "required":[         "firstname",       "lastname"    ] } 

4.4 keywords possibility validate container instances (arrays or objects) validate instances , not children (array items or object properties).

so see yes, can have on level validation should consider on same level required


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -