-
Notifications
You must be signed in to change notification settings - Fork 6
add example and support with OpenAPI 3.2 #767
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
Conversation
Allow the CLI to preview and deploy OpenAPI documents with version 3.2 Add a related example in examples/valid repo, and dedicated tests. Error message will change when unexpected version is deployed: > Error: Unsupported API specification (OpenAPI 4.2.0) > Please try again with an OpenAPI 2.0, 3.0, 3.1, 3.2 or AsyncAPI 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 file. Note/Question: I don't know how to access to oas-schemas/schemas/v3.2/schema.json (do we need to upgrade to dependency?), so I favored the same schema 'oas-schemas/schemas/v3.2/schema.json' for now.
There's no maintained package in npm with the schemas so it's indeed « relou ». I'd say we should download the latest schemas from the openapi spec website and put them in the CLI. So we can require them locally, here are the latest revisions for each OAS version:
Let's put them in a directory in the CLI and require them in the definition.ts file. |
Create a new folder core/schemas/oas-schemas,
wtih all OpenAPI schemas (2.0, 3.0, 3.1 and the new 3.2).
Via `oas-schemas/index.ts`,
export a JSON object with all these schemas:
```
schemas: {
'2.0': schemaV20,
'3.0': schemaV30,
'3.1': schemaV31,
'3.2': schemaV32,
}
```
Thus, each schema can be accessed with simple command
`'3.2': openapiSchemas.schemas['3.2']`,
similarly to what we do for asyncapi schemas.
following suggestion from #767 (comment)
cc @paulRbr I reworked the PR following your suggestion, in second commit. All tests are green, and I can successfully deploy an OpenAPI 3.2 document via the cli:
But there is this warning ' ExperimentalWarning: Importing JSON modules ', and I don't find out how to properly import these JSON files... do you have an idea? |
Thanks! Can you remove the old dependency of |
|
Thanks for this 4 hands PR, I click on 'approve' for the last commits where dependency 'oas-schemas' is removed, and exported json type is clarified. LGTM |
Create a new folder core/schemas/oas-schemas,
wtih all OpenAPI schemas (2.0, 3.0, 3.1 and the new 3.2).
Via `oas-schemas/index.ts`,
export a JSON object with all these schemas:
```
schemas: {
'2.0': schemaV20,
'3.0': schemaV30,
'3.1': schemaV31,
'3.2': schemaV32,
}
```
Thus, each schema can be accessed with simple command
`'3.2': openapiSchemas.schemas['3.2']`,
similarly to what we do for asyncapi schemas.
following suggestion from #767 (comment)
Allow the CLI to preview and deploy OpenAPI documents with version 3.2
Add a related example in examples/valid repo,
and dedicated tests.
Error message will change when unexpected version is deployed:
Note/Question:
cf line
I don't know how to access to
oas-schemas/schemas/v3.2/schema.json
So we changed access to openapi schemas, all these schemas are now stored in this lib,
in
src/core/schemas/oas-schemas/*,and dependency to
oas-schemascan be removed (dedicate commit)