-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
fix(openapi): support nullish consts #751
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems right, but I would like to have a second opinion by @ivan-tymoshenko
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really deep into this library. The only thing I would check (add a test) is how it would work with nullable
keyword and type null
. For example:
{
"type": "string",
"nullable": false,
"const": null
}
and
{
"type": "string",
"const": null
}
Both these schemas are invalid (there is no value that would match them). You want to be sure that you handle cases like that correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
In both of these cases I'd argue it's not the job of this library to figure out what may have been implied, but just convert it to an equally useless (albeit OAS compatible) schema. I would like to mention that one could make an argument for converting: {
"const": null
} to: {
"enum": [null],
"nullable": true // with this added
} but that is is not required from my understanding of the spec (which seems to be in line with the swagger-validator). |
Checklist
npm run test
andnpm run benchmark
and the Code of conduct