Correct way to define array of enums in JSON schema

后端 未结 2 2002
盖世英雄少女心
盖世英雄少女心 2021-02-11 11:43

I want to describe with JSON schema array, which should consist of zero or more predefined values. To make it simple, let\'s have these possible values: one,

2条回答
  •  故里飘歌
    2021-02-11 12:17

    Option A is correct and satisfy your requirements.

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

提交回复
热议问题