swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

V3 spec checks

Open stueynz opened this issue 3 years ago • 5 comments

Re-did all my changes from last June/July into the top of main branch. Hopefully can be picked up this time.

Added checks and validations for v3.0.x OpenAPI schemas to match the pre-existing Swagger (or v2.0) schema checks. Added more known-errors - now that we're checking v3.0.x schemas, various real-world APIs are naughty.

stueynz avatar Jan 25 '22 05:01 stueynz

Thank you @stueynz! Checks are failing on lint, can you run npm run lint and make sure its not moaning about anything before resubmitting?

philsturgeon avatar Jan 25 '22 17:01 philsturgeon

Thank you @stueynz! Checks are failing on lint, can you run npm run lint and make sure its not moaning about anything before resubmitting?

Sure thing ... I'm assuming that warnings from things I haven't touched are ok. e.g explicit any in index.d.ts

stueynz avatar Jan 25 '22 19:01 stueynz

Added a few more checks when doing validateSpec() - OpenAPI keeps what used to be in #/definitions under #/components/{schemas, requestBodies, responses, parameters} so they all need to be checked for weirdness.

Also, when API doesn't have circular $refs we can recursively check schemas of all the properties when doing validateSchema()

stueynz avatar Jan 26 '22 09:01 stueynz

Finally, I've managed to unblock the release pipeline and we've got a stable test suite again. PHEW.

Sadly we cannot use optional chaining, and I'm not entirely sure why. I think it might be a dependency of simplifyify being out of date or something, but nothing I can do on my end is getting past an error with lib/validation/spec.js having a unexpected . on line 42.

philsturgeon avatar May 10 '22 21:05 philsturgeon