Skip to content
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

OpenAPI specification does not pass validation #478

Closed
axeljaeger opened this issue Feb 4, 2024 · 3 comments
Closed

OpenAPI specification does not pass validation #478

axeljaeger opened this issue Feb 4, 2024 · 3 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@axeljaeger
Copy link

Component
What is the bug in?

  • HTTP spec

Describe the bug
The provided openapi.json contains some errors so they do not pass validation. The errors are:

Swagger schema validation failed.
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must have required property 'required'
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must match "then" schema
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must match "else" schema


Error: Swagger schema validation failed.
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must have required property 'required'
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must match "then" schema
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must match "else" schema

    at o (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:95564)
    at https://apitools.dev/swagger-parser/online/js/bundle.min.js:29:45042

SyntaxError: Swagger schema validation failed.
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must have required property 'required'
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must match "then" schema
  #/paths/~1gopro~1camera~1shutter~1{mode}/get/parameters/0 must match "else" schema

    at Function.o [as syntax] (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:95564)
    at validateSchema (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:6322)
    at SwaggerParser.validate (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:3391)

This is causing problem when creating code from the specification. If you are using openapi-generator, you have to pass --skip-validate-spec to make the code generation start.

To Reproduce
Paste the spec to https://apitools.dev/swagger-parser/online/ and press validate

Additional context
Hey guys, I am so happy that you moved to OpenAPI compatible spec. Thank you so much! Now I am challenging it by throwing the complete OpenAPI ecosystem on it.

@axeljaeger axeljaeger added the bug Something isn't working label Feb 4, 2024
@github-actions github-actions bot added the triage Needs to be reviewed and assigned label Feb 4, 2024
@tcamise-gpsw tcamise-gpsw self-assigned this Apr 10, 2024
@tcamise-gpsw tcamise-gpsw added documentation Improvements or additions to documentation and removed triage Needs to be reviewed and assigned labels Apr 10, 2024
@tcamise-gpsw
Copy link
Collaborator

This is interesting. The spec is validated by Redocly .
My guess here is that I have set a more lax set of rules for validation than what is being used by Swagger.

Is this wrong? Perhaps. I'll need to look into this some more.

@tcamise-gpsw
Copy link
Collaborator

It turns out i had disabled Redocly verification. I turned this back on and fixed some errors but there are still some errors that show from openapi-generator and not in Redocly. I guess I'll add both of this to the CI flow (and maybe Swagger validate also in the future).

I should have the doubly-validated spec out next week.

@tcamise-gpsw
Copy link
Collaborator

This is fixed as of this commit and should remain so since we are now validating after building the spec.

I did not add in Swagger validation since hopefully everything is covered by Redocly and openapi-generator validation but can if needed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants