Skip to content

Comments

feat: support OpenAPI 3.1#78

Merged
kettanaito merged 2 commits intomswjs:mainfrom
louis-bompart:feat/oapi3.1-support
Sep 16, 2025
Merged

feat: support OpenAPI 3.1#78
kettanaito merged 2 commits intomswjs:mainfrom
louis-bompart:feat/oapi3.1-support

Conversation

@louis-bompart
Copy link
Contributor

@louis-bompart louis-bompart commented Aug 29, 2025

Fixes #71

@@ -1,5 +1,5 @@
import { HttpHandler, http } from 'msw'
import type { OpenAPIV3, OpenAPIV2, OpenAPI } from 'openapi-types'
import type { OpenAPIV3_1, OpenAPIV3, OpenAPIV2, OpenAPI } from 'openapi-types'
Copy link
Member

Choose a reason for hiding this comment

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

Are V3_1 types different from V3? 🤔 They probably introduce new features, right?

*/
export async function fromOpenApi(
document: string | OpenAPI.Document | OpenAPIV3.Document | OpenAPIV2.Document,
document:
Copy link
Member

Choose a reason for hiding this comment

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

It would be great to add some tests to make sure we actually support OAS 3.1. You don't have to add them yourself but I'd appreciate if you shared some usage examples that rely on 3.1 and then we can put them into automated tests.

document:
| string
| OpenAPI.Document
| OpenAPIV3_1.Document
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to add explicit V3_1 and V3 reference as they are included in the OpenAPI namespace automatically:

export declare namespace OpenAPI {
    type Document<T extends {} = {}> = OpenAPIV2.Document<T> | OpenAPIV3.Document<T> | OpenAPIV3_1.Document<T>;

@kettanaito kettanaito merged commit b9c9808 into mswjs:main Sep 16, 2025
1 check passed
@kettanaito
Copy link
Member

Released: v0.5.0 🎉

This has been released in v0.5.0!

Make sure to always update to the latest version (npm i @mswjs/source@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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.

OpenAPI 3.1

2 participants