openapi3_parser icon indicating copy to clipboard operation
openapi3_parser copied to clipboard

Validation for empty enums

Open jjercx opened this issue 2 years ago • 1 comments

I was using this gem to check if a spec created programmatically was valid, using parser.valid?.

Yet, using this VSCode extension, I've noticed an error this gem wasn't able to catch.

According to the spec:

The value of this keyword MUST be an array. This array SHOULD have at least one element.

And my spec contained:

enum: []

The error from the extension is Array has too few items. Expected 1 or more. Shouldn't this gem provide something similar?

jjercx avatar Aug 04 '22 21:08 jjercx

Hey @jjercx, thanks for opening an issue.

As this is a "SHOULD" rather than a "MUST" this isn't validated against. This is because if it is empty it is still valid. If this project had a concept of warnings then this would be a warning rather than an error.

kevindew avatar Aug 17 '22 19:08 kevindew