You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<summary><ahref="https://www.npmjs.com/package/openapi-typescript-fetch"target="_blank"rel="noreferrer">openapi-typescript-fetch</a> by <ahref="https://github.com/ajaishankar"target="_blank"rel="noreferrer">@ajaishankar</a></summary>
awaitupdateBlogPost({ body: { title: 'My New Post' } });
71
+
} catch (error) {
72
+
console.error('Error:', error);
73
+
}
74
+
```
75
+
76
+
:::
77
+
78
+
</details>
79
+
80
+
<details>
81
+
<summary><ahref="https://www.npmjs.com/package/feature-fetch"target="_blank"rel="noreferrer">feature-fetch</a> by <ahref="https://github.com/builder-group"target="_blank"rel="noreferrer">builder.group</a></summary>
@@ -60,6 +187,108 @@ TypeChecking in server environments can be tricky, as you’re often querying da
60
187
61
188
:::
62
189
190
+
## Hono with [`@blgc/openapi-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-router)
191
+
192
+
Instead of manually typing each route with generics as in the [Hono example](#hono), [`@blgc/openapi-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-router) wraps around the [Hono router](https://hono.dev/docs/api/routing) to deliver full typesafety and enforce your OpenAPI-Schema with validators.
193
+
194
+
::: tip Good To Know
195
+
196
+
While TypeScript types ensure compile-time safety, they don't enforce runtime schema validation. For runtime compliance, you need to integrate with validation libraries like Zod or Valibot. Although you must define the validation rules manually, they are type-safe to ensure these rules are correctly defined.
## Express with [`@blgc/openapi-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-router)
242
+
243
+
[`@blgc/openapi-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-router) wraps around the [Express router](https://expressjs.com/en/5x/api.html#router) to deliver full typesafety and enforce your OpenAPI-Schema with validators.
244
+
245
+
::: tip Good To Know
246
+
247
+
While TypeScript types ensure compile-time safety, they don't enforce runtime schema validation. For runtime compliance, you need to integrate with validation libraries like Zod or Valibot. Although you must define the validation rules manually, they are type-safe to ensure these rules are correctly defined.
If you are using [Mock Service Worker (MSW)](https://mswjs.io) to define your API mocks, you can use a **small, automatically-typed wrapper** around MSW, which enables you to address conflicts in your API mocks easily when your OpenAPI specification changes. Ultimately, you can have the same level of confidence in your application's API client **and** API mocks.
openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Weighs **5 kb** and has virtually zero runtime. Works with React, Vue, Svelte, or vanilla JS.
7
+
openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Weighs **6 kb** and has virtually zero runtime. Works with React, Vue, Svelte, or vanilla JS.
_\*[Benchmarks are approximate](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-fetch/test/index.bench.js) to just show rough baseline and will differ among machines and browsers. The relative performance between libraries is more reliable._
18
19
19
-
The syntax is inspired by popular libraries like react-query or Apollo client, but without all the bells and whistles and in a 5 kb package.
20
+
The syntax is inspired by popular libraries like react-query or Apollo client, but without all the bells and whistles and in a 6 kb package.
20
21
21
22
::: code-group
22
23
@@ -55,7 +56,7 @@ Notice there are no generics, and no manual typing. Your endpoint’s request an
55
56
- ✅ No manual typing of your API
56
57
- ✅ Eliminates `any` types that hide bugs
57
58
- ✅ Also eliminates `as` type overrides that can also hide bugs
58
-
- ✅ All of this in a **5 kb** client package 🎉
59
+
- ✅ All of this in a **6 kb** client package 🎉
59
60
60
61
## Setup
61
62
@@ -177,7 +178,9 @@ If you prefer selecting the path as a property, you can create a path based clie
Copy file name to clipboardExpand all lines: packages/openapi-fetch/CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,16 @@
1
1
# openapi-fetch
2
2
3
+
## 0.11.1
4
+
5
+
### Patch Changes
6
+
7
+
-[#1831](https://github.com/openapi-ts/openapi-typescript/pull/1831)[`091e71a`](https://github.com/openapi-ts/openapi-typescript/commit/091e71ad4bf805be32261a53524f320c2fa42690) Thanks [@SebastienGllmt](https://github.com/SebastienGllmt)! - Add MethodResponse utility type to easily get the return type of an endpoint on a client
8
+
9
+
-[#1833](https://github.com/openapi-ts/openapi-typescript/pull/1833)[`cec023d`](https://github.com/openapi-ts/openapi-typescript/commit/cec023d3461c79ca355a88366949d0f6382e4e2a) Thanks [@ngraef](https://github.com/ngraef)! - Fix identification of required properties when `strictNullChecks` is disabled
0 commit comments