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
Post a Comment