json-schema icon indicating copy to clipboard operation
json-schema copied to clipboard

fix: Allow enum with type null

Open MathieM opened this issue 2 years ago • 0 comments

Enum with both type with null, and string thow a validation error.

{
    "type": ["string", null],
    "enum": ["A", "B"]
}

Today we need to use

{
  "oneOf": {
      [
          {
              "type": null
          },
          {
              "type": "string",
              "enum": ["A", "B"]
          }
      ]
  }
}

or

{
    "type": ["string", null],
    "enum": [null, "A", "B"]
}

MathieM avatar Jan 05 '23 16:01 MathieM