diff --git a/.changeset/bright-hats-arrive.md b/.changeset/bright-hats-arrive.md deleted file mode 100644 index 1591920..0000000 --- a/.changeset/bright-hats-arrive.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -"openapi-msw": minor ---- - -Added `query` helper to resolver-info argument. It provides a type-safe wrapper around `URLSearchParams` for reading search parameters. As usual, the information about available parameters is inferred from your OpenAPI spec. - -```typescript -/* -Imagine this endpoint specification for the following example: - -/query-example: - get: - summary: Query Example - operationId: getQueryExample - parameters: - - name: filter - in: query - required: true - schema: - type: string - - name: page - in: query - schema: - type: number - - name: sort - in: query - required: false - schema: - type: string - enum: ["asc", "desc"] - - name: sortBy - in: query - schema: - type: array - items: - type: string -*/ - -const handler = http.get("/query-example", ({ query }) => { - const filter = query.get("filter"); // Typed as string - const page = query.get("page"); // Typed as string | null since it is not required - const sort = query.get("sort"); // Typed as "asc" | "desc" | null - const sortBy = query.getAll("sortBy"); // Typed as string[] - - // Supported methods from URLSearchParams: get(), getAll(), has(), size - if (query.has("sort", "asc")) { - /* ... */ - } - - return HttpResponse.json({ - /* ... */ - }); -}); -``` diff --git a/.changeset/modern-seals-glow.md b/.changeset/modern-seals-glow.md deleted file mode 100644 index 1d12cf7..0000000 --- a/.changeset/modern-seals-glow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openapi-msw": minor ---- - -Restructured the library to add support for additional response resolver info. The enhanced `ResponseResolver` type and `ResponseResolverInfo` are available as exports. diff --git a/CHANGELOG.md b/CHANGELOG.md index bc22a18..fa09527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,62 @@ # openapi-msw +## 0.3.0 + +### Minor Changes + +- [#33](https://github.com/christoph-fricke/openapi-msw/pull/33) [`1f3958d`](https://github.com/christoph-fricke/openapi-msw/commit/1f3958dee1fce818b20c37bf486d6d73a0fcd1ea) Thanks [@christoph-fricke](https://github.com/christoph-fricke)! - Added `query` helper to resolver-info argument. It provides a type-safe wrapper around `URLSearchParams` for reading search parameters. As usual, the information about available parameters is inferred from your OpenAPI spec. + + ```typescript + /* + Imagine this endpoint specification for the following example: + + /query-example: + get: + summary: Query Example + operationId: getQueryExample + parameters: + - name: filter + in: query + required: true + schema: + type: string + - name: page + in: query + schema: + type: number + - name: sort + in: query + required: false + schema: + type: string + enum: ["asc", "desc"] + - name: sortBy + in: query + schema: + type: array + items: + type: string + */ + + const handler = http.get("/query-example", ({ query }) => { + const filter = query.get("filter"); // Typed as string + const page = query.get("page"); // Typed as string | null since it is not required + const sort = query.get("sort"); // Typed as "asc" | "desc" | null + const sortBy = query.getAll("sortBy"); // Typed as string[] + + // Supported methods from URLSearchParams: get(), getAll(), has(), size + if (query.has("sort", "asc")) { + /* ... */ + } + + return HttpResponse.json({ + /* ... */ + }); + }); + ``` + +- [#35](https://github.com/christoph-fricke/openapi-msw/pull/35) [`07fa9b0`](https://github.com/christoph-fricke/openapi-msw/commit/07fa9b0822c441708c70d3e0698a6dbe7577f58c) Thanks [@christoph-fricke](https://github.com/christoph-fricke)! - Restructured the library to add support for additional response resolver info. The enhanced `ResponseResolver` type and `ResponseResolverInfo` are available as exports. + ## 0.2.2 ### Patch Changes diff --git a/package-lock.json b/package-lock.json index e9e751a..a10698e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openapi-msw", - "version": "0.2.2", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openapi-msw", - "version": "0.2.2", + "version": "0.3.0", "license": "MIT", "dependencies": { "openapi-typescript-helpers": "^0.0.7" diff --git a/package.json b/package.json index 9762e3e..bb63d54 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/package.json", "name": "openapi-msw", "type": "module", - "version": "0.2.2", + "version": "0.3.0", "license": "MIT", "author": "Christoph Fricke ", "description": "Tiny, type-safe wrapper around MSW for type inference from OpenAPI schemas.",