Skip to content

Conversation

@Polo2
Copy link
Member

@Polo2 Polo2 commented Nov 6, 2025

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:

cf line

I don't know how to access to
oas-schemas/schemas/v3.2/schema.json
(do we need to upgrade to dependency?, there is currently an error),
so I favored the same schema
'oas-schemas/schemas/v3.1/schema.json'
for now.

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.
@Polo2 Polo2 self-assigned this Nov 6, 2025
@paulRbr
Copy link
Member

paulRbr commented Nov 6, 2025

oas-schemas/schemas/v3.2/schema.json
(do we need to upgrade to dependency?, there is currently an error),

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)
@Polo2
Copy link
Member Author

Polo2 commented Nov 20, 2025

following #767 (comment)

cc @paulRbr

I reworked the PR following your suggestion, in second commit.
Now, all OAS schemas are stored locally, in file src/core/schemas/oas-schemas/v*/schema.json
They can easily be loaded from src/definition.ts.

All tests are green, and I can successfully deploy an OpenAPI 3.2 document via the cli:

./bin/run.js preview examples/valid/openapi.v3.2.yml
(node:33944) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use node --trace-warnings ... to show where the warning was created)
Your preview is visible at: https://bump.sh/preview/68778303-e03e-426e-84b5-ee98b32db518 (Expires at 2025-11-20T14:51:45+01:00)

  • Let's render a preview on Bump.sh... done

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?

@Polo2 Polo2 requested a review from paulRbr November 20, 2025 13:42
@paulRbr
Copy link
Member

paulRbr commented Nov 20, 2025

I reworked the PR following your suggestion, in second commit.

Thanks! Can you remove the old dependency of oas-schemas from the package.json please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants