{"owner":"openapi-ts","repo":"openapi-typescript","hasSkills":true,"totalSkillsCount":10,"totalTokensCount":3556,"categories":["plugin-manifest"],"hasMcp":false,"mcpConfig":null,"found":["packages/openapi-fetch/README.md","packages/openapi-fetch/examples/nextjs/README.md","packages/openapi-fetch/examples/sveltekit/README.md","packages/openapi-fetch/examples/vue-3/README.md","packages/openapi-metadata/README.md","packages/openapi-react-query/README.md","packages/openapi-typescript-helpers/README.md","packages/openapi-typescript/README.md","packages/openapi-typescript/examples/README.md","packages/swr-openapi/README.md"],"skills":{"packages/openapi-fetch/README.md":"<img src=\"../../docs/public/assets/openapi-fetch.svg\" alt=\"openapi-fetch\" width=\"216\" height=\"40\" />\n\nopenapi-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.\n\n| Library                    | Size (min) | “GET” request\\*            |\n| :------------------------- | ---------: | :------------------------- |\n| openapi-fetch              |     `6 kB` | `300k` ops/s (fastest)     |\n| openapi-typescript-fetch   |     `3 kB` | `300k` ops/s (fastest)     |\n| feature-fetch              |    `15 kB` | `300k` ops/s (fastest)     |\n| axios                      |    `32 kB` | `225k` ops/s (1.3× slower) |\n| superagent                 |    `55 kB` | `50k` ops/s (6× slower)    |\n| openapi-typescript-codegen |   `367 kB` | `100k` ops/s (3× slower)   |\n\n_\\* [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._\n\nThe 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.\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst {\n  data, // only present if 2XX response\n  error, // only present if 4XX or 5XX response\n} = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"123\" },\n  },\n});\n\nawait client.PUT(\"/blogposts\", {\n  body: {\n    title: \"My New Post\",\n  },\n});\n```\n\n`data` and `error` are typechecked and expose their shapes to Intellisense in VS Code (and any other IDE with TypeScript support). Likewise, the request `body` will also typecheck its fields, erring if any required params are missing, or if there’s a type mismatch.\n\n`GET()`, `PUT()`, `POST()`, etc. are thin wrappers around the native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (which you can [swap for any call](https://openapi-ts.dev/openapi-fetch/api/#create-client)).\n\nNotice there are no generics, and no manual typing. Your endpoint’s request and response were inferred automatically. This is a huge improvement in the type safety of your endpoints because **every manual assertion could lead to a bug**! This eliminates all of the following:\n\n- ✅ No typos in URLs or params\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Also eliminates `as` type overrides that can also hide bugs\n- ✅ All of this in a **6 kb** client package 🎉\n\n## Setup\n\nInstall this library along with [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\n> **Highly recommended**\n>\n> Enable [noUncheckedIndexedAccess](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess) in your `tsconfig.json` ([docs](/advanced#enable-nouncheckedindexaccess-in-your-tsconfigjson))\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\nLastly, be sure to **run typechecking** in your project. This can be done by adding `tsc --noEmit` to your [npm scripts](https://docs.npmjs.com/cli/v9/using-npm/scripts) like so:\n\n```json\n{\n  \"scripts\": {\n    \"test:ts\": \"tsc --noEmit\"\n  }\n}\n```\n\nAnd run `npm run test:ts` in your CI to catch type errors.\n\n> **TIP:**\n>\n> Use `tsc --noEmit` to check for type errors rather than relying on your linter or your build command. Nothing will typecheck as accurately as the TypeScript compiler itself.\n\n## Basic usage\n\nThe best part about using openapi-fetch over oldschool codegen is no documentation needed. openapi-fetch encourages using your existing OpenAPI documentation rather than trying to find what function to import, or what parameters that function wants:\n\n![OpenAPI schema example](../../docs/public/assets/openapi-schema.png)\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst { data, error } = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"my-post\" },\n    query: { version: 2 },\n  },\n});\n\nconst { data, error } = await client.PUT(\"/blogposts\", {\n  body: {\n    title: \"New Post\",\n    body: \"<p>New post body</p>\",\n    publish_date: new Date(\"2023-03-01T12:00:00Z\").getTime(),\n  },\n});\n```\n\n1. The HTTP method is pulled directly from `createClient()`\n2. You pass in your desired `path` to `GET()`, `PUT()`, etc.\n3. TypeScript takes over the rest and returns helpful errors for anything missing or invalid\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-fetch/)\n","packages/openapi-fetch/examples/nextjs/README.md":"# openapi-fetch + Next.js\n\nExample of using openapi-fetch in [Next.js](https://nextjs.org) using server-rendered data.\n\nFor an example of fetching clientside, see the [React Query example](../react-query) which also works in Next.js (React Query is recommended over SWR because of type inference).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:3000`\n","packages/openapi-fetch/examples/sveltekit/README.md":"# openapi-fetch + Svelte/ SvelteKit\n\nExample of using openapi-fetch in [Svelte](https://svelte.dev/docs/svelte/overview) / [SvelteKit](https://svelte.dev/docs/kit/introduction).\n\n- [Svelte or clientside SvelteKit example](./src/routes/+page.svelte)\n- [SveleKit Page Data example](./src/routes/page-data/+page.svelte)\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n","packages/openapi-fetch/examples/vue-3/README.md":"# openapi-fetch + Vue\n\nExample of using openapi-fetch with [Vue](https://vuejs.org/).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n","packages/openapi-metadata/README.md":"# openapi-metadata\n\nopenapi-metadata was an AdonisJS-inspired documentation generator that was deprecated in 2025. This package is no longer maintained, but you can find [an archive in the `openapi-metadata` branch](https://github.com/openapi-ts/openapi-typescript/tree/openapi-metadata/packages/openapi-metadata).\n","packages/openapi-react-query/README.md":"# openapi-react-query\n\nopenapi-react-query is a type-safe tiny wrapper (1 kb) around [@tanstack/react-query](https://tanstack.com/query/latest/docs/framework/react/overview) to work with OpenAPI schema.\n\nIt works by using [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript) so you get all the following features:\n\n- ✅ No typos in URLs or params.\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Eliminates `as` type overrides that can also hide bugs\n\n## Setup\n\nInstall this library along with [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-react-query openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\n## Usage\n\nOnce your types have been generated from your schema, you can create a [fetch client](../openapi-fetch), a react-query client and start querying your API.\n\n```tsx\nimport createFetchClient from \"openapi-fetch\";\nimport createClient from \"openapi-react-query\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst fetchClient = createFetchClient<paths>({\n  baseUrl: \"https://myapi.dev/v1/\",\n});\nconst $api = createClient(fetchClient);\n\nconst MyComponent = () => {\n  const { data, error, isPending } = $api.useQuery(\n    \"get\",\n    \"/blogposts/{post_id}\",\n    {\n      params: {\n        path: { post_id: 5 },\n      },\n    }\n  );\n\n  if (isPending || !data) return \"Loading...\";\n\n  if (error) return `An error occurred: ${error.message}`;\n\n  return <div>{data.title}</div>;\n};\n```\n\n> You can find more information about `createFetchClient` in the [openapi-fetch documentation](../openapi-fetch).\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-react-query/)\n","packages/openapi-typescript-helpers/README.md":"# openapi-typescript-helpers\n\nHelper utilities that power `openapi-fetch` but are generically-available for any project.\n\nThis package isn’t as well-documented as the others, so it’s a bit “use at your own discretion.”\n","packages/openapi-typescript/README.md":"<img src=\"../../docs/public/assets/openapi-ts.svg\" alt=\"openapi-typescript\" width=\"200\" height=\"40\" />\n\nopenapi-typescript turns [OpenAPI 3.0 & 3.1](https://spec.openapis.org/oas/latest.html) schemas into TypeScript quickly using Node.js. No Java/node-gyp/running OpenAPI servers necessary.\n\nThe code is [MIT-licensed](./LICENSE) and free for use.\n\n> **Tip:**\n> New to OpenAPI? Speakeasy’s [Intro to OpenAPI](https://www.speakeasyapi.dev/openapi) is an accessible guide to newcomers that explains the “why” and “how” of OpenAPI.\n\n## Features\n\n- ✅ Supports OpenAPI 3.0 and 3.1 (including advanced features like [discriminators](https://spec.openapis.org/oas/v3.1.0#discriminator-object))\n- ✅ Generate **runtime-free types** that outperform old school codegen\n- ✅ Load schemas from YAML or JSON, locally or remotely\n- ✅ Generate types for even huge schemas within milliseconds\n\n_Note: OpenAPI 2.x is supported with versions `5.x` and previous_\n\n## Examples\n\n👀 [See examples](./examples/)\n\n## Setup\n\nThis library requires the latest version of [Node.js](https://nodejs.org) installed (20.x or higher recommended). With that present, run the following in your project:\n\n```bash\nnpm i -D openapi-typescript typescript\n```\n\nAnd in your `tsconfig.json`, to load the types properly:\n\n```diff\n{\n  \"compilerOptions\": {\n+    \"module\": \"ESNext\", // or \"NodeNext\"\n+    \"moduleResolution\": \"Bundler\" // or \"NodeNext\"\n  }\n}\n```\n\n> **Highly recommended**\n> \n> Also adding the following can boost type safety:\n> ```diff\n> {\n>   \"compilerOptions\": {\n> +    \"noUncheckedIndexedAccess\": true\n>   }\n> }\n> ```\n\n## Basic usage\n\nFirst, generate a local type file by running `npx openapi-typescript`, first specifying your input schema (JSON or YAML), and where you’d like the `--output` (`-o`) to be saved:\n\n```bash\n# Local schema\nnpx openapi-typescript ./path/to/my/schema.yaml -o ./path/to/my/schema.d.ts\n# 🚀 ./path/to/my/schema.yaml -> ./path/to/my/schema.d.ts [7ms]\n\n# Remote schema\nnpx openapi-typescript https://myapi.dev/api/v1/openapi.yaml -o ./path/to/my/schema.d.ts\n# 🚀 https://myapi.dev/api/v1/openapi.yaml -> ./path/to/my/schema.d.ts [250ms]\n```\n\nThen in your TypeScript project, import types where needed:\n\n```ts\nimport type { paths, components } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\n// Schema Obj\ntype MyType = components[\"schemas\"][\"MyType\"];\n\n// Path params\ntype EndpointParams = paths[\"/my/endpoint\"][\"parameters\"];\n\n// Response obj\ntype SuccessResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"][\"schema\"];\ntype ErrorResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][500][\"content\"][\"application/json\"][\"schema\"];\n```\n\nFrom here, you can use these types for any of the following (but not limited to):\n\n- Using an OpenAPI-supported fetch client (like [openapi-fetch](https://openapi-ts.dev/openapi-fetch/))\n- Asserting types for other API requestBodies and responses\n- Building core business logic based on API types\n- Validating mock test data is up-to-date with the current schema\n- Packaging API types into any npm packages you publish (such as client SDKs, etc.)\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/)\n","packages/openapi-typescript/examples/README.md":"# openapi-typescript examples\n\nThese examples show the generation from an OpenAPI schema to its associated types. None of the example schemas here are associated with this project, and all code are © their respective owners.\n\n| Generated Types                   | Source                                                                                                                | License                                                                    |\n| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------- |\n| `digital-ocean-api.ts`            | [GitHub](https://github.com/digitalocean/openapi)                                                                     | [Apache 2.0](https://github.com/digitalocean/openapi/blob/main/LICENSE)    |\n| `github-api.ts`                   | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions/api.github.com)                        | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `github-api-next.ts`              | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions-next/api.github.com)                   | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `octokit-ghes-3.6-diff-to-api.ts` | [GitHub](https://github.com/octokit/octokit-next.js/tree/main/packages/types-openapi-ghes-3.6-diff-to-api.github.com) | [MIT](https://github.com/octokit/octokit-next.js/blob/main/LICENSE)        |\n| `stripe-api.ts`                   | [GitHub](https://github.com/stripe/openapi)                                                                           | [MIT](https://github.com/stripe/openapi/blob/master/LICENSE)               |\n","packages/swr-openapi/README.md":"<p align=\"center\">\n  <h1 align=\"center\">swr-openapi</h1>\n</p>\n\n<div align=\"center\">\n  <h3>This Package Has Moved</h3>\n  <p>\n    <a href=\"https://www.npmjs.com/package/swr-openapi\"><code>swr-openapi</code></a> has moved back to its original repository:\n  </p>\n  <p>\n    <a href=\"https://github.com/htunnicliff/swr-openapi\"><b>⚡️ Repo</b></a> • <a href=\"https://htunnicliff.github.io/swr-openapi/\"><b>📓 Docs</b></a>\n  </p>\n</div>\n"},"files":{"packages/openapi-fetch/README.md":"<img src=\"../../docs/public/assets/openapi-fetch.svg\" alt=\"openapi-fetch\" width=\"216\" height=\"40\" />\n\nopenapi-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.\n\n| Library                    | Size (min) | “GET” request\\*            |\n| :------------------------- | ---------: | :------------------------- |\n| openapi-fetch              |     `6 kB` | `300k` ops/s (fastest)     |\n| openapi-typescript-fetch   |     `3 kB` | `300k` ops/s (fastest)     |\n| feature-fetch              |    `15 kB` | `300k` ops/s (fastest)     |\n| axios                      |    `32 kB` | `225k` ops/s (1.3× slower) |\n| superagent                 |    `55 kB` | `50k` ops/s (6× slower)    |\n| openapi-typescript-codegen |   `367 kB` | `100k` ops/s (3× slower)   |\n\n_\\* [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._\n\nThe 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.\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst {\n  data, // only present if 2XX response\n  error, // only present if 4XX or 5XX response\n} = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"123\" },\n  },\n});\n\nawait client.PUT(\"/blogposts\", {\n  body: {\n    title: \"My New Post\",\n  },\n});\n```\n\n`data` and `error` are typechecked and expose their shapes to Intellisense in VS Code (and any other IDE with TypeScript support). Likewise, the request `body` will also typecheck its fields, erring if any required params are missing, or if there’s a type mismatch.\n\n`GET()`, `PUT()`, `POST()`, etc. are thin wrappers around the native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (which you can [swap for any call](https://openapi-ts.dev/openapi-fetch/api/#create-client)).\n\nNotice there are no generics, and no manual typing. Your endpoint’s request and response were inferred automatically. This is a huge improvement in the type safety of your endpoints because **every manual assertion could lead to a bug**! This eliminates all of the following:\n\n- ✅ No typos in URLs or params\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Also eliminates `as` type overrides that can also hide bugs\n- ✅ All of this in a **6 kb** client package 🎉\n\n## Setup\n\nInstall this library along with [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\n> **Highly recommended**\n>\n> Enable [noUncheckedIndexedAccess](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess) in your `tsconfig.json` ([docs](/advanced#enable-nouncheckedindexaccess-in-your-tsconfigjson))\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\nLastly, be sure to **run typechecking** in your project. This can be done by adding `tsc --noEmit` to your [npm scripts](https://docs.npmjs.com/cli/v9/using-npm/scripts) like so:\n\n```json\n{\n  \"scripts\": {\n    \"test:ts\": \"tsc --noEmit\"\n  }\n}\n```\n\nAnd run `npm run test:ts` in your CI to catch type errors.\n\n> **TIP:**\n>\n> Use `tsc --noEmit` to check for type errors rather than relying on your linter or your build command. Nothing will typecheck as accurately as the TypeScript compiler itself.\n\n## Basic usage\n\nThe best part about using openapi-fetch over oldschool codegen is no documentation needed. openapi-fetch encourages using your existing OpenAPI documentation rather than trying to find what function to import, or what parameters that function wants:\n\n![OpenAPI schema example](../../docs/public/assets/openapi-schema.png)\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst { data, error } = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"my-post\" },\n    query: { version: 2 },\n  },\n});\n\nconst { data, error } = await client.PUT(\"/blogposts\", {\n  body: {\n    title: \"New Post\",\n    body: \"<p>New post body</p>\",\n    publish_date: new Date(\"2023-03-01T12:00:00Z\").getTime(),\n  },\n});\n```\n\n1. The HTTP method is pulled directly from `createClient()`\n2. You pass in your desired `path` to `GET()`, `PUT()`, etc.\n3. TypeScript takes over the rest and returns helpful errors for anything missing or invalid\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-fetch/)\n","packages/openapi-fetch/examples/nextjs/README.md":"# openapi-fetch + Next.js\n\nExample of using openapi-fetch in [Next.js](https://nextjs.org) using server-rendered data.\n\nFor an example of fetching clientside, see the [React Query example](../react-query) which also works in Next.js (React Query is recommended over SWR because of type inference).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:3000`\n","packages/openapi-fetch/examples/sveltekit/README.md":"# openapi-fetch + Svelte/ SvelteKit\n\nExample of using openapi-fetch in [Svelte](https://svelte.dev/docs/svelte/overview) / [SvelteKit](https://svelte.dev/docs/kit/introduction).\n\n- [Svelte or clientside SvelteKit example](./src/routes/+page.svelte)\n- [SveleKit Page Data example](./src/routes/page-data/+page.svelte)\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n","packages/openapi-fetch/examples/vue-3/README.md":"# openapi-fetch + Vue\n\nExample of using openapi-fetch with [Vue](https://vuejs.org/).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n","packages/openapi-metadata/README.md":"# openapi-metadata\n\nopenapi-metadata was an AdonisJS-inspired documentation generator that was deprecated in 2025. This package is no longer maintained, but you can find [an archive in the `openapi-metadata` branch](https://github.com/openapi-ts/openapi-typescript/tree/openapi-metadata/packages/openapi-metadata).\n","packages/openapi-react-query/README.md":"# openapi-react-query\n\nopenapi-react-query is a type-safe tiny wrapper (1 kb) around [@tanstack/react-query](https://tanstack.com/query/latest/docs/framework/react/overview) to work with OpenAPI schema.\n\nIt works by using [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript) so you get all the following features:\n\n- ✅ No typos in URLs or params.\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Eliminates `as` type overrides that can also hide bugs\n\n## Setup\n\nInstall this library along with [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-react-query openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\n## Usage\n\nOnce your types have been generated from your schema, you can create a [fetch client](../openapi-fetch), a react-query client and start querying your API.\n\n```tsx\nimport createFetchClient from \"openapi-fetch\";\nimport createClient from \"openapi-react-query\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst fetchClient = createFetchClient<paths>({\n  baseUrl: \"https://myapi.dev/v1/\",\n});\nconst $api = createClient(fetchClient);\n\nconst MyComponent = () => {\n  const { data, error, isPending } = $api.useQuery(\n    \"get\",\n    \"/blogposts/{post_id}\",\n    {\n      params: {\n        path: { post_id: 5 },\n      },\n    }\n  );\n\n  if (isPending || !data) return \"Loading...\";\n\n  if (error) return `An error occurred: ${error.message}`;\n\n  return <div>{data.title}</div>;\n};\n```\n\n> You can find more information about `createFetchClient` in the [openapi-fetch documentation](../openapi-fetch).\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-react-query/)\n","packages/openapi-typescript-helpers/README.md":"# openapi-typescript-helpers\n\nHelper utilities that power `openapi-fetch` but are generically-available for any project.\n\nThis package isn’t as well-documented as the others, so it’s a bit “use at your own discretion.”\n","packages/openapi-typescript/README.md":"<img src=\"../../docs/public/assets/openapi-ts.svg\" alt=\"openapi-typescript\" width=\"200\" height=\"40\" />\n\nopenapi-typescript turns [OpenAPI 3.0 & 3.1](https://spec.openapis.org/oas/latest.html) schemas into TypeScript quickly using Node.js. No Java/node-gyp/running OpenAPI servers necessary.\n\nThe code is [MIT-licensed](./LICENSE) and free for use.\n\n> **Tip:**\n> New to OpenAPI? Speakeasy’s [Intro to OpenAPI](https://www.speakeasyapi.dev/openapi) is an accessible guide to newcomers that explains the “why” and “how” of OpenAPI.\n\n## Features\n\n- ✅ Supports OpenAPI 3.0 and 3.1 (including advanced features like [discriminators](https://spec.openapis.org/oas/v3.1.0#discriminator-object))\n- ✅ Generate **runtime-free types** that outperform old school codegen\n- ✅ Load schemas from YAML or JSON, locally or remotely\n- ✅ Generate types for even huge schemas within milliseconds\n\n_Note: OpenAPI 2.x is supported with versions `5.x` and previous_\n\n## Examples\n\n👀 [See examples](./examples/)\n\n## Setup\n\nThis library requires the latest version of [Node.js](https://nodejs.org) installed (20.x or higher recommended). With that present, run the following in your project:\n\n```bash\nnpm i -D openapi-typescript typescript\n```\n\nAnd in your `tsconfig.json`, to load the types properly:\n\n```diff\n{\n  \"compilerOptions\": {\n+    \"module\": \"ESNext\", // or \"NodeNext\"\n+    \"moduleResolution\": \"Bundler\" // or \"NodeNext\"\n  }\n}\n```\n\n> **Highly recommended**\n> \n> Also adding the following can boost type safety:\n> ```diff\n> {\n>   \"compilerOptions\": {\n> +    \"noUncheckedIndexedAccess\": true\n>   }\n> }\n> ```\n\n## Basic usage\n\nFirst, generate a local type file by running `npx openapi-typescript`, first specifying your input schema (JSON or YAML), and where you’d like the `--output` (`-o`) to be saved:\n\n```bash\n# Local schema\nnpx openapi-typescript ./path/to/my/schema.yaml -o ./path/to/my/schema.d.ts\n# 🚀 ./path/to/my/schema.yaml -> ./path/to/my/schema.d.ts [7ms]\n\n# Remote schema\nnpx openapi-typescript https://myapi.dev/api/v1/openapi.yaml -o ./path/to/my/schema.d.ts\n# 🚀 https://myapi.dev/api/v1/openapi.yaml -> ./path/to/my/schema.d.ts [250ms]\n```\n\nThen in your TypeScript project, import types where needed:\n\n```ts\nimport type { paths, components } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\n// Schema Obj\ntype MyType = components[\"schemas\"][\"MyType\"];\n\n// Path params\ntype EndpointParams = paths[\"/my/endpoint\"][\"parameters\"];\n\n// Response obj\ntype SuccessResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"][\"schema\"];\ntype ErrorResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][500][\"content\"][\"application/json\"][\"schema\"];\n```\n\nFrom here, you can use these types for any of the following (but not limited to):\n\n- Using an OpenAPI-supported fetch client (like [openapi-fetch](https://openapi-ts.dev/openapi-fetch/))\n- Asserting types for other API requestBodies and responses\n- Building core business logic based on API types\n- Validating mock test data is up-to-date with the current schema\n- Packaging API types into any npm packages you publish (such as client SDKs, etc.)\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/)\n","packages/openapi-typescript/examples/README.md":"# openapi-typescript examples\n\nThese examples show the generation from an OpenAPI schema to its associated types. None of the example schemas here are associated with this project, and all code are © their respective owners.\n\n| Generated Types                   | Source                                                                                                                | License                                                                    |\n| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------- |\n| `digital-ocean-api.ts`            | [GitHub](https://github.com/digitalocean/openapi)                                                                     | [Apache 2.0](https://github.com/digitalocean/openapi/blob/main/LICENSE)    |\n| `github-api.ts`                   | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions/api.github.com)                        | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `github-api-next.ts`              | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions-next/api.github.com)                   | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `octokit-ghes-3.6-diff-to-api.ts` | [GitHub](https://github.com/octokit/octokit-next.js/tree/main/packages/types-openapi-ghes-3.6-diff-to-api.github.com) | [MIT](https://github.com/octokit/octokit-next.js/blob/main/LICENSE)        |\n| `stripe-api.ts`                   | [GitHub](https://github.com/stripe/openapi)                                                                           | [MIT](https://github.com/stripe/openapi/blob/master/LICENSE)               |\n","packages/swr-openapi/README.md":"<p align=\"center\">\n  <h1 align=\"center\">swr-openapi</h1>\n</p>\n\n<div align=\"center\">\n  <h3>This Package Has Moved</h3>\n  <p>\n    <a href=\"https://www.npmjs.com/package/swr-openapi\"><code>swr-openapi</code></a> has moved back to its original repository:\n  </p>\n  <p>\n    <a href=\"https://github.com/htunnicliff/swr-openapi\"><b>⚡️ Repo</b></a> • <a href=\"https://htunnicliff.github.io/swr-openapi/\"><b>📓 Docs</b></a>\n  </p>\n</div>\n"},"items":[{"name":"README.md","path":"packages/openapi-fetch/examples/nextjs/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-fetch/examples/nextjs/README.md","title":"nextjs Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-fetch + Next.js\n\nExample of using openapi-fetch in [Next.js](https://nextjs.org) using server-rendered data.\n\nFor an example of fetching clientside, see the [React Query example](../react-query) which also works in Next.js (React Query is recommended over SWR because of type inference).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:3000`\n","isInternal":false,"tokens":99,"sizeBytes":392},{"name":"README.md","path":"packages/openapi-fetch/examples/sveltekit/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-fetch/examples/sveltekit/README.md","title":"sveltekit Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-fetch + Svelte/ SvelteKit\n\nExample of using openapi-fetch in [Svelte](https://svelte.dev/docs/svelte/overview) / [SvelteKit](https://svelte.dev/docs/kit/introduction).\n\n- [Svelte or clientside SvelteKit example](./src/routes/+page.svelte)\n- [SveleKit Page Data example](./src/routes/page-data/+page.svelte)\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n","isInternal":false,"tokens":121,"sizeBytes":411},{"name":"README.md","path":"packages/openapi-fetch/examples/vue-3/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-fetch/examples/vue-3/README.md","title":"vue-3 Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-fetch + Vue\n\nExample of using openapi-fetch with [Vue](https://vuejs.org/).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n","isInternal":false,"tokens":54,"sizeBytes":180},{"name":"README.md","path":"packages/openapi-fetch/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-fetch/README.md","title":"openapi-fetch Documentation","category":"plugin-manifest","format":"markdown","content":"<img src=\"../../docs/public/assets/openapi-fetch.svg\" alt=\"openapi-fetch\" width=\"216\" height=\"40\" />\n\nopenapi-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.\n\n| Library                    | Size (min) | “GET” request\\*            |\n| :------------------------- | ---------: | :------------------------- |\n| openapi-fetch              |     `6 kB` | `300k` ops/s (fastest)     |\n| openapi-typescript-fetch   |     `3 kB` | `300k` ops/s (fastest)     |\n| feature-fetch              |    `15 kB` | `300k` ops/s (fastest)     |\n| axios                      |    `32 kB` | `225k` ops/s (1.3× slower) |\n| superagent                 |    `55 kB` | `50k` ops/s (6× slower)    |\n| openapi-typescript-codegen |   `367 kB` | `100k` ops/s (3× slower)   |\n\n_\\* [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._\n\nThe 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.\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst {\n  data, // only present if 2XX response\n  error, // only present if 4XX or 5XX response\n} = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"123\" },\n  },\n});\n\nawait client.PUT(\"/blogposts\", {\n  body: {\n    title: \"My New Post\",\n  },\n});\n```\n\n`data` and `error` are typechecked and expose their shapes to Intellisense in VS Code (and any other IDE with TypeScript support). Likewise, the request `body` will also typecheck its fields, erring if any required params are missing, or if there’s a type mismatch.\n\n`GET()`, `PUT()`, `POST()`, etc. are thin wrappers around the native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (which you can [swap for any call](https://openapi-ts.dev/openapi-fetch/api/#create-client)).\n\nNotice there are no generics, and no manual typing. Your endpoint’s request and response were inferred automatically. This is a huge improvement in the type safety of your endpoints because **every manual assertion could lead to a bug**! This eliminates all of the following:\n\n- ✅ No typos in URLs or params\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Also eliminates `as` type overrides that can also hide bugs\n- ✅ All of this in a **6 kb** client package 🎉\n\n## Setup\n\nInstall this library along with [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\n> **Highly recommended**\n>\n> Enable [noUncheckedIndexedAccess](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess) in your `tsconfig.json` ([docs](/advanced#enable-nouncheckedindexaccess-in-your-tsconfigjson))\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\nLastly, be sure to **run typechecking** in your project. This can be done by adding `tsc --noEmit` to your [npm scripts](https://docs.npmjs.com/cli/v9/using-npm/scripts) like so:\n\n```json\n{\n  \"scripts\": {\n    \"test:ts\": \"tsc --noEmit\"\n  }\n}\n```\n\nAnd run `npm run test:ts` in your CI to catch type errors.\n\n> **TIP:**\n>\n> Use `tsc --noEmit` to check for type errors rather than relying on your linter or your build command. Nothing will typecheck as accurately as the TypeScript compiler itself.\n\n## Basic usage\n\nThe best part about using openapi-fetch over oldschool codegen is no documentation needed. openapi-fetch encourages using your existing OpenAPI documentation rather than trying to find what function to import, or what parameters that function wants:\n\n![OpenAPI schema example](../../docs/public/assets/openapi-schema.png)\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst { data, error } = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"my-post\" },\n    query: { version: 2 },\n  },\n});\n\nconst { data, error } = await client.PUT(\"/blogposts\", {\n  body: {\n    title: \"New Post\",\n    body: \"<p>New post body</p>\",\n    publish_date: new Date(\"2023-03-01T12:00:00Z\").getTime(),\n  },\n});\n```\n\n1. The HTTP method is pulled directly from `createClient()`\n2. You pass in your desired `path` to `GET()`, `PUT()`, etc.\n3. TypeScript takes over the rest and returns helpful errors for anything missing or invalid\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-fetch/)\n","isInternal":false,"tokens":1328,"sizeBytes":5111},{"name":"README.md","path":"packages/openapi-metadata/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-metadata/README.md","title":"openapi-metadata Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-metadata\n\nopenapi-metadata was an AdonisJS-inspired documentation generator that was deprecated in 2025. This package is no longer maintained, but you can find [an archive in the `openapi-metadata` branch](https://github.com/openapi-ts/openapi-typescript/tree/openapi-metadata/packages/openapi-metadata).\n","isInternal":false,"tokens":67,"sizeBytes":315},{"name":"README.md","path":"packages/openapi-react-query/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-react-query/README.md","title":"openapi-react-query Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-react-query\n\nopenapi-react-query is a type-safe tiny wrapper (1 kb) around [@tanstack/react-query](https://tanstack.com/query/latest/docs/framework/react/overview) to work with OpenAPI schema.\n\nIt works by using [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript) so you get all the following features:\n\n- ✅ No typos in URLs or params.\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Eliminates `as` type overrides that can also hide bugs\n\n## Setup\n\nInstall this library along with [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-react-query openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\n## Usage\n\nOnce your types have been generated from your schema, you can create a [fetch client](../openapi-fetch), a react-query client and start querying your API.\n\n```tsx\nimport createFetchClient from \"openapi-fetch\";\nimport createClient from \"openapi-react-query\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst fetchClient = createFetchClient<paths>({\n  baseUrl: \"https://myapi.dev/v1/\",\n});\nconst $api = createClient(fetchClient);\n\nconst MyComponent = () => {\n  const { data, error, isPending } = $api.useQuery(\n    \"get\",\n    \"/blogposts/{post_id}\",\n    {\n      params: {\n        path: { post_id: 5 },\n      },\n    }\n  );\n\n  if (isPending || !data) return \"Loading...\";\n\n  if (error) return `An error occurred: ${error.message}`;\n\n  return <div>{data.title}</div>;\n};\n```\n\n> You can find more information about `createFetchClient` in the [openapi-fetch documentation](../openapi-fetch).\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-react-query/)\n","isInternal":false,"tokens":516,"sizeBytes":2012},{"name":"README.md","path":"packages/openapi-typescript-helpers/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-typescript-helpers/README.md","title":"openapi-typescript-helpers Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-typescript-helpers\n\nHelper utilities that power `openapi-fetch` but are generically-available for any project.\n\nThis package isn’t as well-documented as the others, so it’s a bit “use at your own discretion.”\n","isInternal":false,"tokens":50,"sizeBytes":227},{"name":"README.md","path":"packages/openapi-typescript/examples/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-typescript/examples/README.md","title":"examples Documentation","category":"plugin-manifest","format":"markdown","content":"# openapi-typescript examples\n\nThese examples show the generation from an OpenAPI schema to its associated types. None of the example schemas here are associated with this project, and all code are © their respective owners.\n\n| Generated Types                   | Source                                                                                                                | License                                                                    |\n| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------- |\n| `digital-ocean-api.ts`            | [GitHub](https://github.com/digitalocean/openapi)                                                                     | [Apache 2.0](https://github.com/digitalocean/openapi/blob/main/LICENSE)    |\n| `github-api.ts`                   | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions/api.github.com)                        | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `github-api-next.ts`              | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions-next/api.github.com)                   | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `octokit-ghes-3.6-diff-to-api.ts` | [GitHub](https://github.com/octokit/octokit-next.js/tree/main/packages/types-openapi-ghes-3.6-diff-to-api.github.com) | [MIT](https://github.com/octokit/octokit-next.js/blob/main/LICENSE)        |\n| `stripe-api.ts`                   | [GitHub](https://github.com/stripe/openapi)                                                                           | [MIT](https://github.com/stripe/openapi/blob/master/LICENSE)               |\n","isInternal":false,"tokens":323,"sizeBytes":1872},{"name":"README.md","path":"packages/openapi-typescript/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/openapi-typescript/README.md","title":"openapi-typescript Documentation","category":"plugin-manifest","format":"markdown","content":"<img src=\"../../docs/public/assets/openapi-ts.svg\" alt=\"openapi-typescript\" width=\"200\" height=\"40\" />\n\nopenapi-typescript turns [OpenAPI 3.0 & 3.1](https://spec.openapis.org/oas/latest.html) schemas into TypeScript quickly using Node.js. No Java/node-gyp/running OpenAPI servers necessary.\n\nThe code is [MIT-licensed](./LICENSE) and free for use.\n\n> **Tip:**\n> New to OpenAPI? Speakeasy’s [Intro to OpenAPI](https://www.speakeasyapi.dev/openapi) is an accessible guide to newcomers that explains the “why” and “how” of OpenAPI.\n\n## Features\n\n- ✅ Supports OpenAPI 3.0 and 3.1 (including advanced features like [discriminators](https://spec.openapis.org/oas/v3.1.0#discriminator-object))\n- ✅ Generate **runtime-free types** that outperform old school codegen\n- ✅ Load schemas from YAML or JSON, locally or remotely\n- ✅ Generate types for even huge schemas within milliseconds\n\n_Note: OpenAPI 2.x is supported with versions `5.x` and previous_\n\n## Examples\n\n👀 [See examples](./examples/)\n\n## Setup\n\nThis library requires the latest version of [Node.js](https://nodejs.org) installed (20.x or higher recommended). With that present, run the following in your project:\n\n```bash\nnpm i -D openapi-typescript typescript\n```\n\nAnd in your `tsconfig.json`, to load the types properly:\n\n```diff\n{\n  \"compilerOptions\": {\n+    \"module\": \"ESNext\", // or \"NodeNext\"\n+    \"moduleResolution\": \"Bundler\" // or \"NodeNext\"\n  }\n}\n```\n\n> **Highly recommended**\n> \n> Also adding the following can boost type safety:\n> ```diff\n> {\n>   \"compilerOptions\": {\n> +    \"noUncheckedIndexedAccess\": true\n>   }\n> }\n> ```\n\n## Basic usage\n\nFirst, generate a local type file by running `npx openapi-typescript`, first specifying your input schema (JSON or YAML), and where you’d like the `--output` (`-o`) to be saved:\n\n```bash\n# Local schema\nnpx openapi-typescript ./path/to/my/schema.yaml -o ./path/to/my/schema.d.ts\n# 🚀 ./path/to/my/schema.yaml -> ./path/to/my/schema.d.ts [7ms]\n\n# Remote schema\nnpx openapi-typescript https://myapi.dev/api/v1/openapi.yaml -o ./path/to/my/schema.d.ts\n# 🚀 https://myapi.dev/api/v1/openapi.yaml -> ./path/to/my/schema.d.ts [250ms]\n```\n\nThen in your TypeScript project, import types where needed:\n\n```ts\nimport type { paths, components } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\n// Schema Obj\ntype MyType = components[\"schemas\"][\"MyType\"];\n\n// Path params\ntype EndpointParams = paths[\"/my/endpoint\"][\"parameters\"];\n\n// Response obj\ntype SuccessResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"][\"schema\"];\ntype ErrorResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][500][\"content\"][\"application/json\"][\"schema\"];\n```\n\nFrom here, you can use these types for any of the following (but not limited to):\n\n- Using an OpenAPI-supported fetch client (like [openapi-fetch](https://openapi-ts.dev/openapi-fetch/))\n- Asserting types for other API requestBodies and responses\n- Building core business logic based on API types\n- Validating mock test data is up-to-date with the current schema\n- Packaging API types into any npm packages you publish (such as client SDKs, etc.)\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/)\n","isInternal":false,"tokens":838,"sizeBytes":3214},{"name":"README.md","path":"packages/swr-openapi/README.md","rawUrl":"https://raw.githubusercontent.com/openapi-ts/openapi-typescript/HEAD/packages/swr-openapi/README.md","title":"swr-openapi Documentation","category":"plugin-manifest","format":"markdown","content":"<p align=\"center\">\n  <h1 align=\"center\">swr-openapi</h1>\n</p>\n\n<div align=\"center\">\n  <h3>This Package Has Moved</h3>\n  <p>\n    <a href=\"https://www.npmjs.com/package/swr-openapi\"><code>swr-openapi</code></a> has moved back to its original repository:\n  </p>\n  <p>\n    <a href=\"https://github.com/htunnicliff/swr-openapi\"><b>⚡️ Repo</b></a> • <a href=\"https://htunnicliff.github.io/swr-openapi/\"><b>📓 Docs</b></a>\n  </p>\n</div>\n","isInternal":false,"tokens":160,"sizeBytes":437}],"systemPromptSnippet":"<yakaai_skills repo=\"openapi-ts/openapi-typescript\">\n<!-- File: packages/openapi-fetch/examples/nextjs/README.md (Tokens: ~99 | Category: plugin-manifest) -->\n# openapi-fetch + Next.js\n\nExample of using openapi-fetch in [Next.js](https://nextjs.org) using server-rendered data.\n\nFor an example of fetching clientside, see the [React Query example](../react-query) which also works in Next.js (React Query is recommended over SWR because of type inference).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:3000`\n\n<!-- File: packages/openapi-fetch/examples/sveltekit/README.md (Tokens: ~121 | Category: plugin-manifest) -->\n# openapi-fetch + Svelte/ SvelteKit\n\nExample of using openapi-fetch in [Svelte](https://svelte.dev/docs/svelte/overview) / [SvelteKit](https://svelte.dev/docs/kit/introduction).\n\n- [Svelte or clientside SvelteKit example](./src/routes/+page.svelte)\n- [SveleKit Page Data example](./src/routes/page-data/+page.svelte)\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n\n<!-- File: packages/openapi-fetch/examples/vue-3/README.md (Tokens: ~54 | Category: plugin-manifest) -->\n# openapi-fetch + Vue\n\nExample of using openapi-fetch with [Vue](https://vuejs.org/).\n\n## Setup\n\n```sh\npnpm i\npnpm run dev\n```\n\nYou’ll see the server running at `localhost:5173`\n\n<!-- File: packages/openapi-fetch/README.md (Tokens: ~1328 | Category: plugin-manifest) -->\n<img src=\"../../docs/public/assets/openapi-fetch.svg\" alt=\"openapi-fetch\" width=\"216\" height=\"40\" />\n\nopenapi-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.\n\n| Library                    | Size (min) | “GET” request\\*            |\n| :------------------------- | ---------: | :------------------------- |\n| openapi-fetch              |     `6 kB` | `300k` ops/s (fastest)     |\n| openapi-typescript-fetch   |     `3 kB` | `300k` ops/s (fastest)     |\n| feature-fetch              |    `15 kB` | `300k` ops/s (fastest)     |\n| axios                      |    `32 kB` | `225k` ops/s (1.3× slower) |\n| superagent                 |    `55 kB` | `50k` ops/s (6× slower)    |\n| openapi-typescript-codegen |   `367 kB` | `100k` ops/s (3× slower)   |\n\n_\\* [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._\n\nThe 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.\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst {\n  data, // only present if 2XX response\n  error, // only present if 4XX or 5XX response\n} = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"123\" },\n  },\n});\n\nawait client.PUT(\"/blogposts\", {\n  body: {\n    title: \"My New Post\",\n  },\n});\n```\n\n`data` and `error` are typechecked and expose their shapes to Intellisense in VS Code (and any other IDE with TypeScript support). Likewise, the request `body` will also typecheck its fields, erring if any required params are missing, or if there’s a type mismatch.\n\n`GET()`, `PUT()`, `POST()`, etc. are thin wrappers around the native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (which you can [swap for any call](https://openapi-ts.dev/openapi-fetch/api/#create-client)).\n\nNotice there are no generics, and no manual typing. Your endpoint’s request and response were inferred automatically. This is a huge improvement in the type safety of your endpoints because **every manual assertion could lead to a bug**! This eliminates all of the following:\n\n- ✅ No typos in URLs or params\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Also eliminates `as` type overrides that can also hide bugs\n- ✅ All of this in a **6 kb** client package 🎉\n\n## Setup\n\nInstall this library along with [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\n> **Highly recommended**\n>\n> Enable [noUncheckedIndexedAccess](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess) in your `tsconfig.json` ([docs](/advanced#enable-nouncheckedindexaccess-in-your-tsconfigjson))\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\nLastly, be sure to **run typechecking** in your project. This can be done by adding `tsc --noEmit` to your [npm scripts](https://docs.npmjs.com/cli/v9/using-npm/scripts) like so:\n\n```json\n{\n  \"scripts\": {\n    \"test:ts\": \"tsc --noEmit\"\n  }\n}\n```\n\nAnd run `npm run test:ts` in your CI to catch type errors.\n\n> **TIP:**\n>\n> Use `tsc --noEmit` to check for type errors rather than relying on your linter or your build command. Nothing will typecheck as accurately as the TypeScript compiler itself.\n\n## Basic usage\n\nThe best part about using openapi-fetch over oldschool codegen is no documentation needed. openapi-fetch encourages using your existing OpenAPI documentation rather than trying to find what function to import, or what parameters that function wants:\n\n![OpenAPI schema example](../../docs/public/assets/openapi-schema.png)\n\n```ts\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst client = createClient<paths>({ baseUrl: \"https://myapi.dev/v1/\" });\n\nconst { data, error } = await client.GET(\"/blogposts/{post_id}\", {\n  params: {\n    path: { post_id: \"my-post\" },\n    query: { version: 2 },\n  },\n});\n\nconst { data, error } = await client.PUT(\"/blogposts\", {\n  body: {\n    title: \"New Post\",\n    body: \"<p>New post body</p>\",\n    publish_date: new Date(\"2023-03-01T12:00:00Z\").getTime(),\n  },\n});\n```\n\n1. The HTTP method is pulled directly from `createClient()`\n2. You pass in your desired `path` to `GET()`, `PUT()`, etc.\n3. TypeScript takes over the rest and returns helpful errors for anything missing or invalid\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-fetch/)\n\n<!-- File: packages/openapi-metadata/README.md (Tokens: ~67 | Category: plugin-manifest) -->\n# openapi-metadata\n\nopenapi-metadata was an AdonisJS-inspired documentation generator that was deprecated in 2025. This package is no longer maintained, but you can find [an archive in the `openapi-metadata` branch](https://github.com/openapi-ts/openapi-typescript/tree/openapi-metadata/packages/openapi-metadata).\n\n<!-- File: packages/openapi-react-query/README.md (Tokens: ~516 | Category: plugin-manifest) -->\n# openapi-react-query\n\nopenapi-react-query is a type-safe tiny wrapper (1 kb) around [@tanstack/react-query](https://tanstack.com/query/latest/docs/framework/react/overview) to work with OpenAPI schema.\n\nIt works by using [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript) so you get all the following features:\n\n- ✅ No typos in URLs or params.\n- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema\n- ✅ No manual typing of your API\n- ✅ Eliminates `any` types that hide bugs\n- ✅ Eliminates `as` type overrides that can also hide bugs\n\n## Setup\n\nInstall this library along with [openapi-fetch](../openapi-fetch) and [openapi-typescript](../openapi-typescript):\n\n```bash\nnpm i openapi-react-query openapi-fetch\nnpm i -D openapi-typescript typescript\n```\n\nNext, generate TypeScript types from your OpenAPI schema using openapi-typescript:\n\n```bash\nnpx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts\n```\n\n## Usage\n\nOnce your types have been generated from your schema, you can create a [fetch client](../openapi-fetch), a react-query client and start querying your API.\n\n```tsx\nimport createFetchClient from \"openapi-fetch\";\nimport createClient from \"openapi-react-query\";\nimport type { paths } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\nconst fetchClient = createFetchClient<paths>({\n  baseUrl: \"https://myapi.dev/v1/\",\n});\nconst $api = createClient(fetchClient);\n\nconst MyComponent = () => {\n  const { data, error, isPending } = $api.useQuery(\n    \"get\",\n    \"/blogposts/{post_id}\",\n    {\n      params: {\n        path: { post_id: 5 },\n      },\n    }\n  );\n\n  if (isPending || !data) return \"Loading...\";\n\n  if (error) return `An error occurred: ${error.message}`;\n\n  return <div>{data.title}</div>;\n};\n```\n\n> You can find more information about `createFetchClient` in the [openapi-fetch documentation](../openapi-fetch).\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/openapi-react-query/)\n\n<!-- File: packages/openapi-typescript-helpers/README.md (Tokens: ~50 | Category: plugin-manifest) -->\n# openapi-typescript-helpers\n\nHelper utilities that power `openapi-fetch` but are generically-available for any project.\n\nThis package isn’t as well-documented as the others, so it’s a bit “use at your own discretion.”\n\n<!-- File: packages/openapi-typescript/examples/README.md (Tokens: ~323 | Category: plugin-manifest) -->\n# openapi-typescript examples\n\nThese examples show the generation from an OpenAPI schema to its associated types. None of the example schemas here are associated with this project, and all code are © their respective owners.\n\n| Generated Types                   | Source                                                                                                                | License                                                                    |\n| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------- |\n| `digital-ocean-api.ts`            | [GitHub](https://github.com/digitalocean/openapi)                                                                     | [Apache 2.0](https://github.com/digitalocean/openapi/blob/main/LICENSE)    |\n| `github-api.ts`                   | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions/api.github.com)                        | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `github-api-next.ts`              | [GitHub](https://github.com/github/rest-api-description/tree/main/descriptions-next/api.github.com)                   | [MIT](https://github.com/github/rest-api-description/blob/main/LICENSE.md) |\n| `octokit-ghes-3.6-diff-to-api.ts` | [GitHub](https://github.com/octokit/octokit-next.js/tree/main/packages/types-openapi-ghes-3.6-diff-to-api.github.com) | [MIT](https://github.com/octokit/octokit-next.js/blob/main/LICENSE)        |\n| `stripe-api.ts`                   | [GitHub](https://github.com/stripe/openapi)                                                                           | [MIT](https://github.com/stripe/openapi/blob/master/LICENSE)               |\n\n<!-- File: packages/openapi-typescript/README.md (Tokens: ~838 | Category: plugin-manifest) -->\n<img src=\"../../docs/public/assets/openapi-ts.svg\" alt=\"openapi-typescript\" width=\"200\" height=\"40\" />\n\nopenapi-typescript turns [OpenAPI 3.0 & 3.1](https://spec.openapis.org/oas/latest.html) schemas into TypeScript quickly using Node.js. No Java/node-gyp/running OpenAPI servers necessary.\n\nThe code is [MIT-licensed](./LICENSE) and free for use.\n\n> **Tip:**\n> New to OpenAPI? Speakeasy’s [Intro to OpenAPI](https://www.speakeasyapi.dev/openapi) is an accessible guide to newcomers that explains the “why” and “how” of OpenAPI.\n\n## Features\n\n- ✅ Supports OpenAPI 3.0 and 3.1 (including advanced features like [discriminators](https://spec.openapis.org/oas/v3.1.0#discriminator-object))\n- ✅ Generate **runtime-free types** that outperform old school codegen\n- ✅ Load schemas from YAML or JSON, locally or remotely\n- ✅ Generate types for even huge schemas within milliseconds\n\n_Note: OpenAPI 2.x is supported with versions `5.x` and previous_\n\n## Examples\n\n👀 [See examples](./examples/)\n\n## Setup\n\nThis library requires the latest version of [Node.js](https://nodejs.org) installed (20.x or higher recommended). With that present, run the following in your project:\n\n```bash\nnpm i -D openapi-typescript typescript\n```\n\nAnd in your `tsconfig.json`, to load the types properly:\n\n```diff\n{\n  \"compilerOptions\": {\n+    \"module\": \"ESNext\", // or \"NodeNext\"\n+    \"moduleResolution\": \"Bundler\" // or \"NodeNext\"\n  }\n}\n```\n\n> **Highly recommended**\n> \n> Also adding the following can boost type safety:\n> ```diff\n> {\n>   \"compilerOptions\": {\n> +    \"noUncheckedIndexedAccess\": true\n>   }\n> }\n> ```\n\n## Basic usage\n\nFirst, generate a local type file by running `npx openapi-typescript`, first specifying your input schema (JSON or YAML), and where you’d like the `--output` (`-o`) to be saved:\n\n```bash\n# Local schema\nnpx openapi-typescript ./path/to/my/schema.yaml -o ./path/to/my/schema.d.ts\n# 🚀 ./path/to/my/schema.yaml -> ./path/to/my/schema.d.ts [7ms]\n\n# Remote schema\nnpx openapi-typescript https://myapi.dev/api/v1/openapi.yaml -o ./path/to/my/schema.d.ts\n# 🚀 https://myapi.dev/api/v1/openapi.yaml -> ./path/to/my/schema.d.ts [250ms]\n```\n\nThen in your TypeScript project, import types where needed:\n\n```ts\nimport type { paths, components } from \"./my-openapi-3-schema\"; // generated by openapi-typescript\n\n// Schema Obj\ntype MyType = components[\"schemas\"][\"MyType\"];\n\n// Path params\ntype EndpointParams = paths[\"/my/endpoint\"][\"parameters\"];\n\n// Response obj\ntype SuccessResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"][\"schema\"];\ntype ErrorResponse =\n  paths[\"/my/endpoint\"][\"get\"][\"responses\"][500][\"content\"][\"application/json\"][\"schema\"];\n```\n\nFrom here, you can use these types for any of the following (but not limited to):\n\n- Using an OpenAPI-supported fetch client (like [openapi-fetch](https://openapi-ts.dev/openapi-fetch/))\n- Asserting types for other API requestBodies and responses\n- Building core business logic based on API types\n- Validating mock test data is up-to-date with the current schema\n- Packaging API types into any npm packages you publish (such as client SDKs, etc.)\n\n## 📓 Docs\n\n[View Docs](https://openapi-ts.dev/)\n\n<!-- File: packages/swr-openapi/README.md (Tokens: ~160 | Category: plugin-manifest) -->\n<p align=\"center\">\n  <h1 align=\"center\">swr-openapi</h1>\n</p>\n\n<div align=\"center\">\n  <h3>This Package Has Moved</h3>\n  <p>\n    <a href=\"https://www.npmjs.com/package/swr-openapi\"><code>swr-openapi</code></a> has moved back to its original repository:\n  </p>\n  <p>\n    <a href=\"https://github.com/htunnicliff/swr-openapi\"><b>⚡️ Repo</b></a> • <a href=\"https://htunnicliff.github.io/swr-openapi/\"><b>📓 Docs</b></a>\n  </p>\n</div>\n</yakaai_skills>"}