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

feat: adding support for OpenAPI 3.1 #378

Merged
merged 11 commits into from
Dec 2, 2021
Merged

feat: adding support for OpenAPI 3.1 #378

merged 11 commits into from
Dec 2, 2021

Conversation

erunion
Copy link
Member

@erunion erunion commented Oct 20, 2021

🧰 Changes

  • Adds support for OpenAPI 3.1 during API definition validation.
  • Supports OpenAPI 3.1 definitions to be uploaded to projects.
  • Updates oas to support OpenAPI 3.1 within its rdme oas generate command for generating API definitions.

Fixes RM-1813

🧬 QA & Testing

See tests.

@erunion erunion added the enhancement New feature or request label Oct 20, 2021
@erunion erunion requested a review from kanadgupta October 20, 2021 23:46
@@ -68,36 +68,7 @@ describe('rdme openapi', () => {
});
});

it('should error if API errors', () => {
Copy link
Member Author

@erunion erunion Dec 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a whole bunch of nits like this in this changeset but the gist of what I did in this file are:

  • Move errors into an "error handling" describe.
  • Fix some confusing it language.
  • Add some tests to make sure that errors that are coming back from oas-normalize (and @readme/openapi-parser) are of the new format.
  • Use specs that we have in @readme/oas-examples.
  • Add tests for JSON and YAML definitions.

const oas = new OASNormalize(specPath, { enablePaths: true });
await oas.validate().catch(err => {
const oas = new OASNormalize(specPath, { colorizeErrors: true, enablePaths: true });
await oas.validate(false, { validate: { colorizeErrors: true } }).catch(err => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option controls the pretty errors that'll be shown. If colorizeErrors is false (it's false by default) those errors will still look nice they just won't have colors or bold text.

@erunion erunion marked this pull request as ready for review December 2, 2021 04:20
@erunion erunion requested review from a team, Dashron and julshotal and removed request for a team December 2, 2021 04:20
Copy link

@julshotal julshotal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests look good 🎉

Copy link

@Dashron Dashron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally and it seems to be failing at readme.io, instead of in the lib, so it seems good to go once we're ready

@erunion erunion merged commit 2a6a240 into main Dec 2, 2021
@erunion erunion deleted the feat/openapi-3.1 branch December 2, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants