swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Validate null value in enums

Open mwxxhdb opened this issue 4 years ago • 1 comments

Incorrect YAML

EnumObject:
  type: string
  enum:
    - NULL
    - ITEM1
    - ITEM2

Correct YAML

EnumObject:
  type: string
  enum:
    - 'NULL'
    - ITEM1
    - ITEM2

Issue: There are warnings if using the incorrect YAML in SwaggerHub, but swagger-cli said the document is valid.

Warnings from SwaggerHub: enum value should conform to its schema's type

Expect result: Same warning as SwaggerHub.

mwxxhdb avatar May 08 '20 05:05 mwxxhdb

If you want a really really good validator then give Spectral a go. I helped make it, it does loooooooads of stuff and has far more active development being done.

Otherwise, a PR for this would be appreciated. :D

philsturgeon avatar Aug 15 '21 09:08 philsturgeon