Correct way to define array of enums in JSON schema -


i want describe json schema array, should consist of 0 or more predefined values. make simple, let's have these possible values: one, two , three.

correct arrays (should pass validation):

[] ["one", "one"] ["one", "three"] 

incorrect:

["four"] 

now, know "enum" property should used, can't find relevant information put it.

option (under "items"):

{     "type": "array",     "items": {         "type": "string",         "enum": ["one", "two", "three"]     } } 

option b:

{     "type": "array",     "items": {         "type": "string"     },     "enum": ["one", "two", "three"] } 

any thoughts?

option correct , satisfy requirements.

{     "type": "array",     "items": {         "type": "string",         "enum": ["one", "two", "three"]     } } 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -