-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nullable enum warning for null value in example section #1353
Comments
Do you even need to have that null in there? Isn't that redundant? |
Yes, it's redundant. But I'm trying to document existing API which is already used in such way. |
OpenAPI wouldn’t care unless... are you trying to have a literal null or a string which is a “null”? If the API is spitting out “null” then you cannot use nullable: true.
|
A literal null. |
Ok so when you’ve removed it from the OpenAPI description, how does Spectral behave? It’s one less thing for us to worry about and as it’s literally redundant it doesn’t need to be there. If it’s still broke we can look into it.
|
When I remove result:null from example, output is:
When I remove null from enum values, output is:
When I remove both result:null and null from enum values, no problem found. |
I receive warning when trying to use null value in example section for property with enum.
To Reproduce
Given this OpenAPI/AsyncAPI document:
nullable_enum.yaml
Run this CLI command:
Expected behavior
No warnings produced
Environment:
Additional context
FROM node:14.11-slim
RUN yarn global add @stoplight/spectral
ADD nullable_enum.yaml nullable_enum.yaml
RUN spectral lint -v nullable_enum.yaml
The text was updated successfully, but these errors were encountered: