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/feature-fetch"target="_blank"rel="noreferrer">feature-fetch</a> by <ahref="https://builder.group"target="_blank"rel="noreferrer">builder.group</a></summary>
81
+
<summary><ahref="https://www.npmjs.com/package/feature-fetch"target="_blank"rel="noreferrer">feature-fetch</a> by <ahref="https://github.com/builder-group/community"target="_blank"rel="noreferrer">builder.group</a></summary>
82
+
83
+
`feature-fetch` fits when you want OpenAPI-typed requests with explicit success and error branches. It types path strings, params, request bodies, and response data from generated `paths`. Calls return `[ok, error, data]`, so failures stay visible at the call site and success branches narrow data. Retry, cache, hooks, and middleware can be added when the client needs production behavior.
@@ -259,126 +246,86 @@ TypeChecking in server environments can be tricky, as you’re often querying da
259
246
260
247
## Hono with [`openapi-ts-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-ts-router)
261
248
262
-
[`openapi-ts-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-ts-router) provides full type-safety and runtime validation for your HonoAPI routes by wrapping a [Hono router](https://hono.dev/docs/api/routing):
263
-
264
-
::: tip Good to Know
265
-
266
-
While TypeScript ensures compile-time type safety, runtime validation is equally important. `openapi-ts-router` integrates with Zod/Valibot to provide both:
267
-
- Types verify your code matches the OpenAPI spec during development
268
-
- Validators ensure incoming requests match the spec at runtime
269
-
270
-
:::
249
+
[`openapi-ts-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-ts-router) fits when the OpenAPI document should constrain the server code that implements it. It wraps a [Hono router](https://hono.dev/docs/api/routing), keeps OpenAPI path strings such as `/pet/{petId}` in route registration, and TypeScript rejects unknown paths, wrong methods, missing required schemas, and JSON success responses that do not match the schema. Validate request parts with any [Standard Schema](https://standardschema.dev/) library, then read parsed values from `c.req.valid()`.
- Full type safety for routes, methods, params, body and responses
317
-
- Runtime validation using Zod/Valibot
318
-
- Catches API spec mismatches at compile time
319
-
- Zero manual type definitions needed
320
-
321
288
## Express with [`openapi-ts-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-ts-router)
322
289
323
-
[`openapi-ts-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-ts-router) provides full type-safety and runtime validation for your Express API routes by wrapping a [Express router](https://expressjs.com/en/5x/api.html#router):
324
-
325
-
::: tip Good to Know
326
-
327
-
While TypeScript ensures compile-time type safety, runtime validation is equally important. `openapi-ts-router` integrates with Zod/Valibot to provide both:
328
-
- Types verify your code matches the OpenAPI spec during development
329
-
- Validators ensure incoming requests match the spec at runtime
330
-
331
-
:::
290
+
[`openapi-ts-router`](https://github.com/builder-group/community/tree/develop/packages/openapi-ts-router) fits when the OpenAPI document should constrain an existing Express API implementation. It wraps an [Express router](https://expressjs.com/en/5x/api.html#router), keeps OpenAPI path strings such as `/pet/{petId}` in route registration, and TypeScript rejects unknown paths, wrong methods, missing required schemas, and JSON success responses that do not match the schema. Validate request parts with any [Standard Schema](https://standardschema.dev/) library, then read parsed values from `req.valid`. Mount `express.json()` before this router when validating JSON bodies.
- Full type safety for routes, methods, params, body and responses
378
-
- Runtime validation using Zod/Valibot
379
-
- Catches API spec mismatches at compile time
380
-
- Zero manual type definitions needed
381
-
382
329
## Mock-Service-Worker (MSW)
383
330
384
331
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.
0 commit comments