Empty (Optional) Enums result in validation errors #1261
dries007
started this conversation in
Feature request
Replies: 1 comment
-
According to JSONSchema, the enum "SHOULD" have at least one value—doesn't say "MUST", so I suppose we could do something with an empty enum array rather than erroring. Wouldn't that create impossible Python code, though? If a parameter takes in a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
The following snippet from my openapi file results in errors, while it's handled correctly by the docgen tools I've used so far:
Errors:
This is what it looks like in Swagger's ui thing:
I could add a special case to the generator code to avoid this parameter when the list of options is empty, but I'd rather keep it generic if at all possible.
My expectation for the generated code would be that it makes an empty enum, something like this:
Omitting the option from the parameter list would also be OK I guess, but leaves less room for forward comparability.
I wouldn't mind making an MR, but I would like to avoid spending the effort if it has no chance of getting accepted.
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions