We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For complex OpenAPI types openapi-spec-validator fails when those types have a #ref reference and a default value specified.
openapi-spec-validator
#ref
For example, if I have the following cats_fail.yaml file:
cats_fail.yaml
openapi: 3.0.1 info: title: Cat API version: 2.0.0 paths: /yodeling: post: requestBody: description: Cats yodeling payload content: 'application/json': schema: $ref: '#/components/schemas/catsRequest' responses: '200': description: cats yodeling success components: schemas: catsRequest: type: object properties: name: $ref: "#/components/schemas/catName" default: { "name": "schrodinger" } catName: type: string
then running the following command:
openapi-spec-validator cats_fail.yaml
results in the following error message:
Unresolvable JSON pointer: 'components/schemas/catName'
However, for the following cats_success.yaml file:
cats_success.yaml
openapi: 3.0.1 info: title: Cat API version: 2.0.0 paths: /yodeling: post: requestBody: description: Cats yodeling payload content: 'application/json': schema: $ref: '#/components/schemas/catsRequest' responses: '200': description: cats yodeling success components: schemas: catsRequest: type: object properties: name: type: string default: { "name": "schrodinger" }
running:
openapi-spec-validator cats_success.yaml
results in OK response.
OK
The text was updated successfully, but these errors were encountered:
Looks like it's the same issue I reported on #92.
Sorry, something went wrong.
No branches or pull requests
For complex OpenAPI types
openapi-spec-validator
fails when those types have a#ref
reference and a default value specified.Steps to reproduce the problem
For example, if I have the following
cats_fail.yaml
file:then running the following command:
results in the following error message:
However, for the following
cats_success.yaml
file:running:
results in
OK
response.The text was updated successfully, but these errors were encountered: