jsonschema - How to use JSON schema oneOf for arrays with fixed values -


i want specify multiple values oneof , have defined below schema validates (http://json-schema-validator.herokuapp.com/). note there deliberately 1 value under oneof in example.

{     "id": "test-schema",     "$schema": "http://json-schema.org/draft-04/schema#",     "description": "test schema",      "type": "object",     "properties": {          "alpha": {              "type": "object",             "properties": {                  "beta": {                      "oneof": [                         {                             "type": "object",                             "properties": {                                  "obja": {                                      "type": "object",                                     "properties": {                                          "a": {                                              "type": "array",                                             "items": {                                                  "type": "number",                                                 "default": [90, 95],                                                 "additionalproperties": false                                             },                                             "additionalproperties": false                                         },                                          "b": {                                              "type": "array",                                             "items": {                                                  "type": "number",                                                 "default": [4, 8],                                                 "additionalproperties": false                                             },                                             "additionalproperties": false                                         },                                          "c": {                                              "type": "array",                                             "items": {                                                  "type": "number",                                                 "default": [0.2, 0.6],                                                 "additionalproperties": false                                             },                                             "additionalproperties": false                                         }                                     },                                                                         "additionalproperties": false                                 }                             },                              "additionalproperties": false                         }                     ]                 }             },                      "additionalproperties": false         }     },     "additionalproperties": false }     

q1: using default specify initial array value want these fixed , disallow other values. how can achieve this?

answered here how specify oneof item json object should take? .

q2: want specify beta assigned obja in json file validates against schema, how specify this?

answered here how specify oneof item json object should take? .

answered here how specify oneof item json object should take?

this link first attempt @ question posed in more complicated way, here tried simplify it. answered refer it.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -