-
Notifications
You must be signed in to change notification settings - Fork 35
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 ignored on property values #240
Comments
Hi @Foorack, thanks for raising this 🙂 It seems In any case, I think validation is done by one of our dependencies, openapi-response-validator, perhaps on this line. That code seems to support To pinpoint this bug would you mind recreating it using this template? |
Fyi the OpenAPI maintainers got back to me on how to define nullable properties in OpenAPI, let me know if it works! |
Thank you @rwalle61! We will try that and get back to you. |
I'm having trouble testing this, as we are generating code with |
hmm the dependency we use to validate OpenAPI files does not seem to like the If I change our openapi: 3.0.0
info:
title: Example OpenApi 3 spec
description: Use to recreate a bug
version: 0.1.0
paths:
/recreate/bug:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
type: 'null' then this const res = {
status: 200,
req: {
method: 'GET',
path: '/recreate/bug',
},
body: null,
}; However if I use an array in the openapi.yml: '200':
description: OK
content:
application/json:
schema:
type: ['null'] Then our validator dependency outputs this validation error:
However, JSON schema specifically recommends Our validator dependency is openapi-response-validator. They use AJV, so perhaps the issue is in there. However if Unfortunately, I don't have time to do this at the moment, but would appreciate if anyone else does! |
OpenAPI version
3.0
Is your feature request related to a problem? Please describe.
Current validation does not respect nullable on propertiy fields.
User.yaml:
Response is
accountDeletionDate
is null.Error message:
res did not satisfy it because: accountDeletionDate should be string
Describe the solution you'd like
For the validation to pass.
Are you going to resolve the issue?
I can make a PR if that will be fastest.
The text was updated successfully, but these errors were encountered: