diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 61dac952f0..28dea3cfb5 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -69,7 +69,6 @@ npx @hey-api/openapi-ts --help ### Build Issues and Workarounds -- **Docs build may fail** due to pnpm version mismatch in VitePress - this is expected in some environments - Use `pnpm build --filter="@hey-api/**"` to build packages without docs - **Some tests may fail** in sandboxed environments due to network restrictions (OpenAPI spec downloads) - **Generated test files** in `packages/openapi-ts-tests/` contain auto-generated snapshots that may have linting warnings - this is expected diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index a2f081fbb2..efe004e51f 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -26,5 +26,5 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add ./CONTRIBUTORS.md - git diff --cached --quiet || git commit -m "chore(docs): update contributors list" + git diff --cached --quiet || git commit -m "chore: update contributors list" git push diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e4f58f2549..98261e5234 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -5,10 +5,10 @@ on: branches: - main paths-ignore: - - docs/** + - web/** pull_request: paths-ignore: - - docs/** + - web/** concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 611a71c914..cc4a8c457b 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -13,8 +13,6 @@ "**/.nuxt/", "**/.output/", "**/.svelte-kit/", - "**/.vitepress/cache", - "**/.vitepress/dist", "**/.angular", "**/web/.astro/", "**/web/.cache/", diff --git a/.prettierignore b/.prettierignore index 675c401267..8ca2ada907 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,8 +6,6 @@ **/.nuxt **/.output **/.svelte-kit -**/.vitepress/cache -**/.vitepress/dist **/test/generated **/__snapshots__ diff --git a/.vercelignore b/.vercelignore index 3de83df245..de9095133e 100644 --- a/.vercelignore +++ b/.vercelignore @@ -1,6 +1,5 @@ /* !CONTRIBUTORS.md -!patches !web !.npmrc !.nvmrc diff --git a/.vscode/settings.json b/.vscode/settings.json index 3d742a2be6..fdaa2d80d8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,6 @@ "**/*.map": true, "**/*.mjs": true, "**/*.mts": true, - "**/.vitepress/dist": true, "**/dist": true, "**/.mypy_cache": true, "**/__snapshots__": true, diff --git a/CLAUDE.md b/CLAUDE.md index 7ecc28cb84..eaec770f1c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -60,10 +60,10 @@ packages/ config-vite-base/ # Shared Vite base configuration openapi-ts-tests/ # Test utilities and snapshots examples/ # 16+ framework-specific examples -docs/ # VitePress documentation site dev/ # Development environment (CLI testing configs) specs/ # OpenAPI test specifications scripts/ # Build and test scripts +web/ # Astro website ``` ## Tooling @@ -117,6 +117,5 @@ Some linting warnings in `.gen/snapshots/` directories are expected for generate ## Known Issues -- Docs build may fail due to pnpm version mismatch in VitePress - use `--filter="@hey-api/**"` to skip - Some tests may fail in sandboxed environments due to network restrictions (OpenAPI spec downloads) - Generated test files in `packages/openapi-ts-tests/` may have expected linting warnings diff --git a/docs/.contributorssince b/docs/.contributorssince deleted file mode 100644 index 6706bfca11..0000000000 --- a/docs/.contributorssince +++ /dev/null @@ -1 +0,0 @@ -2025-04-20T08:08:34Z diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index b73303468e..0000000000 --- a/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vitepress/cache -.vitepress/dist diff --git a/docs/.vitepress/config/en.ts b/docs/.vitepress/config/en.ts deleted file mode 100644 index 082568cf51..0000000000 --- a/docs/.vitepress/config/en.ts +++ /dev/null @@ -1,350 +0,0 @@ -import { defineConfig } from 'vitepress'; - -export default defineConfig({ - description: - '๐ŸŒ€ OpenAPI to TypeScript codegen. Production-grade SDKs, Zod schemas, TanStack Query hooks, and 20+ plugins. Used by Vercel, OpenCode, and PayPal.', - lang: 'en-US', - themeConfig: { - editLink: { - pattern: 'https://github.com/hey-api/openapi-ts/edit/main/docs/:path', - text: 'Edit', - }, - footer: { - message: 'Released under the MIT License.', - }, - nav: [ - { - link: 'https://github.com/sponsors/hey-api', - text: 'Sponsor Hey API', - }, - ], - outline: { - label: 'Table of Contents', - level: 2, - }, - sidebar: [ - { - items: [ - { - link: '/openapi-ts/get-started', - text: 'Get Started', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/configuration/input', - text: 'Input', - }, - { - link: '/openapi-ts/configuration/output', - text: 'Output', - }, - { - link: '/openapi-ts/configuration/parser', - text: 'Parser', - }, - { - link: '/openapi-ts/configuration/vite', - text: 'Vite', - }, - ], - link: '/openapi-ts/configuration', - text: 'Configuration', - }, - { - link: '/openapi-ts/output', - text: 'Output', - }, - ], - text: 'Introduction', - }, - { - items: [ - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/typescript', - text: 'TypeScript', - }, - { - link: '/openapi-ts/plugins/sdk', - text: 'SDK', - }, - { - link: '/openapi-ts/plugins/transformers', - text: 'Transformers', - }, - { - link: '/openapi-ts/plugins/schemas', - text: 'Schemas', - }, - ], - link: '/openapi-ts/core', - text: 'Core', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/clients/fetch', - text: 'Fetch API', - }, - { - link: '/openapi-ts/clients/angular', - text: 'Angular', - }, - { - link: '/openapi-ts/clients/axios', - text: 'Axios', - }, - { - link: '/openapi-ts/clients/ky', - text: 'Ky', - }, - { - link: '/openapi-ts/clients/next-js', - text: 'Next.js', - }, - { - link: '/openapi-ts/clients/nuxt', - text: 'Nuxt', - }, - { - link: '/openapi-ts/clients/ofetch', - text: 'OFetch', - }, - { - link: '/openapi-ts/clients/effect', - text: 'Effect vote', - }, - { - link: '/openapi-ts/clients/got', - text: 'Got vote', - }, - ], - link: '/openapi-ts/clients', - text: 'Clients', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/valibot', - text: 'Valibot', - }, - { - link: '/openapi-ts/plugins/zod', - text: 'Zod', - }, - { - link: '/openapi-ts/plugins/ajv', - text: 'Ajv vote', - }, - { - link: '/openapi-ts/plugins/arktype', - text: 'Arktype vote', - }, - { - link: '/openapi-ts/plugins/joi', - text: 'Joi vote', - }, - { - link: '/openapi-ts/plugins/superstruct', - text: 'Superstruct vote', - }, - { - link: '/openapi-ts/plugins/typebox', - text: 'TypeBox vote', - }, - { - link: '/openapi-ts/plugins/yup', - text: 'Yup vote', - }, - ], - link: '/openapi-ts/validators', - text: 'Validators', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/pinia-colada', - text: 'Pinia Colada', - }, - { - link: '/openapi-ts/plugins/tanstack-query', - text: 'TanStack Query', - }, - { - link: '/openapi-ts/plugins/swr', - text: 'SWR vote', - }, - { - link: '/openapi-ts/plugins/zustand', - text: 'Zustand vote', - }, - ], - link: '/openapi-ts/state-management', - text: 'State Management', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/chance', - text: 'Chance vote', - }, - { - link: '/openapi-ts/plugins/faker', - text: 'Faker vote', - }, - { - link: '/openapi-ts/plugins/falso', - text: 'Falso vote', - }, - { - link: '/openapi-ts/plugins/msw', - text: 'MSW vote', - }, - { - link: '/openapi-ts/plugins/nock', - text: 'Nock vote', - }, - { - link: '/openapi-ts/plugins/supertest', - text: 'Supertest vote', - }, - ], - link: '/openapi-ts/mocks', - text: 'Mocks', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/angular', - text: 'Angular', - }, - { - link: '/openapi-ts/plugins/fastify', - text: 'Fastify', - }, - { - link: '/openapi-ts/plugins/nest', - text: 'Nest', - }, - { - link: '/openapi-ts/plugins/orpc', - text: 'oRPC', - }, - { - link: '/openapi-ts/plugins/adonis', - text: 'Adonis vote', - }, - { - link: '/openapi-ts/plugins/elysia', - text: 'Elysia vote', - }, - { - link: '/openapi-ts/plugins/express', - text: 'Express vote', - }, - { - link: '/openapi-ts/plugins/hono', - text: 'Hono vote', - }, - { - link: '/openapi-ts/plugins/koa', - text: 'Koa vote', - }, - ], - link: '/openapi-ts/web-frameworks', - text: 'Web Frameworks', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/concepts/resolvers', - text: 'Resolvers', - }, - ], - text: 'Concepts', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/plugins/custom', - text: 'Plugin', - }, - { - link: '/openapi-ts/clients/custom', - text: 'Client', - }, - ], - text: 'Custom', - }, - ], - text: 'Plugins', - }, - { - items: [ - { - link: '/openapi-ts/community/spotlight', - text: 'Spotlight', - }, - { - collapsed: true, - items: [ - { - link: '/openapi-ts/community/contributing/building', - text: 'Building', - }, - { - link: '/openapi-ts/community/contributing/developing', - text: 'Developing', - }, - { - link: '/openapi-ts/community/contributing/testing', - text: 'Testing', - }, - ], - link: '/openapi-ts/community/contributing', - text: 'Contributing', - }, - ], - text: 'Community', - }, - { - items: [ - { - link: '/openapi-ts/integrations', - text: 'GitHub', - }, - ], - text: 'Integrations', - }, - { - items: [ - { - link: '/openapi-ts/migrating', - text: 'Migrating', - }, - { - link: '/openapi-ts/license', - text: 'License', - }, - { - link: 'https://github.com/orgs/hey-api/discussions/3159', - text: 'Roadmap', - }, - ], - text: '@hey-api/openapi-ts', - }, - ], - }, - title: 'Hey API', -}); diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts deleted file mode 100644 index 000275a7e0..0000000000 --- a/docs/.vitepress/config/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { defineConfig } from 'vitepress'; - -import en from './en.js'; -import shared from './shared.js'; - -export default defineConfig({ - ...shared, - locales: { - ...shared.locales, - root: { label: 'English', ...en }, - }, -}); diff --git a/docs/.vitepress/config/scripts/optimize-images.ts b/docs/.vitepress/config/scripts/optimize-images.ts deleted file mode 100644 index 86b78c2f68..0000000000 --- a/docs/.vitepress/config/scripts/optimize-images.ts +++ /dev/null @@ -1,150 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; - -import type { FormatEnum } from 'sharp'; -import sharp from 'sharp'; - -const allowedImageExtensions = ['.png', '.jpg', '.jpeg', '.webp', '.svg'] as const; -const images: ReadonlyArray<{ - formats?: ReadonlyArray; - sizes: ReadonlyArray<{ - formats: ReadonlyArray; - width: number; - }>; - source: string; -}> = [ - { - sizes: [ - { - formats: ['png'], - width: 300, - }, - { - formats: ['png'], - width: 640, - }, - { - formats: ['png'], - width: 920, - }, - ], - source: 'hero.png', - }, - { - sizes: [ - { - formats: ['jpeg', 'webp'], - width: 480, - }, - { - formats: ['webp'], - width: 768, - }, - { - formats: ['png', 'webp'], - width: 1200, - }, - ], - source: 'kinde-logo-wordmark.png', - }, - { - sizes: [ - { - formats: ['jpeg', 'webp'], - width: 480, - }, - { - formats: ['webp'], - width: 768, - }, - { - formats: ['png', 'webp'], - width: 1200, - }, - ], - source: 'kinde-logo-wordmark-dark.png', - }, - { - sizes: [ - { - formats: ['png'], - width: 300, - }, - ], - source: 'logo-astronaut.png', - }, - { - sizes: [ - { - formats: ['png'], - width: 300, - }, - { - formats: ['png'], - width: 640, - }, - { - formats: ['png'], - width: 1280, - }, - ], - source: 'openapi-ts-hero.png', - }, - { - sizes: [ - { - formats: ['jpeg', 'webp'], - width: 480, - }, - { - formats: ['webp'], - width: 768, - }, - { - formats: ['png', 'webp'], - width: 1200, - }, - ], - source: 'stainless-logo-wordmark.png', - }, -]; - -const outputDir = 'public/assets/.gen'; - -if (fs.existsSync(outputDir)) { - fs.rmSync(outputDir, { force: true, recursive: true }); -} - -fs.mkdirSync(outputDir, { recursive: true }); - -export async function processImages() { - for (const image of images) { - const inputPath = path.join('public', 'assets', 'raw', image.source); - const ext = path.extname(image.source).toLowerCase(); - const name = path.basename(image.source, ext); - - if (!allowedImageExtensions.includes(ext as (typeof allowedImageExtensions)[number])) { - continue; - } - - for (const imageSize of image.sizes) { - const size = typeof imageSize === 'object' ? imageSize.width : imageSize; - const formats = - typeof imageSize === 'object' ? imageSize.formats || image.formats : image.formats; - for (const format of formats) { - const outputFileName = `${name}-${size}w.${format}`; - const outputPath = path.join(outputDir, outputFileName); - - let image = sharp(inputPath).resize(size).toFormat(format, { - quality: 80, - }); - - if (format === 'jpeg') { - image = image.flatten({ background: '#ffffff' }); - } - - await image.toFile(outputPath); - } - } - } -} diff --git a/docs/.vitepress/config/shared.ts b/docs/.vitepress/config/shared.ts deleted file mode 100644 index 30a5fb18f2..0000000000 --- a/docs/.vitepress/config/shared.ts +++ /dev/null @@ -1,150 +0,0 @@ -import path from 'node:path'; - -import { defineConfig, type HeadConfig } from 'vitepress'; -import llmstxt from 'vitepress-plugin-llms'; - -import { processImages } from './scripts/optimize-images.js'; - -const domain = process.env.SITE_DOMAIN || 'http://localhost:5173'; - -export default defineConfig({ - cleanUrls: true, - head: [ - [ - 'link', - { - href: '/assets/icons/dark.svg', - media: '(prefers-color-scheme: dark)', - rel: 'icon', - sizes: '16x16', - type: 'image/svg', - }, - ], - [ - 'link', - { - href: '/assets/icons/light.svg', - media: '(prefers-color-scheme: light)', - rel: 'icon', - sizes: '16x16', - type: 'image/svg', - }, - ], - process.env.NODE_ENV === 'production' && [ - 'script', - { - 'data-website-id': '4dffba2d-03a6-4358-9d90-229038c8575d', - defer: '', - src: 'https://cloud.umami.is/script.js', - }, - ], - ].filter(Boolean) as Array, - lastUpdated: true, - sitemap: { - hostname: domain, - lastmodDateOnly: true, - // filter out everything but index and `openapi-ts` pages - transformItems: (items) => - items.filter((item) => !item.url || item.url.startsWith('openapi-ts')), - }, - themeConfig: { - externalLinkIcon: true, - logo: { - alt: 'Hey API logo', - dark: '/assets/icons/dark.svg', - light: '/assets/icons/light.svg', - }, - search: { - options: { - apiKey: '2565c35b4ad91c2f8f8ae32cf9bbe899', - appId: 'OWEH2O8E50', - disableUserPersonalization: false, - indexName: 'openapi-ts docs', - insights: true, - }, - provider: 'algolia', - }, - socialLinks: [ - { icon: 'linkedin', link: 'https://linkedin.com/company/heyapi' }, - { icon: 'bluesky', link: 'https://bsky.app/profile/heyapi.dev' }, - { icon: 'x', link: 'https://x.com/mrlubos' }, - { icon: 'github', link: 'https://github.com/hey-api/openapi-ts' }, - ], - }, - transformPageData: (pageData, context) => { - pageData.frontmatter.head ??= []; - - const canonicalUrl = pageData.relativePath - .replace(/index\.md$/, '') - .replace(/\.md$/, context.siteConfig.cleanUrls ? '' : '.html'); - const url = `${domain}/${canonicalUrl}`; - - const head: Array = pageData.frontmatter.head; - head.unshift( - ['link', { href: url, rel: 'canonical' }], - ['meta', { content: 'website', property: 'og:type' }], - ['meta', { content: 'en_US', property: 'og:locale' }], - ['meta', { content: 'Hey API', property: 'og:site_name' }], - [ - 'meta', - { - content: `${domain}/assets/.gen/openapi-ts-hero-640w.png`, - property: 'og:image', - }, - ], - ['meta', { content: url, property: 'og:url' }], - [ - 'meta', - { - content: - pageData.frontmatter.description || - '๐ŸŒ€ OpenAPI to TypeScript codegen. Production-grade SDKs, Zod schemas, TanStack Query hooks, and 20+ plugins. Used by Vercel, OpenCode, and PayPal.', - property: 'og:description', - }, - ], - [ - 'meta', - { - content: pageData.frontmatter.title || 'OpenAPI TypeScript', - property: 'og:title', - }, - ], - ); - }, - vite: { - plugins: [ - { - async buildStart() { - try { - await processImages(); - } catch (error) { - console.error('โŒ Error optimizing images:', error); - } - }, - name: 'generate-images', - }, - llmstxt({ - experimental: { - depth: 2, - }, - }), - ], - resolve: { - alias: [ - { - find: '@components', - replacement: path.resolve(__dirname, '..', 'theme', 'components'), - }, - { - find: '@data', - replacement: path.resolve(__dirname, '..', '..', 'data'), - }, - { - find: '@versions', - replacement: path.resolve(__dirname, '..', 'theme', 'versions'), - }, - ], - preserveSymlinks: true, - }, - }, -}); diff --git a/docs/.vitepress/theme/components/AuthorsList.vue b/docs/.vitepress/theme/components/AuthorsList.vue deleted file mode 100644 index a041306396..0000000000 --- a/docs/.vitepress/theme/components/AuthorsList.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/docs/.vitepress/theme/components/Examples.vue b/docs/.vitepress/theme/components/Examples.vue deleted file mode 100644 index add4e2f422..0000000000 --- a/docs/.vitepress/theme/components/Examples.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/docs/.vitepress/theme/components/FeatureStatus.vue b/docs/.vitepress/theme/components/FeatureStatus.vue deleted file mode 100644 index baadd752b5..0000000000 --- a/docs/.vitepress/theme/components/FeatureStatus.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/docs/.vitepress/theme/components/Heading.vue b/docs/.vitepress/theme/components/Heading.vue deleted file mode 100644 index 8df15ac602..0000000000 --- a/docs/.vitepress/theme/components/Heading.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/docs/.vitepress/theme/components/Layout.vue b/docs/.vitepress/theme/components/Layout.vue deleted file mode 100644 index 942341beb5..0000000000 --- a/docs/.vitepress/theme/components/Layout.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - diff --git a/docs/.vitepress/theme/components/VersionLabel.vue b/docs/.vitepress/theme/components/VersionLabel.vue deleted file mode 100644 index 540915465f..0000000000 --- a/docs/.vitepress/theme/components/VersionLabel.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - - - diff --git a/docs/.vitepress/theme/components/VersionSwitcher.vue b/docs/.vitepress/theme/components/VersionSwitcher.vue deleted file mode 100644 index 84b90f333d..0000000000 --- a/docs/.vitepress/theme/components/VersionSwitcher.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css deleted file mode 100644 index a214d4d8c7..0000000000 --- a/docs/.vitepress/theme/custom.css +++ /dev/null @@ -1,471 +0,0 @@ -:root { - --c-gradient-start: #d486b8; - --vp-c-brand-1: #a37ab4; - --vp-c-brand-2: #d486b8; - --vp-c-brand-3: #a37ab4; - - --github-mark-fill-color: #24292f; - --vp-home-hero-name-color: transparent; - --vp-home-hero-name-background: -webkit-linear-gradient( - 120deg, - var(--c-gradient-start) 30%, - var(--vp-c-brand-3) - ); -} - -html.dark { - --c-gradient-start: #86b9b0; - --vp-c-bg: #001b2e; - --vp-c-bg-alt: #041421; - --vp-c-bg-soft: #041421; - --vp-c-brand-1: #b3cde4; - --vp-c-brand-2: #b3cde4; - --vp-c-brand-3: #537692; - - --github-mark-fill-color: #fff; - --vp-home-hero-image-background-image: linear-gradient( - -45deg, - var(--vp-c-brand-3) 50%, - var(--c-gradient-start) 50% - ); - --vp-home-hero-image-filter: blur(144px); -} - -html.mac { - --vs-background-color: var(--vp-input-switch-bg-color); - --vs-border: 1px solid var(--vp-input-border-color); - --vs-menu-border: 1px solid var(--vp-input-border-color); - --vs-menu-box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; - --vs-option-background-color: var(--vp-sidebar-bg-color); - --vs-option-disabled-background-color: var(--vp-sidebar-bg-color); - --vs-option-focused-background-color: var(--vp-sidebar-bg-color); - --vs-option-focused-text-color: var(--vp-c-brand-1); - --vs-option-hover-background-color: var(--vp-sidebar-bg-color); - --vs-option-hover-text-color: var(--vp-c-brand-1); - --vs-option-selected-background-color: var(--vp-sidebar-bg-color); - --vs-option-selected-text-color: var(--vp-c-brand-1); - --vs-option-text-color: var(--vp-c-text-2); - --vs-padding-x: 8px; - --vs-padding-y: 4px; - --vs-padding: var(--vs-padding-y) var(--vs-padding-x); - --vs-text-color: var(--vp-c-text-1); - --vs-width: auto; -} - -[data-badge] { - background-color: var(--vp-button-brand-bg); - border-radius: 1em; - color: var(--vp-button-brand-text); - font-size: 0.6em; - padding: 0.05em 0.4em 0.2em; - position: relative; - text-transform: lowercase; - top: -1em; -} - -iframe { - background-color: var(--vp-sidebar-bg-color); - border: none; - margin: 0; -} - -.VPFeatures.VPHomeFeatures > .container { - max-width: initial; -} - -.VPFeatures.VPHomeFeatures > .container > .items { - gap: 1rem; - justify-content: center; - margin: 0; - padding: 0.2rem 0; -} - -.VPFeatures.VPHomeFeatures > .container > .items > .item { - flex-shrink: 0; - max-width: 390px; - padding: 0; - width: 100%; -} - -.authors-list { - display: flex; - flex-wrap: wrap; - font-size: 1rem; - gap: 1em; - padding: 0 !important; -} - -.authors-list img { - border-radius: 50%; - display: block; - height: 2rem; - width: 2rem; -} - -.authors-list a { - align-items: center; - border: 1px solid transparent; - border-radius: 10px; - display: flex; - column-gap: 0.4em; - padding: 0.4em 0.6em; - text-decoration: none; - transition: border-color ease-out 300ms; -} - -.authors-list h3 { - color: var(--vp-c-text-1); - font-size: inherit; - margin: 0; -} - -.authors-list a::after { - display: none !important; -} - -.authors-list li { - margin: 0 !important; -} - -h3#demo + iframe, -h3#demo + button { - margin: 1rem 0 0; -} - -.buttonLink { - color: var(--vp-c-brand-1); - font-size: 16px; - font-weight: 500; - text-decoration: underline; - text-underline-offset: 2px; - transition: - color 0.25s, - opacity 0.25s; -} - -.buttonLink:hover { - color: var(--vp-c-brand-2); -} - -.home-list { - text-align: center; -} - -.authors-list li, -.home-list li, -.sponsors-list li { - list-style: none; -} - -.home-list.sponsors-list > ul { - justify-content: center; -} - -.home-list > ul { - align-items: center; - justify-content: center; -} - -.home-list > ul, -.sponsors-list > ul { - display: flex; - flex-direction: column; - flex-wrap: wrap; - padding: 0; -} - -.home-list > ul:not(:last-child), -.sponsors-list > ul:not(:last-child) { - padding-bottom: 1rem; -} - -.home-list > h3 { - color: var(--vp-c-text-2); - display: inline-block; - font-size: 0.9rem; - margin-top: 2rem; - text-transform: uppercase; -} - -.sponsors-list li { - align-items: center; - border: 1px solid transparent; - border-radius: 10px; - display: flex; - flex-direction: column; - row-gap: 0.5rem; - justify-content: center; - max-width: 240px; - padding: 1rem; - transition: border-color ease-out 300ms; - width: 100%; -} - -.sponsors-list li a:first-of-type { - height: 66px; -} - -.sponsors-list li a:first-of-type picture, -.sponsors-list li a:first-of-type img { - height: 100%; -} - -.sponsors-list li p { - margin: 0; - font-size: 0.86rem; - line-height: 120%; -} - -.sponsors-list li a:last-of-type { - font-size: 0.86rem; - line-height: 100%; -} - -.sponsors-list > ul.gold { - row-gap: 2rem; - column-gap: 3rem; -} - -.sponsors-list > ul.gold li { - max-width: 240px; -} - -.sponsors-list > ul.silver { - row-gap: 2rem; - column-gap: 3rem; -} - -.sponsors-list > ul.silver li { - max-width: 180px; -} - -.sponsors-list > ul li svg { - color: var(--vp-c-text-1) !important; - height: 100% !important; -} - -/* Cella */ -html.dark .sponsors-list > ul li.cella svg > path:nth-child(2), -html.dark .sponsors-list > ul li.cella svg > path:nth-child(3) { - filter: invert(); -} -/* FastAPI */ -.sponsors-list > ul li.fastapi svg > g > path { - fill: white !important; -} -html.dark .sponsors-list > ul li.fastapi svg > g > path { - fill: var(--vp-button-brand-bg) !important; -} -/* OpenStatus */ -.sponsors-list > ul li.openstatus svg > g > g > path:not(:first-of-type) { - fill: white !important; -} -html.dark .sponsors-list > ul li.openstatus svg > g > g > path:not(:first-of-type) { - fill: var(--vp-button-brand-bg) !important; -} - -.sponsors-list > ul.bronze { - row-gap: 2rem; - column-gap: 1rem; -} - -.sponsors-list > ul.bronze li { - max-width: 100px; -} - -.sponsors-list > ul.friends { - row-gap: 2rem; - column-gap: 1rem; -} - -.sponsors-list > ul.friends li { - max-width: 70px; -} - -.sponsors-list li + li { - margin-top: 0; -} - -.sponsors-list li > a { - align-items: center; - display: flex; - justify-content: center; - text-decoration: none; - width: 100%; -} - -html.dark .authors-list li > a, -html.dark .sponsors-list li { - background-color: var(--vp-button-brand-bg); -} - -.sponsors-list li > :is(.vp-doc a[href*='://'], .vp-doc a[target='_blank'])::after { - display: none; -} - -.vp-doc img { - margin: 0; -} - -.authors-list li > a:hover, -.authors-list li > a:focus, -.sponsors-list li:has(> a:hover), -.sponsors-list li:has(> a:focus) { - border-color: var(--vp-c-brand-1); -} - -/* .sponsors-list-new currently unused, keep in case we want to reuse it again */ -.sponsors-list-new > a { - border: 1px solid currentColor; - color: var(--vp-c-text-2); - text-transform: lowercase; -} - -.migration { - background-color: var(--vp-c-brand-3); - border-radius: 10px; - border: 1px solid transparent; - color: var(--vp-button-brand-text); - column-gap: 3rem; - display: flex; - flex-direction: column; - justify-content: space-between; - margin: 0 auto 1rem; - max-width: 392px; - padding: 1rem; - row-gap: 1rem; - transition: border-color ease-out 250ms; - width: auto; -} - -a.migration:hover, -a.migration:focus { - border-color: var(--vp-c-brand-1); -} - -.contributors-list ul { - margin-bottom: 1.3rem; - margin-top: 1.3rem; -} - -.vue-select .control { - cursor: pointer; - transition: border-color 0.25s; -} - -.vue-select .control:hover { - border-color: var(--vp-c-brand-1); -} - -.vue-select .control .indicators-container { - padding: 0; -} - -.vue-select .control .value-container.has-value:has(.single-value) { - padding-inline-end: 0; -} - -.vue-select .control .indicators-container button.dropdown-icon { - height: 100%; - padding: var(--vs-padding); - width: calc(var(--vs-indicator-icon-size) + var(--vs-padding-x) + var(--vs-padding-x)); -} - -.vue-select .menu { - width: fit-content !important; -} - -.vue-select .menu .menu-option { - border-left: 2px solid transparent; - border-right: 2px solid transparent; - white-space: nowrap; - transition: - background-color 0.25s, - border-color 0.25s, - color 0.25s, - opacity 0.25s; -} - -.vue-select .menu:hover .menu-option.focused:not(:hover) { - border-left: 2px solid transparent; -} - -.vue-select .menu .menu-option:hover, -.vue-select .menu:not(:hover) .menu-option.focused { - border-left: 2px solid var(--vp-c-brand-1); -} - -@media (min-width: 640px) { - h1.heading .name { - max-width: 600px; - } - - .VPFeatures.VPHomeFeatures > .container > .items { - gap: 1rem; - padding: 0.4rem 0; - } - - .home-list > ul, - .sponsors-list > ul { - flex-direction: row; - } - - .contributors-list ul { - columns: 2; - } -} - -@media (min-width: 892px) { - .migration { - flex-direction: row; - max-width: 798px; - } -} - -@media (min-width: 960px) { - .VPFeatures.VPHomeFeatures > .container > .items { - gap: 1rem; - padding: 0.5rem 0; - } - - .VPNavBar.has-sidebar > .wrapper > .container > .title { - background-color: var(--vp-sidebar-bg-color); - } -} - -footer.VPDocFooter > .edit-info > .last-updated { - /* don't render last updated date */ - display: none; -} - -.DocSearch-Modal { - display: flex; -} - -.DocSearch-Footer { - position: initial; -} - -.sr-only { - border: 0; - clip: rect(0, 0, 0, 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - white-space: nowrap; - width: 1px; -} - -.VPNavBarTitle a.title { - column-gap: 4px; -} - -.VPImage.logo { - margin-right: 0; -} - -.VPNavBarTitle { - color: var(--vp-c-text-1); -} diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts deleted file mode 100644 index cbf7d3177f..0000000000 --- a/docs/.vitepress/theme/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -// eslint-disable-next-line simple-import-sort/imports -import type { Theme } from 'vitepress'; -import DefaultTheme from 'vitepress/theme'; - -// custom CSS must be imported after default theme to correctly apply styles -import './custom.css'; - -import Layout from './components/Layout.vue'; - -export default { - Layout, - enhanceApp: () => {}, - extends: DefaultTheme, -} satisfies Theme; diff --git a/docs/.vitepress/theme/versions/AngularVersionSwitcher.vue b/docs/.vitepress/theme/versions/AngularVersionSwitcher.vue deleted file mode 100644 index 28f9d7fe8c..0000000000 --- a/docs/.vitepress/theme/versions/AngularVersionSwitcher.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/docs/.vitepress/theme/versions/ZodVersionSwitcher.vue b/docs/.vitepress/theme/versions/ZodVersionSwitcher.vue deleted file mode 100644 index 1b6b0ede2e..0000000000 --- a/docs/.vitepress/theme/versions/ZodVersionSwitcher.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md deleted file mode 100644 index d405290494..0000000000 --- a/docs/CHANGELOG.md +++ /dev/null @@ -1,418 +0,0 @@ -# docs - -## 0.10.4 - -### Patch Changes - -- docs: add bigint section to transformers ([#2865](https://github.com/hey-api/openapi-ts/pull/2865)) ([`ba4d9bf`](https://github.com/hey-api/openapi-ts/commit/ba4d9bf603d8c897016fd1775d13e184111ace17)) by [@wn-mitch](https://github.com/wn-mitch) - -## 0.10.3 - -### Patch Changes - -- chore: clarify TanStack Query reactivity in Vue ([#2745](https://github.com/hey-api/openapi-ts/pull/2745)) ([`5d06dbd`](https://github.com/hey-api/openapi-ts/commit/5d06dbdf8c2a834ecefdd7305b59572470f45a7e)) by [@9M6](https://github.com/9M6) - -## 0.10.2 - -### Patch Changes - -- [#2117](https://github.com/hey-api/openapi-ts/pull/2117) [`a1435b9`](https://github.com/hey-api/openapi-ts/commit/a1435b915a272d9ffa599c194ee52c2a33f77fcd) Thanks [@johnny-mh](https://github.com/johnny-mh)! - docs: add docs for `input.patch` feature - -## 0.10.1 - -### Patch Changes - -- [#1774](https://github.com/hey-api/openapi-ts/pull/1774) [`c0b36b9`](https://github.com/hey-api/openapi-ts/commit/c0b36b95645d484034c3af145c5554867568979b) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: announce Hey API platform - -## 0.10.0 - -### Minor Changes - -- [#1568](https://github.com/hey-api/openapi-ts/pull/1568) [`465410c`](https://github.com/hey-api/openapi-ts/commit/465410c201eb19e737e3143ad53a146e95f80107) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: change the default parser - -## 0.9.0 - -### Minor Changes - -- [#1511](https://github.com/hey-api/openapi-ts/pull/1511) [`4e8064d`](https://github.com/hey-api/openapi-ts/commit/4e8064d9a589e14b42d2b1a329e2436f242884da) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: add watch mode - - ## Watch Mode - - ::: warning - Watch mode currently supports only remote files via URL. - ::: - - If your schema changes frequently, you may want to automatically regenerate the output during development. To watch your input file for changes, enable `watch` mode in your configuration or pass the `--watch` flag to the CLI. - - ### Config - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - watch: true, - }; - ``` - - ### CLI - - ```sh - npx @hey-api/openapi-ts \ - -c @hey-api/client-fetch \ - -i path/to/openapi.json \ - -o src/client \ - -w - ``` - -### Patch Changes - -- [#1496](https://github.com/hey-api/openapi-ts/pull/1496) [`1e418ba`](https://github.com/hey-api/openapi-ts/commit/1e418ba760b9903326ec37009651c32e195e24a9) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: split output section into multiple pages - -## 0.8.0 - -### Minor Changes - -- [#1447](https://github.com/hey-api/openapi-ts/pull/1447) [`200821b`](https://github.com/hey-api/openapi-ts/commit/200821b3ceea8ffca7656fe3f6e2ef98b7110a2a) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: revert license to MIT - -### Patch Changes - -- [#1430](https://github.com/hey-api/openapi-ts/pull/1430) [`9cec9e8`](https://github.com/hey-api/openapi-ts/commit/9cec9e8582c12a8c041b922d9587e16f6f19782a) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add validators page - -## 0.7.4 - -### Patch Changes - -- [#1420](https://github.com/hey-api/openapi-ts/pull/1420) [`8010dbb`](https://github.com/hey-api/openapi-ts/commit/8010dbb1ab8b91d1d49d5cf16276183764a63ff3) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add buildUrl() method to Axios client page - -## 0.7.3 - -### Patch Changes - -- [#1316](https://github.com/hey-api/openapi-ts/pull/1316) [`a79fac8`](https://github.com/hey-api/openapi-ts/commit/a79fac8919ed29eec7195cbd441ffa38b559d63c) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add Plugins page - -## 0.7.2 - -### Patch Changes - -- [#1253](https://github.com/hey-api/openapi-ts/pull/1253) [`01dee3d`](https://github.com/hey-api/openapi-ts/commit/01dee3df879232939e43355231147b3d910fb482) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update sponsorship links - -## 0.7.1 - -### Patch Changes - -- [#1222](https://github.com/hey-api/openapi-ts/pull/1222) [`ceb4363`](https://github.com/hey-api/openapi-ts/commit/ceb4363d52893ebe947e21aac402b868ff2820d4) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: add support for @tanstack/angular-query-experimental package - -## 0.7.0 - -### Minor Changes - -- [#1201](https://github.com/hey-api/openapi-ts/pull/1201) [`972a93a`](https://github.com/hey-api/openapi-ts/commit/972a93a91a945cc9ead73c08bb0fa9ee120433ba) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: make plugins first-class citizens - - This release makes plugins first-class citizens. In order to achieve that, the following breaking changes were introduced. - - ### Removed CLI options - - The `--types`, `--schemas`, and `--services` CLI options have been removed. You can list which plugins you'd like to use explicitly by passing a list of plugins as `--plugins ` - - ### Removed `*.export` option - - Previously, you could explicitly disable export of certain artifacts using the `*.export` option or its shorthand variant. These were both removed. You can now disable export of specific artifacts by manually defining an array of `plugins` and excluding the unwanted plugin. - - ::: code-group - - ```js [shorthand] - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - schemas: false, // [!code --] - plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++] - }; - ``` - - ```js [*.export] - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - schemas: { - export: false, // [!code --] - }, - plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++] - }; - ``` - - ::: - - ### Renamed `schemas.name` option - - Each plugin definition contains a `name` field. This was conflicting with the `schemas.name` option. As a result, it has been renamed to `nameBuilder`. - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - schemas: { - name: (name) => `${name}Schema`, // [!code --] - }, - plugins: [ - // ...other plugins - { - nameBuilder: (name) => `${name}Schema`, // [!code ++] - name: '@hey-api/schemas', - }, - ], - }; - ``` - - ### Removed `services.include` shorthand option - - Previously, you could use a string value as a shorthand for the `services.include` configuration option. You can now achieve the same result using the `include` option. - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - services: '^MySchema', // [!code --] - plugins: [ - // ...other plugins - { - include: '^MySchema', // [!code ++] - name: '@hey-api/services', - }, - ], - }; - ``` - - ### Renamed `services.name` option - - Each plugin definition contains a `name` field. This was conflicting with the `services.name` option. As a result, it has been renamed to `serviceNameBuilder`. - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - services: { - name: '{{name}}Service', // [!code --] - }, - plugins: [ - // ...other plugins - { - serviceNameBuilder: '{{name}}Service', // [!code ++] - name: '@hey-api/services', - }, - ], - }; - ``` - - ### Renamed `types.dates` option - - Previously, you could set `types.dates` to a boolean or a string value, depending on whether you wanted to transform only type strings into dates, or runtime code too. Many people found these options confusing, so they have been simplified to a boolean and extracted into a separate `@hey-api/transformers` plugin. - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - types: { - dates: 'types+transform', // [!code --] - }, - plugins: [ - // ...other plugins - { - dates: true, // [!code ++] - name: '@hey-api/transformers', - }, - ], - }; - ``` - - ### Removed `types.include` shorthand option - - Previously, you could use a string value as a shorthand for the `types.include` configuration option. You can now achieve the same result using the `include` option. - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - types: '^MySchema', // [!code --] - plugins: [ - // ...other plugins - { - include: '^MySchema', // [!code ++] - name: '@hey-api/types', - }, - ], - }; - ``` - - ### Renamed `types.name` option - - Each plugin definition contains a `name` field. This was conflicting with the `types.name` option. As a result, it has been renamed to `style`. - - ```js - export default { - client: '@hey-api/client-fetch', - input: 'path/to/openapi.json', - output: 'src/client', - types: { - name: 'PascalCase', // [!code --] - }, - plugins: [ - // ...other plugins - { - name: '@hey-api/types', - style: 'PascalCase', // [!code ++] - }, - ], - }; - ``` - -## 0.6.2 - -### Patch Changes - -- [#1162](https://github.com/hey-api/openapi-ts/pull/1162) [`1c85c24`](https://github.com/hey-api/openapi-ts/commit/1c85c24af514e9781aab1960298caa28effef5d3) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add Zod plugin page - -## 0.6.1 - -### Patch Changes - -- [#1151](https://github.com/hey-api/openapi-ts/pull/1151) [`587791d`](https://github.com/hey-api/openapi-ts/commit/587791dfede0167fbed229281467e4c4875936f5) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update website domain, add license documentation - -## 0.6.0 - -### Minor Changes - -- [#1009](https://github.com/hey-api/openapi-ts/pull/1009) [`c6b044d`](https://github.com/hey-api/openapi-ts/commit/c6b044d0bc9dc54cb0eb58d23438f4e1d050cb38) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: change schemas name pattern, add schemas.name option - -## 0.5.11 - -### Patch Changes - -- [#978](https://github.com/hey-api/openapi-ts/pull/978) [`2e051a5`](https://github.com/hey-api/openapi-ts/commit/2e051a596302c2e103dca25951a07b4aae1e9e23) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add basic TanStack Query plugin description - -## 0.5.10 - -### Patch Changes - -- [#830](https://github.com/hey-api/openapi-ts/pull/830) [`babf11a`](https://github.com/hey-api/openapi-ts/commit/babf11ae082af642ac71cfee9c523cc976132a50) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: split clients documentation into separate pages - -- [#830](https://github.com/hey-api/openapi-ts/pull/830) [`323d0a0`](https://github.com/hey-api/openapi-ts/commit/323d0a03c6560f27d0ce5eee1708ee16dc395532) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: remove interceptors page in favour of per-client sections - -- [#830](https://github.com/hey-api/openapi-ts/pull/830) [`babf11a`](https://github.com/hey-api/openapi-ts/commit/babf11ae082af642ac71cfee9c523cc976132a50) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add v0.52.0 migration - -## 0.5.9 - -### Patch Changes - -- [#828](https://github.com/hey-api/openapi-ts/pull/828) [`82a4696`](https://github.com/hey-api/openapi-ts/commit/82a4696b0b209ea2d9147f47f213479e61aed3d7) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: add migration guide for v0.51.0 - -## 0.5.8 - -### Patch Changes - -- [#613](https://github.com/hey-api/openapi-ts/pull/613) [`b3786dc`](https://github.com/hey-api/openapi-ts/commit/b3786dc6749d8d4ae26bb63322e124663f881741) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add Axios client documentation - -## 0.5.7 - -### Patch Changes - -- [#632](https://github.com/hey-api/openapi-ts/pull/632) [`9c16bc7`](https://github.com/hey-api/openapi-ts/commit/9c16bc71cde48c0cb700b7e720a9e2ad56ec5f02) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: add output page - -## 0.5.6 - -### Patch Changes - -- docs: add fetch client documentation ([#602](https://github.com/hey-api/openapi-ts/pull/602)) - -- docs: add migration notes for v0.46.0 ([#602](https://github.com/hey-api/openapi-ts/pull/602)) - -## 0.5.5 - -### Patch Changes - -- docs: add migration for v0.45.0 ([#569](https://github.com/hey-api/openapi-ts/pull/569)) - -## 0.5.4 - -### Patch Changes - -- docs: add format and lint migration for 0.44.0 ([#546](https://github.com/hey-api/openapi-ts/pull/546)) - -## 0.5.3 - -### Patch Changes - -- docs: add links to homepage ([#489](https://github.com/hey-api/openapi-ts/pull/489)) - -- feat: remove enum postfix, use typescript enums in types when generated, export enums from types.gen.ts ([#498](https://github.com/hey-api/openapi-ts/pull/498)) - -- docs: add examples ([#476](https://github.com/hey-api/openapi-ts/pull/476)) - -## 0.5.2 - -### Patch Changes - -- docs: add github action to integrations ([#451](https://github.com/hey-api/openapi-ts/pull/451)) - -## 0.5.1 - -### Patch Changes - -- docs: add tanstack-query and http clients sections ([#436](https://github.com/hey-api/openapi-ts/pull/436)) - -## 0.5.0 - -### Minor Changes - -- feat: allow choosing naming convention for types ([#402](https://github.com/hey-api/openapi-ts/pull/402)) - -## 0.4.0 - -### Minor Changes - -- docs: add integrations ([#394](https://github.com/hey-api/openapi-ts/pull/394)) - -- feat: rename generated files ([#363](https://github.com/hey-api/openapi-ts/pull/363)) - -### Patch Changes - -- docs: add enums migration ([#358](https://github.com/hey-api/openapi-ts/pull/358)) - -## 0.3.0 - -### Minor Changes - -- fix: rename write to dryRun and invert value ([#326](https://github.com/hey-api/openapi-ts/pull/326)) - -### Patch Changes - -- docs: update contributing guidelines ([#347](https://github.com/hey-api/openapi-ts/pull/347)) - -## 0.2.2 - -### Patch Changes - -- docs: add migration notes ([#306](https://github.com/hey-api/openapi-ts/pull/306)) - -## 0.2.1 - -### Patch Changes - -- fix(config): rename exportSchemas to schemas ([#288](https://github.com/hey-api/openapi-ts/pull/288)) - -## 0.2.0 - -### Minor Changes - -- docs: add support for localization of docs ([#251](https://github.com/hey-api/openapi-ts/pull/251)) - -### Patch Changes - -- docs: add logo ([#250](https://github.com/hey-api/openapi-ts/pull/250)) diff --git a/docs/data/coreTeam.js b/docs/data/coreTeam.js deleted file mode 100644 index 5103c3cc2e..0000000000 --- a/docs/data/coreTeam.js +++ /dev/null @@ -1,8 +0,0 @@ -export const coreTeam = [ - { - avatar: 'https://github.com/mrlubos.png', - links: [{ icon: 'github', link: 'https://github.com/mrlubos' }], - name: 'Lubos', - title: 'Hey API', - }, -]; diff --git a/docs/data/hallOfFame.js b/docs/data/hallOfFame.js deleted file mode 100644 index c080c8f70f..0000000000 --- a/docs/data/hallOfFame.js +++ /dev/null @@ -1,20 +0,0 @@ -export const hallOfFame = [ - { - avatar: 'https://github.com/ferdikoomen.png', - links: [{ icon: 'github', link: 'https://github.com/ferdikoomen' }], - name: 'Ferdi Koomen', - title: 'OpenAPI TypeScript Codegen', - }, - { - avatar: 'https://github.com/nicolas-chaulet.png', - links: [{ icon: 'github', link: 'https://github.com/nicolas-chaulet' }], - name: 'Nicolas Chaulet', - title: 'Made the Hey API fork', - }, - { - avatar: 'https://github.com/jordanshatford.png', - links: [{ icon: 'github', link: 'https://github.com/jordanshatford' }], - name: 'Jordan Shatford', - title: 'Maintainer and Contributor', - }, -]; diff --git a/docs/data/people.ts b/docs/data/people.ts deleted file mode 100644 index 2d8e4b266a..0000000000 --- a/docs/data/people.ts +++ /dev/null @@ -1,44 +0,0 @@ -type Person = { - github: string; - name: string; -}; - -export const dmitriyBrolnickij: Person = { - github: 'https://github.com/brolnickij', - name: 'Dmitriy Brolnickij', -}; - -export const jacobCohen: Person = { - github: 'https://github.com/jacobinu', - name: 'Jacob Cohen', -}; - -export const joshHemphill: Person = { - github: 'https://github.com/josh-hemphill', - name: 'Josh Hemphill', -}; - -export const malcolmKee: Person = { - github: 'https://github.com/malcolm-kee', - name: 'Malcolm Kee', -}; - -export const maxScopp: Person = { - github: 'https://github.com/max-scopp', - name: 'Max Scopp', -}; - -export const sebastiaanWouters: Person = { - github: 'https://github.com/SebastiaanWouters', - name: 'Sebastiaan Wouters', -}; - -export const stephenZhou: Person = { - github: 'https://github.com/hyoban', - name: 'Stephen Zhou', -}; - -export const yuriMikhin: Person = { - github: 'https://github.com/mikhin', - name: 'Yuri Mikhin', -}; diff --git a/docs/email-form.md b/docs/email-form.md deleted file mode 100644 index 6e3f3ed520..0000000000 --- a/docs/email-form.md +++ /dev/null @@ -1,607 +0,0 @@ -
- -### Newsletter - -
-
-
    -
    -
    - -
    - -
    -
    -
    - -Subscribe to product updates. - -
    - - diff --git a/docs/embed.ts b/docs/embed.ts deleted file mode 100644 index 00855dfa89..0000000000 --- a/docs/embed.ts +++ /dev/null @@ -1,56 +0,0 @@ -import sdk from '@stackblitz/sdk'; - -// https://api.npmjs.org/versions/@hey-api%2Fopenapi-ts/last-week - -export const embedProject = (projectId: string) => async (event: Event) => { - const container = document.createElement('div'); - - if (event.target) { - const node = event.target as HTMLElement; - node.replaceWith(container); - } - - switch (projectId) { - case 'hey-api-client-axios-example': - return await sdk.embedProjectId(container, projectId, { - height: 700, - openFile: - 'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/sdk.gen.ts,src/client/types.gen.ts,src/App.tsx', - view: 'editor', - }); - case 'hey-api-client-fetch-example': - return await sdk.embedProjectId(container, projectId, { - height: 700, - openFile: - 'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/sdk.gen.ts,src/client/types.gen.ts,src/App.tsx', - view: 'editor', - }); - case 'hey-api-client-fetch-plugin-fastify-example': - return await sdk.embedProjectId(container, projectId, { - height: 700, - openFile: - 'openapi-ts.config.ts,src/client/fastify.gen.ts,src/client/types.gen.ts,src/server.ts', - view: 'editor', - }); - case 'hey-api-client-fetch-plugin-tanstack-react-query-example': - return await sdk.embedProjectId(container, projectId, { - height: 700, - openFile: - 'openapi-ts.config.ts,src/client/@tanstack/react-query.gen.ts,src/client/types.gen.ts,src/App.tsx', - view: 'editor', - }); - case 'hey-api-client-fetch-plugin-zod-example': - return await sdk.embedProjectId(container, projectId, { - height: 700, - openFile: 'openapi-ts.config.ts,src/client/zod.gen.ts,src/App.tsx', - view: 'editor', - }); - case 'hey-api-example': - return await sdk.embedProjectId(container, projectId, { - height: 700, - openFile: - 'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/sdk.gen.ts,src/client/types.gen.ts', - view: 'editor', - }); - } -}; diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index bc61a58709..0000000000 --- a/docs/index.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -layout: home - -hero: - name: OpenAPI to TypeScript in seconds. - tagline: Generate production-grade SDKs and validators from your OpenAPI spec. Used by Vercel, OpenCode, and PayPal. - actions: - - link: /openapi-ts/get-started - text: Get Started - theme: brand - - link: https://stackblitz.com/edit/hey-api-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fsdk.gen.ts,src%2Fclient%2Ftypes.gen.ts - text: View Demo - theme: alt - - link: https://github.com/orgs/hey-api/discussions/3159 - text: Roadmap - theme: alt - image: - alt: Two people looking at the TypeScript logo - src: /assets/.gen/hero-920w.png - -features: - - icon: - title: OpenAPI to TypeScript - details: Generate production-grade TypeScript from any OpenAPI specification. - link: /openapi-ts/get-started - linkText: Get started - - icon: - title: Instant SDKs - details: Highly customizable SDKs and types with sensible defaults that compile out of the box. - link: /openapi-ts/output - linkText: See output - - icon: - title: HTTP Clients - details: Pluggable HTTP clients for Fetch API, Angular, Axios, Next.js, Nuxt, and more. - link: /openapi-ts/clients - linkText: Explore clients - - icon: - title: Plugin Ecosystem - details: Zod, TanStack Query, and 20+ plugins to reduce third-party boilerplate. - link: /openapi-ts/core - linkText: Explore plugins - - icon: ๐Ÿงฉ - title: Custom Extensions - details: Build custom plugins for proprietary or advanced use cases. - link: /openapi-ts/plugins/custom - linkText: Build a custom plugin - - icon: - title: Integrations - details: Sync specs, automate workflows, and integrate with the Hey API Platform. - link: /openapi-ts/integrations - linkText: Learn about integrations ---- - -
    - -
    - -### Sponsors - -
    - - - -
    - - diff --git a/docs/openapi-ts/clients.md b/docs/openapi-ts/clients.md deleted file mode 100644 index aff2c98d25..0000000000 --- a/docs/openapi-ts/clients.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Clients -description: HTTP clients for Hey API. Compatible with all our features. ---- - - - -# HTTP Clients - -We all send HTTP requests in a slightly different way. Hey API doesn't force you to use any specific technology. What we do, however, is support your choice with great clients. All seamlessly integrated with our other features. - -## Features - -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Options - -Hey API natively supports the following clients. - -- [Fetch API](/openapi-ts/clients/fetch) -- [Angular](/openapi-ts/clients/angular) -- [Axios](/openapi-ts/clients/axios) -- [Ky](/openapi-ts/clients/ky) -- [Next.js](/openapi-ts/clients/next-js) -- [Nuxt](/openapi-ts/clients/nuxt) -- [OFetch](/openapi-ts/clients/ofetch) -- [Effect](/openapi-ts/clients/effect) vote -- [Got](/openapi-ts/clients/got) vote - -Don't see your client? [Build your own](/openapi-ts/clients/custom) or let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues). - - - diff --git a/docs/openapi-ts/clients/angular.md b/docs/openapi-ts/clients/angular.md deleted file mode 100644 index a9bdacfd54..0000000000 --- a/docs/openapi-ts/clients/angular.md +++ /dev/null @@ -1,257 +0,0 @@ ---- -title: Angular v20 Client -description: Generate a type-safe Angular v20 client from OpenAPI with the Angular client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Angular v20

    - -
    - -::: warning -Angular client is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Angular](https://angular.dev/) is a web framework that empowers developers to build fast, reliable applications. - -The Angular client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Collaborators - - - -## Features - -- Angular v20 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- support for [`@Injectable()`](https://angular.dev/api/core/Injectable) decorators -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-angular` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-angular'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-angular # [!code ++] -``` - -::: - -### Providers - -You can use the Angular client in your application by adding `provideHeyApiClient` to your providers. - -```ts -import { provideHeyApiClient, client } from './client/client.gen'; - -export const appConfig: ApplicationConfig = { - providers: [ - provideHttpClient(withFetch()), - provideHeyApiClient(client), // [!code ++] - ], -}; -``` - -## Configuration - -The Angular client is built as a thin wrapper on top of Angular, extending its functionality to work with Hey API. If you're already familiar with Angular, configuring your client will feel like working directly with Angular. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any `HttpRequest` configuration option to `setConfig()`, and even your own [`httpClient`](#custom-instance) implementation. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-angular', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseUrl: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseUrl: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseUrl: 'https://example.com', // <-- override default configuration -}); -``` - -## `@Injectable` - -If you prefer to use the [`@Injectable()`](https://angular.dev/api/core/Injectable) decorators, set the `asClass` option in your SDK plugin to `true`. - -::: code-group - -```ts [example] -@Injectable({ providedIn: 'root' }) -export class FooService { - // class methods -} -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - '@hey-api/client-angular', - { - name: '@hey-api/sdk', - asClass: true, // [!code ++] - }, - ], -}; -``` - -::: - -## Interceptors - -::: warning -This section is under construction. We appreciate your patience. -::: - -## Auth - -::: warning -This section is under construction. We appreciate your patience. -::: - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `httpClient` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - httpClient: inject(CustomHttpClient), -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## Plugins - -You might be also interested in the [Angular](/openapi-ts/plugins/angular) plugin. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/angular/v19.md b/docs/openapi-ts/clients/angular/v19.md deleted file mode 100644 index 4f40d0e8a6..0000000000 --- a/docs/openapi-ts/clients/angular/v19.md +++ /dev/null @@ -1,257 +0,0 @@ ---- -title: Angular v19 Client -description: Generate a type-safe Angular v19 client from OpenAPI with the Angular client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Angular v19

    - -
    - -::: warning -Angular client is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Angular](https://angular.dev/) is a web framework that empowers developers to build fast, reliable applications. - -The Angular client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Collaborators - - - -## Features - -- Angular v19 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- support for [`@Injectable()`](https://angular.dev/api/core/Injectable) decorators -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-angular` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-angular'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-angular # [!code ++] -``` - -::: - -### Providers - -You can use the Angular client in your application by adding `provideHeyApiClient` to your providers. - -```ts -import { provideHeyApiClient, client } from './client/client.gen'; - -export const appConfig: ApplicationConfig = { - providers: [ - provideHttpClient(withFetch()), - provideHeyApiClient(client), // [!code ++] - ], -}; -``` - -## Configuration - -The Angular client is built as a thin wrapper on top of Angular, extending its functionality to work with Hey API. If you're already familiar with Angular, configuring your client will feel like working directly with Angular. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any `HttpRequest` configuration option to `setConfig()`, and even your own [`httpClient`](#custom-httpclient) implementation. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-angular', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseUrl: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseUrl: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseUrl: 'https://example.com', // <-- override default configuration -}); -``` - -## `@Injectable` - -If you prefer to use the [`@Injectable()`](https://angular.dev/api/core/Injectable) decorators, set the `asClass` option in your SDK plugin to `true`. - -::: code-group - -```ts [example] -@Injectable({ providedIn: 'root' }) -export class FooService { - // class methods -} -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - '@hey-api/client-angular', - { - name: '@hey-api/sdk', - asClass: true, // [!code ++] - }, - ], -}; -``` - -::: - -## Interceptors - -::: warning -This section is under construction. We appreciate your patience. -::: - -## Auth - -::: warning -This section is under construction. We appreciate your patience. -::: - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `httpClient` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - httpClient: inject(CustomHttpClient), -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## Plugins - -You might be also interested in the [Angular](/openapi-ts/plugins/angular/v19) plugin. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/axios.md b/docs/openapi-ts/clients/axios.md deleted file mode 100644 index a31046b511..0000000000 --- a/docs/openapi-ts/clients/axios.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -title: Axios v1 Client -description: Generate a type-safe Axios v1 client from OpenAPI with the Axios client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Axios v1

    - -
    - -### About - -[Axios](https://axios-http.com) is a simple promise based HTTP client for the browser and Node.js. Axios provides a simple to use library in a small package with a very extensible interface. - -The Axios client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Demo - - - -## Features - -- Axios v1 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-axios` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-axios'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-axios # [!code ++] -``` - -::: - -## Configuration - -The Axios client is built as a thin wrapper on top of Axios, extending its functionality to work with Hey API. If you're already familiar with Axios, configuring your client will feel like working directly with Axios. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Axios configuration option to `setConfig()` (except for `auth`), and even your own [Axios](#custom-instance) implementation. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseURL: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-axios', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseURL: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseURL: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseURL: 'https://example.com', // <-- override default configuration -}); -``` - -## Interceptors - -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. Axios provides interceptors, please refer to their documentation on [interceptors](https://axios-http.com/docs/interceptors). - -We expose the Axios instance through the `instance` field. - -```js -import { client } from 'client/client.gen'; - -client.instance.interceptors.request.use((config) => { - // do something - return config; -}); -``` - -## Auth - -The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - auth: () => '', // [!code ++] - baseURL: 'https://example.com', -}); -``` - -If you're not using SDKs or generating auth, using interceptors is a common approach to configuring auth for each request. - -```js -import { client } from 'client/client.gen'; - -client.instance.interceptors.request.use((config) => { - config.headers.set('Authorization', 'Bearer '); // [!code ++] - return config; -}); -``` - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `axios` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import axios from 'axios'; -import { client } from 'client/client.gen'; - -// Customize the default axios instance -axios.defaults.baseURL = 'https://example.com'; - -client.setConfig({ - axios: axios, -}); -``` - -or you can pass an `AxiosInstance` created with `axios.create()`: - -```js -import axios from 'axios'; -import { client } from 'client/client.gen'; - -const customAxiosInstance = axios.create({ - baseURL: 'https://example.com', -}); - -client.setConfig({ - axios: customAxiosInstance, -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/custom.md b/docs/openapi-ts/clients/custom.md deleted file mode 100644 index fa01f88147..0000000000 --- a/docs/openapi-ts/clients/custom.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Custom Client -description: Learn how to create your own Hey API client. ---- - -# Custom Client - -::: warning -Client API is in development. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues/1213). -::: - -You may need to write your own client if the available clients do not suit your needs or you're working on a proprietary use case. This can be easily achieved using the Client API. But don't take our word for it โ€“ all Hey API clients are written this way! - -::: warning -Custom clients documentation will be finalized after further testing. Simplified [instructions](https://github.com/hey-api/openapi-ts/issues/1213#issuecomment-2765206344) can be found in the GitHub thread. -::: - - - diff --git a/docs/openapi-ts/clients/effect.md b/docs/openapi-ts/clients/effect.md deleted file mode 100644 index 383cc9401b..0000000000 --- a/docs/openapi-ts/clients/effect.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Effect client -description: Effect client for Hey API. Compatible with all our features. ---- - - - -# Effect vote - - - -### About - -[Effect](https://effect.website/) is a powerful TypeScript library designed to help developers easily create complex, synchronous, and asynchronous programs. - - diff --git a/docs/openapi-ts/clients/fetch.md b/docs/openapi-ts/clients/fetch.md deleted file mode 100644 index 99fcd01268..0000000000 --- a/docs/openapi-ts/clients/fetch.md +++ /dev/null @@ -1,313 +0,0 @@ ---- -title: Fetch API Client -description: Generate a type-safe Fetch API client from OpenAPI with the Fetch API client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - -# Fetch API - -### About - -The [Fetch API](https://developer.mozilla.org/docs/Web/API/Fetch_API) provides an interface for fetching resources (including across the network). It is a more powerful and flexible replacement for XMLHttpRequest. - -The Fetch API client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Demo - - - -## Features - -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-fetch` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-fetch'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-fetch # [!code ++] -``` - -::: - -::: tip - -This step is optional because Fetch is the default client. - -::: - -## Configuration - -The Fetch client is built as a thin wrapper on top of Fetch API, extending its functionality to work with Hey API. If you're already familiar with Fetch, configuring your client will feel like working directly with Fetch API. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to `setConfig()`, and even your own [Fetch](#custom-instance) implementation. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-fetch', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseUrl: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseUrl: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseUrl: 'https://example.com', // <-- override default configuration -}); -``` - -## Interceptors - -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. - -They can be added with `use`, removed with `eject`, and updated wth `update`. The `use` and `update` methods will return the ID of the interceptor for use with `eject` and `update`. Fetch API does not have the interceptor functionality, so we implement our own. - -### Example: Request interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(request) { - // do something - return request; -} - -interceptorId = client.interceptors.request.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.request.eject(interceptorId); - -// eject by reference -client.interceptors.request.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(request) { - // do something - return request; -} - -// update by ID -client.interceptors.request.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.request.update(myInterceptor, myNewInterceptor); -``` - -::: - -### Example: Response interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(response) { - // do something - return response; -} - -interceptorId = client.interceptors.response.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.response.eject(interceptorId); - -// eject by reference -client.interceptors.response.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(response) { - // do something - return response; -} - -// update by ID -client.interceptors.response.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.response.update(myInterceptor, myNewInterceptor); -``` - -::: - -::: tip -To eject, you must provide the ID or reference of the interceptor passed to `use()`, the ID is the value returned by `use()` and `update()`. -::: - -## Auth - -The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - auth: () => '', // [!code ++] - baseUrl: 'https://example.com', -}); -``` - -If you're not using SDKs or generating auth, using interceptors is a common approach to configuring auth for each request. - -```js -import { client } from 'client/client.gen'; - -client.interceptors.request.use((request, options) => { - request.headers.set('Authorization', 'Bearer '); // [!code ++] - return request; -}); -``` - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `fetch` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - fetch: () => { - /* custom `fetch` method */ - }, -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/got.md b/docs/openapi-ts/clients/got.md deleted file mode 100644 index 08acc77d54..0000000000 --- a/docs/openapi-ts/clients/got.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Got client -description: Got client for Hey API. Compatible with all our features. ---- - - - -# Got vote - - - -### About - -[Got](https://github.com/sindresorhus/got) is a human-friendly and powerful HTTP request library for Node.js. - - diff --git a/docs/openapi-ts/clients/ky.md b/docs/openapi-ts/clients/ky.md deleted file mode 100644 index e05a487865..0000000000 --- a/docs/openapi-ts/clients/ky.md +++ /dev/null @@ -1,311 +0,0 @@ ---- -title: Ky v1 Client -description: Generate a type-safe Ky v1 client from OpenAPI with the Ky client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Ky v1

    - -
    - -### About - -[Ky](https://github.com/sindresorhus/ky) is a tiny and elegant JavaScript HTTP client based on the Fetch API. - -The Ky client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Collaborators - - - -## Features - -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-ky` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-ky'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-ky # [!code ++] -``` - -::: - -## Configuration - -The Ky client is built as a thin wrapper on top of Ky, extending its functionality to work with Hey API. If you're already familiar with Ky, configuring your client will feel like working directly with Ky. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Ky configuration option to `setConfig()`, and even your own [`ky`](#custom-instance) instance. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-ky', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseUrl: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseUrl: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseUrl: 'https://example.com', // <-- override default configuration -}); -``` - -## Interceptors - -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. - -They can be added with `use`, removed with `eject`, and updated wth `update`. The `use` and `update` methods will return the ID of the interceptor for use with `eject` and `update`. Ky does not have the interceptor functionality, so we implement our own. - -### Example: Request interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(request) { - // do something - return request; -} - -interceptorId = client.interceptors.request.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.request.eject(interceptorId); - -// eject by reference -client.interceptors.request.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(request) { - // do something - return request; -} - -// update by ID -client.interceptors.request.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.request.update(myInterceptor, myNewInterceptor); -``` - -::: - -### Example: Response interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(response) { - // do something - return response; -} - -interceptorId = client.interceptors.response.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.response.eject(interceptorId); - -// eject by reference -client.interceptors.response.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(response) { - // do something - return response; -} - -// update by ID -client.interceptors.response.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.response.update(myInterceptor, myNewInterceptor); -``` - -::: - -::: tip -To eject, you must provide the ID or reference of the interceptor passed to `use()`, the ID is the value returned by `use()` and `update()`. -::: - -## Auth - -The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - auth: () => '', // [!code ++] - baseUrl: 'https://example.com', -}); -``` - -If you're not using SDKs or generating auth, using interceptors is a common approach to configuring auth for each request. - -```js -import { client } from 'client/client.gen'; - -client.interceptors.request.use((request, options) => { - request.headers.set('Authorization', 'Bearer '); // [!code ++] - return request; -}); -``` - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `ky` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - ky: ky.create({ - /* custom `ky` instance */ - }), -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-ky/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/next-js.md b/docs/openapi-ts/clients/next-js.md deleted file mode 100644 index 50ef19b7a8..0000000000 --- a/docs/openapi-ts/clients/next-js.md +++ /dev/null @@ -1,296 +0,0 @@ ---- -title: Next.js Client -description: Generate a type-safe Next.js client from OpenAPI with the Next.js client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - -# Next.js - -### About - -[Next.js](https://nextjs.org) is the React framework for the web. Used by some of the world's largest companies, Next.js enables you to create high-quality web applications with the power of React components. - -The Next.js client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -## Features - -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-next` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-next'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-next # [!code ++] -``` - -::: - -## Configuration - -The Next.js client is built as a thin wrapper on top of [fetch](https://nextjs.org/docs/app/api-reference/functions/fetch), extending its functionality to work with Hey API. If you're already familiar with Fetch, configuring your client will feel like working directly with Fetch API. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-next', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseUrl: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. This is the recommended approach because it guarantees the client will be initialized in both server and client environment. If needed, you can still use `setConfig()` to update the client configuration later. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to `setConfig()`, and even your own [Fetch](#custom-instance) implementation. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, this might be an acceptable trade-off. However, our Next.js users usually want to use the first approach. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseUrl: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseUrl: 'https://example.com', // <-- override default configuration -}); -``` - -## Interceptors - -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. - -They can be added with `use`, removed with `eject`, and updated wth `update`. The `use` and `update` methods will return the ID of the interceptor for use with `eject` and `update`. Fetch API does not have the interceptor functionality, so we implement our own. - -### Example: Request interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(request) { - // do something - return request; -} - -interceptorId = client.interceptors.request.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.request.eject(interceptorId); - -// eject by reference -client.interceptors.request.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(request) { - // do something - return request; -} - -// update by ID -client.interceptors.request.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.request.update(myInterceptor, myNewInterceptor); -``` - -::: - -### Example: Response interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(response) { - // do something - return response; -} - -interceptorId = client.interceptors.response.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.response.eject(interceptorId); - -// eject by reference -client.interceptors.response.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(response) { - // do something - return response; -} - -// update by ID -client.interceptors.response.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.response.update(myInterceptor, myNewInterceptor); -``` - -::: - -::: tip -To eject, you must provide the ID or reference of the interceptor passed to `use()`, the ID is the value returned by `use()` and `update()`. -::: - -## Auth - -The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - auth: () => '', // [!code ++] - baseUrl: 'https://example.com', -}); -``` - -If you're not using SDKs or generating auth, using interceptors is a common approach to configuring auth for each request. - -```js -import { client } from 'client/client.gen'; - -client.interceptors.request.use((options) => { - options.headers.set('Authorization', 'Bearer '); // [!code ++] -}); -``` - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `fetch` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - fetch: () => { - /* custom `fetch` method */ - }, -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-next/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/nuxt.md b/docs/openapi-ts/clients/nuxt.md deleted file mode 100644 index ef8657b6a7..0000000000 --- a/docs/openapi-ts/clients/nuxt.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -title: Nuxt v3 Client -description: Generate a type-safe Nuxt v3 client from OpenAPI with the Nuxt client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Nuxt v3

    - -
    - -::: warning -Nuxt client is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Nuxt](https://nuxt.com) is an open source framework that makes web development intuitive and powerful. - -The Nuxt client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -## Features - -- Nuxt v3 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -Start by adding `@hey-api/nuxt` to your dependencies. - -::: code-group - -```sh [npm] -npm install @hey-api/nuxt -``` - -```sh [pnpm] -pnpm add @hey-api/nuxt -``` - -```sh [yarn] -yarn add @hey-api/nuxt -``` - -```sh [bun] -bun add @hey-api/nuxt -``` - -::: - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-nuxt` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-nuxt'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-nuxt # [!code ++] -``` - -::: - -::: tip - -If you add `@hey-api/nuxt` to your Nuxt modules, this step is not needed. - -::: - -## Configuration - -The Nuxt client is built as a thin wrapper on top of Nuxt, extending its functionality to work with Hey API. If you're already familiar with Nuxt, configuring your client will feel like working directly with Nuxt. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Nuxt configuration option to `setConfig()`, and even your own [`$fetch`](#custom-instance) implementation. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseURL: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-nuxt', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseURL: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseURL: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseURL: 'https://example.com', // <-- override default configuration -}); -``` - -## Interceptors - -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. Nuxt provides interceptors through ofetch, please refer to their documentation on [$fetch](https://nuxt.com/docs/api/utils/dollarfetch). - -You can pass any Nuxt/ofetch arguments to the client instance. - -::: tip -If you omit `composable`, `$fetch` is used by default. -::: - -```js -import { client } from 'client/client.gen'; - -const result = await client.get({ - composable: '$fetch', - onRequest: (context) => { - // do something - }, - url: '/foo', -}); -``` - -## Auth - -The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - auth: () => '', // [!code ++] - baseURL: 'https://example.com', -}); -``` - -If you're not using SDKs or generating auth, using interceptors is a common approach to configuring auth for each request. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - onRequest: ({ options }) => { - options.headers.set('Authorization', 'Bearer '); // [!code ++] - }, -}); -``` - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `$fetch` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - $fetch: () => { - /* custom `$fetch` method */ - }, -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.ts) interface. - - - diff --git a/docs/openapi-ts/clients/ofetch.md b/docs/openapi-ts/clients/ofetch.md deleted file mode 100644 index 32c06bf772..0000000000 --- a/docs/openapi-ts/clients/ofetch.md +++ /dev/null @@ -1,350 +0,0 @@ ---- -title: OFetch Client -description: Generate a type-safe ofetch client from OpenAPI with the ofetch client for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - -# OFetch - -### About - -[`ofetch`](https://github.com/unjs/ofetch) is a better Fetch API that adds useful defaults and features such as automatic response parsing, request/response hooks, and it works in Node, browser, and workers. - -The `ofetch` client for Hey API generates a type-safe client from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Collaborators - - - -## Features - -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe response data and errors -- response data validation and transformation -- access to the original request and response -- granular request and response customization options -- minimal learning curve thanks to extending the underlying technology -- support bundling inside the generated output - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/client-ofetch` to your plugins and you'll be ready to generate client artifacts. :tada: - -::: code-group - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-ofetch'], // [!code ++] -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -c @hey-api/client-ofetch # [!code ++] -``` - -::: - -## Configuration - -The `ofetch` client is built as a thin wrapper on top of `ofetch`, extending its functionality to work with Hey API. If you're already familiar with `ofetch`, configuring your client will feel like working directly with `ofetch`. - -When we installed the client above, it created a [`client.gen.ts`](/openapi-ts/output#client) file. You will most likely want to configure the exported `client` instance. There are two ways to do that. - -### `setConfig()` - -This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any `ofetch` configuration option to `setConfig()`, and even your own [`ofetch`](#custom-instance) instance. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); -``` - -The disadvantage of this approach is that your code may call the `client` instance before it's configured for the first time. Depending on your use case, you might need to use the second approach. - -### Runtime API - -Since `client.gen.ts` is a generated file, we can't directly modify it. Instead, we can tell our configuration to use a custom file implementing the Runtime API. We do that by specifying the `runtimeConfigPath` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-ofetch', - runtimeConfigPath: './src/hey-api.ts', // [!code ++] - }, - ], -}; -``` - -In our custom file, we need to export a `createClientConfig()` method. This function is a simple wrapper allowing us to override configuration values. - -::: code-group - -```ts [hey-api.ts] -import type { CreateClientConfig } from './client/client.gen'; - -export const createClientConfig: CreateClientConfig = (config) => ({ - ...config, - baseUrl: 'https://example.com', -}); -``` - -::: - -With this approach, `client.gen.ts` will call `createClientConfig()` before initializing the `client` instance. If needed, you can still use `setConfig()` to update the client configuration later. - -### `createClient()` - -You can also create your own client instance. You can use it to manually send requests or point it to a different domain. - -```js -import { createClient } from './client/client'; - -const myClient = createClient({ - baseUrl: 'https://example.com', -}); -``` - -You can also pass this instance to any SDK function through the `client` option. This will override the default instance from `client.gen.ts`. - -```js -const response = await getFoo({ - client: myClient, -}); -``` - -### SDKs - -Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases. - -```js -const response = await getFoo({ - baseUrl: 'https://example.com', // <-- override default configuration -}); -``` - -## Interceptors - -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. - -The `ofetch` client supports two complementary options: - -- built-in Hey API interceptors exposed via `client.interceptors` -- native `ofetch` hooks passed through config (e.g., `onRequest`) - -### Example: Request interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(request) { - // do something - return request; -} - -interceptorId = client.interceptors.request.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.request.eject(interceptorId); - -// eject by reference -client.interceptors.request.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(request) { - // do something - return request; -} - -// update by ID -client.interceptors.request.update(interceptorId, myNewInterceptor); - -// update by reference -client.interceptors.request.update(myInterceptor, myNewInterceptor); -``` - -::: - -### Example: Response interceptor - -::: code-group - -```js [use] -import { client } from 'client/client.gen'; - -async function myInterceptor(response) { - // do something - return response; -} - -interceptorId = client.interceptors.response.use(myInterceptor); -``` - -```js [eject] -import { client } from 'client/client.gen'; - -// eject by ID -client.interceptors.response.eject(interceptorId); - -// eject by reference -client.interceptors.response.eject(myInterceptor); -``` - -```js [update] -import { client } from 'client/client.gen'; - -async function myNewInterceptor(response) { - // do something - return response; -} - -// update interceptor by interceptor ID -client.interceptors.response.update(interceptorId, myNewInterceptor); - -// update interceptor by reference to interceptor function -client.interceptors.response.update(myInterceptor, myNewInterceptor); -``` - -::: - -::: tip -To eject, you must provide the ID or reference of the interceptor passed to `use()`, the ID is the value returned by `use()` and `update()`. -::: - -### Example: `ofetch` hooks - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - onRequest: ({ options }) => { - // mutate ofetch options (headers, query, etc.) - }, - onResponse: ({ response }) => { - // inspect/transform the raw Response - }, - onRequestError: (ctx) => { - // handle request errors - }, - onResponseError: (ctx) => { - // handle response errors - }, -}); -``` - -## Auth - -The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - auth: () => '', // [!code ++] - baseUrl: 'https://example.com', -}); -``` - -If you're not using SDKs or generating auth, using interceptors is a common approach to configuring auth for each request. - -```js -import { client } from 'client/client.gen'; - -client.interceptors.request.use((request, options) => { - request.headers.set('Authorization', 'Bearer '); // [!code ++] - return request; -}); -``` - -You can also use the `ofetch` hooks. - -```js -import { client } from 'client/client.gen'; - -client.setConfig({ - onRequest: ({ options }) => { - options.headers.set('Authorization', 'Bearer '); // [!code ++] - }, -}); -``` - -## Build URL - -If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. - -```ts -type FooData = { - path: { - fooId: number; - }; - query?: { - bar?: string; - }; - url: '/foo/{fooId}'; -}; - -const url = client.buildUrl({ - path: { - fooId: 1, - }, - query: { - bar: 'baz', - }, - url: '/foo/{fooId}', -}); -console.log(url); // prints '/foo/1?bar=baz' -``` - -## Custom Instance - -You can provide a custom `ofetch` instance. This is useful if you need to extend the default instance with extra functionality, or replace it altogether. - -```js -import { ofetch } from 'ofetch'; -import { client } from 'client/client.gen'; - -const customOFetchInstance = ofetch.create({ - onRequest: ({ options }) => { - // customize request - }, - onResponse: ({ response }) => { - // customize response - }, -}); - -client.setConfig({ - ofetch: customOFetchInstance, -}); -``` - -You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.ts) interface. - - - diff --git a/docs/openapi-ts/community/contributing.md b/docs/openapi-ts/community/contributing.md deleted file mode 100644 index e54189b099..0000000000 --- a/docs/openapi-ts/community/contributing.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Contributing -description: Learn how to contribute to Hey API. ---- - -# Contributor Manual - -## Foreword - -Hey API is building an OpenAPI to TypeScript code generator ecosystem. It's trusted by thousands of companies โ€“ from YC startups to Fortune 500 enterprises โ€“ and powers products used by millions worldwide. - -We welcome contributors of all backgrounds and experience levels. Whether you're fixing a typo or building a new feature, your input matters. If you need guidance, help with technical writing, or want to bring a feature idea to life, we're here to support you. - -::: tip - -New to open source? Take a look at the [Open Source](https://opensource.guide/) or [First Contributions](https://github.com/firstcontributions/first-contributions) guides for helpful information on contributing to open source projects. - -::: - -## First Steps - -There are many ways to contribute to Hey API. Most of them don't involve writing any code! - -- **Read the documentation**. Start with the [Get Started](/openapi-ts/get-started) guide. If you find anything broken or confusing, you can suggest improvements by clicking "Edit" at the bottom of any page. - -- **Browse open issues**. Help others by providing workarounds, asking for clarification, triaging, or suggesting labels on [open issues](https://github.com/hey-api/openapi-ts/issues). If you see something you would like to work on, consider opening a pull request. - -- **Participate in discussions**. Ask or [answer questions](https://github.com/orgs/hey-api/discussions), provide feedback, or suggest new ideas. Every idea is welcome, no matter how big or small. - -- **Engage on social media**. Help others discover Hey API by engaging with our posts on [LinkedIn](https://linkedin.com/company/heyapi), [Bluesky](https://bsky.app/profile/heyapi.dev), or [X](https://x.com/mrlubos). Share your experiences with Hey API on Reddit, Slack, or in your own communities and group chats. - -- **Create a new issue**. If you can't find a solution, [open an issue](https://github.com/hey-api/openapi-ts/issues). The issue template will guide you through the process. - -- **Open a pull request**. If you find an issue you would like to fix, open a pull request. If you need help, tag [`@mrlubos`](https://github.com/mrlubos) on GitHub, provide enough relevant information, and we will do our best to assist you. - -These are some of the best ways not only to contribute to Hey API, but also to learn, connect with others, and share ideas. - -## Pull Requests - -Ready to write some code? We have dedicated guides to help you [build](/openapi-ts/community/contributing/building), [develop](/openapi-ts/community/contributing/developing), and [test](/openapi-ts/community/contributing/testing) your feature before it's released. - -We are excited to see what you'll contribute! diff --git a/docs/openapi-ts/community/contributing/building.md b/docs/openapi-ts/community/contributing/building.md deleted file mode 100644 index 839c24c31a..0000000000 --- a/docs/openapi-ts/community/contributing/building.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Building -description: Learn how to contribute to Hey API. ---- - -# Building - -::: warning -This page is under construction. We appreciate your patience. -::: - -## Prerequisites - -You should have a working knowledge of [git](https://git-scm.com), [node](https://nodejs.org/en), and [pnpm](https://pnpm.io). - -## Guidelines - -Your [pull request](https://help.github.com/articles/using-pull-requests) must: - -- address a single issue or add a single item of functionality -- contain a clean history of small, incremental, logically separate commits, with no merge commits -- use clear commit messages -- be possible to merge automatically - -## Start `@hey-api/openapi-ts` - -Run `pnpm --filter @hey-api/openapi-ts dev`. diff --git a/docs/openapi-ts/community/contributing/developing.md b/docs/openapi-ts/community/contributing/developing.md deleted file mode 100644 index 203e885793..0000000000 --- a/docs/openapi-ts/community/contributing/developing.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -title: Developing -description: Learn how to contribute to Hey API. ---- - -# Developing - -::: warning -This page is under construction. We appreciate your patience. -::: - -## Working with Examples - -The `examples` folder contains various integration examples that demonstrate how to use `@hey-api/openapi-ts` with different frameworks and libraries. These examples are kept in sync with the codebase through automated checks. - -### Generating Example Code - -When you make changes to the core packages that affect code generation, you need to regenerate the client code in all examples: - -```bash -pnpm examples:generate -``` - -This command will: - -- Find all examples with an `openapi-ts` script -- Run the OpenAPI code generator for each example -- Update the generated client code in each example - -### Checking Example Code - -Before committing changes, ensure that all generated example code is up-to-date: - -```bash -pnpm examples:check -``` - -This command will: - -- Regenerate all example code -- Check if any files were modified -- Exit with an error if generated code is out of sync - -This check is also run automatically in CI to ensure examples stay in sync with the main codebase. - -### Example Workflow - -1. Make changes to core packages -2. Build the packages: `pnpm build --filter="@hey-api/**"` -3. Regenerate examples: `pnpm examples:generate` -4. Commit all changes including the updated generated code -5. The CI will verify that examples are in sync - -::: tip -Think of generated example code as snapshot tests - they should always reflect the current state of the code generator. -::: - -## Writing Changelogs - -We use [Changesets](https://github.com/changesets/changesets) to manage releases and generate changelogs. When contributing changes, create a changeset to document your updates. - -### Creating a Changeset - -Run the following command to create a new changeset: - -```bash -pnpm changeset -``` - -This will prompt you to: - -1. Select the packages that were changed -2. Choose the semver bump type (major, minor, or patch) -3. Write a summary of your changes - -### Changeset Format - -Changesets use the following format: - -```markdown ---- -'@hey-api/openapi-ts': patch ---- - -**scope**: description of changes -``` - -**Scopes:** - -- `cli`, `parser`, `output`, `config`, `input`, `internal`, `build`, `error` โ†’ Core section -- `plugin(name)` โ†’ Plugins section (e.g., `**plugin(zod)**:`, `**plugin(@hey-api/client-axios)**:`) -- Any other scope โ†’ Other section - -**Breaking Changes:** - -- Use `**BREAKING**:` prefix in the description to mark breaking changes -- For packages on v0.x (major version 0), minor bumps may include breaking changes. Use signal words like "removed", "renamed", or "changed signature" to indicate breaking changes. - -### Examples - -```markdown -# Bug fix - ---- - -## "@hey-api/openapi-ts": patch - -**parser**: fix explicit discriminator mapping -``` - -```markdown -# New feature - ---- - -## "@hey-api/openapi-ts": minor - -**plugin(zod)**: handle guid string format -``` - -```markdown -# Breaking change - ---- - -## "@hey-api/openapi-ts": minor - -**BREAKING**: removed deprecated `getClient()` function -``` - -```markdown -# Plugin change - ---- - -## "@hey-api/openapi-ts": patch - -**plugin(@hey-api/client-fetch)**: improve error handling -``` diff --git a/docs/openapi-ts/community/contributing/testing.md b/docs/openapi-ts/community/contributing/testing.md deleted file mode 100644 index 6b4c834f58..0000000000 --- a/docs/openapi-ts/community/contributing/testing.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Testing -description: Learn how to contribute to Hey API. ---- - -# Testing - -::: warning -This page is under construction. We appreciate your patience. -::: diff --git a/docs/openapi-ts/community/spotlight.md b/docs/openapi-ts/community/spotlight.md deleted file mode 100644 index 66aedb61b9..0000000000 --- a/docs/openapi-ts/community/spotlight.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: Spotlight -description: Meet the people behind Hey API. ---- - - - -# Spotlight - -Meet the people behind Hey API. To join this list, please refer to the [contributing](/openapi-ts/community/contributing) guide. - -## Core Team - -These people actively maintain Hey API. - - - -Do you want to join the core team? Send us a short [email](mailto:lubos@heyapi.dev?subject=Join%20Core%20Team) describing your interest in Hey API, any relevant experience, and what you're hoping to work on. - -## Hall of Fame - -These are the people with significant contributions to Hey API. A special thank you goes to [Ferdi Koomen](https://madebyferdi.com) for allowing us to use the original source code from OpenAPI TypeScript Codegen. None of this would've been possible without you! - - - -## Contributors - -The complete list of contributors to Hey API. - -
    - - - -
    - -A sincere thank you for your contributions. - - diff --git a/docs/openapi-ts/configuration.md b/docs/openapi-ts/configuration.md deleted file mode 100644 index 93b0a6da81..0000000000 --- a/docs/openapi-ts/configuration.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -title: Configuration -description: Configure @hey-api/openapi-ts. ---- - -# Configuration - -`@hey-api/openapi-ts` supports loading configuration from any file inside your project root folder supported by [jiti loader](https://github.com/unjs/c12?tab=readme-ov-file#-features). Below are the most common file formats. - -::: code-group - -```js [openapi-ts.config.ts] -import { defineConfig } from '@hey-api/openapi-ts'; - -export default defineConfig({ - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}); -``` - -```js [openapi-ts.config.cjs] -/** @type {import('@hey-api/openapi-ts').UserConfig} */ -module.exports = { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -```js [openapi-ts.config.mjs] -/** @type {import('@hey-api/openapi-ts').UserConfig} */ -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -::: - -Alternatively, you can use `openapi-ts.config.js` and configure the export statement depending on your project setup. - -## Input - -You must provide an input so we can load your OpenAPI specification. - -The input can be a string path, URL, [API registry](/openapi-ts/configuration/input#api-registry) shorthand, an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats. - -You can learn more on the [Input](/openapi-ts/configuration/input) page. - -::: code-group - -```js [path] -export default { - input: './path/to/openapi.json', // [!code ++] -}; -``` - -```js [url] -export default { - input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev // [!code ++] -}; -``` - -```js [registry] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] -}; -``` - - -```js [object] -export default { - input: { // [!code ++] - path: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] - // ...other options // [!code ++] - }, // [!code ++] -}; -``` - - -```js [spec] -export default { - input: { // [!code ++] - openapi: '3.1.1', // [!code ++] - // ...rest of your spec // [!code ++] - }, // [!code ++] -}; -``` - - -::: - -::: info -If you use an HTTPS URL with a self-signed certificate in development, you will need to set [`NODE_TLS_REJECT_UNAUTHORIZED=0`](https://github.com/hey-api/openapi-ts/issues/276#issuecomment-2043143501) in your environment. -::: - -## Output - -You must set the output so we know where to generate your files. It can be a path to the destination folder or an object containing the destination folder path and optional settings. - -You can learn more on the [Output](/openapi-ts/configuration/output) page. - -::: code-group - -```js [path] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', // [!code ++] -}; -``` - - -```js [object] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { // [!code ++] - path: 'src/client', // [!code ++] - // ...other options // [!code ++] - }, // [!code ++] -}; -``` - - -::: - -::: tip -You should treat the output folder as a dependency. Do not directly modify its contents as your changes might be erased when you run `@hey-api/openapi-ts` again. -::: - -## Parser - -We parse your input before making it available to plugins. Configuring the parser is optional, but it provides an ideal opportunity to modify or validate your input as needed. - -You can learn more on the [Parser](/openapi-ts/configuration/parser) page. - -## Plugins - -Plugins are responsible for generating artifacts from your input. By default, Hey API will generate TypeScript interfaces and SDK from your OpenAPI specification. You can add, remove, or customize any of the plugins. In fact, we highly encourage you to do so! - -You can learn more on the [Output](/openapi-ts/output) page. - -## Advanced - -More complex configuration scenarios can be handled by providing an array of inputs, outputs, or configurations. - -### Multiple jobs - -Throughout this documentation, we generally reference single job configurations. However, you can easily run multiple jobs by providing an array of configuration objects. - -::: code-group - -```js [config] -export default [ - { - input: 'foo.yaml', - output: 'src/foo', - }, - { - input: 'bar.yaml', - output: 'src/bar', - }, -]; -``` - -```txt [example] -src/ -โ”œโ”€โ”€ foo/ -โ”‚ โ”œโ”€โ”€ client/ -โ”‚ โ”œโ”€โ”€ core/ -โ”‚ โ”œโ”€โ”€ client.gen.ts -โ”‚ โ”œโ”€โ”€ index.ts -โ”‚ โ”œโ”€โ”€ sdk.gen.ts -โ”‚ โ””โ”€โ”€ types.gen.ts -โ””โ”€โ”€ bar/ - โ”œโ”€โ”€ client/ - โ”œโ”€โ”€ core/ - โ”œโ”€โ”€ client.gen.ts - โ”œโ”€โ”€ index.ts - โ”œโ”€โ”€ sdk.gen.ts - โ””โ”€โ”€ types.gen.ts -``` - -::: - -### Job matrix - -Reusing configuration across multiple jobs is possible by defining a job matrix. You can create a job matrix by providing `input` and `output` arrays of matching length. - -::: code-group - -```js [config] -export default { - input: ['foo.yaml', 'bar.yaml'], - output: ['src/foo', 'src/bar'], -}; -``` - -```txt [example] -src/ -โ”œโ”€โ”€ foo/ -โ”‚ โ”œโ”€โ”€ client/ -โ”‚ โ”œโ”€โ”€ core/ -โ”‚ โ”œโ”€โ”€ client.gen.ts -โ”‚ โ”œโ”€โ”€ index.ts -โ”‚ โ”œโ”€โ”€ sdk.gen.ts -โ”‚ โ””โ”€โ”€ types.gen.ts -โ””โ”€โ”€ bar/ - โ”œโ”€โ”€ client/ - โ”œโ”€โ”€ core/ - โ”œโ”€โ”€ client.gen.ts - โ”œโ”€โ”€ index.ts - โ”œโ”€โ”€ sdk.gen.ts - โ””โ”€โ”€ types.gen.ts -``` - -::: - -### Merging inputs - -You can merge inputs by defining multiple inputs and a single output. - -::: code-group - -```js [config] -export default { - input: ['foo.yaml', 'bar.yaml'], - output: 'src/client', -}; -``` - -```txt [example] -src/ -โ””โ”€โ”€ client/ - โ”œโ”€โ”€ client/ - โ”œโ”€โ”€ core/ - โ”œโ”€โ”€ client.gen.ts - โ”œโ”€โ”€ index.ts - โ”œโ”€โ”€ sdk.gen.ts - โ””โ”€โ”€ types.gen.ts -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/config/types.ts) interface. - - - diff --git a/docs/openapi-ts/configuration/input.md b/docs/openapi-ts/configuration/input.md deleted file mode 100644 index 6269d1c769..0000000000 --- a/docs/openapi-ts/configuration/input.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -title: Input -description: Configure @hey-api/openapi-ts. ---- - -# Input - -You must provide an input so we can load your OpenAPI specification. - -## Input - -The input can be a string path, URL, [API registry](#api-registry), an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats. - -::: code-group - -```js [path] -export default { - input: './path/to/openapi.json', // [!code ++] -}; -``` - -```js [url] -export default { - input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev // [!code ++] -}; -``` - -```js [registry] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] -}; -``` - - -```js [object] -export default { - input: { // [!code ++] - path: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] - // ...other options // [!code ++] - }, // [!code ++] -}; -``` - - -```js [spec] -export default { - input: { // [!code ++] - openapi: '3.1.1', // [!code ++] - // ...rest of your spec // [!code ++] - }, // [!code ++] -}; -``` - - -::: - -You can learn more about complex use cases in the [Advanced](/openapi-ts/configuration#advanced) section. - -::: info -If you use an HTTPS URL with a self-signed certificate in development, you will need to set [`NODE_TLS_REJECT_UNAUTHORIZED=0`](https://github.com/hey-api/openapi-ts/issues/276#issuecomment-2043143501) in your environment. -::: - -### Request options - -You can pass any valid Fetch API [options](https://developer.mozilla.org/docs/Web/API/RequestInit) to the request for fetching your specification. This is useful if your file is behind auth for example. - - -```js -export default { - input: { - path: 'https://secret.com/protected-spec', - fetch: { // [!code ++] - headers: { // [!code ++] - Authorization: 'Bearer xxx', // [!code ++] - }, // [!code ++] - }, // [!code ++] - }, -}; -``` - - -## API Registry - -You can store your specifications in an API registry to serve as a single source of truth. This helps prevent drift, improves discoverability, enables version tracking, and more. - -### Hey API - -You can learn more about [Hey API Platform](https://app.heyapi.dev) on the [Integrations](/openapi-ts/integrations) page. - -```js [uuid] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] -}; -``` - -The `input` object lets you provide additional options to construct the correct URL. - -```js -export default { - input: { - path: 'hey-api/backend', // sign up at app.heyapi.dev - branch: 'main', // [!code ++] - }, -}; -``` - -We also provide shorthands for other registries: - -::: details Scalar -Prefix your input with `scalar:` to use the Scalar API Registry. - -```js [long] -export default { - input: 'scalar:@scalar/access-service', // [!code ++] -}; -``` - -::: - -::: details ReadMe -Prefix your input with `readme:` to use the ReadMe API Registry. - -::: code-group - -```js [uuid] -export default { - input: 'readme:nysezql0wwo236', // [!code ++] -}; -``` - -```js [long] -export default { - input: 'readme:@developers/v2.0#nysezql0wwo236', // [!code ++] -}; -``` - -::: - -## Watch Mode - -::: warning -Watch mode currently supports only remote files via URL. -::: - -If your schema changes frequently, you may want to automatically regenerate the output during development. To watch your input file for changes, enable `input.watch` mode in your configuration or pass the `--watch` flag to the CLI. - -::: code-group - -```js [config] -export default { - input: { - path: 'hey-api/backend', // sign up at app.heyapi.dev - watch: true, // [!code ++] - }, -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -i hey-api/backend \ - -o src/client \ - -w # [!code ++] -``` - -::: - - - diff --git a/docs/openapi-ts/configuration/output.md b/docs/openapi-ts/configuration/output.md deleted file mode 100644 index c96e670e09..0000000000 --- a/docs/openapi-ts/configuration/output.md +++ /dev/null @@ -1,440 +0,0 @@ ---- -title: Output -description: Configure @hey-api/openapi-ts. ---- - -# Output - -You must set the output so we know where to generate your files. - -## Output - -Output can be a path to the destination folder or an object containing the destination folder path and optional settings. - -::: code-group - -```js [path] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', // [!code ++] -}; -``` - - -```js [object] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { // [!code ++] - path: 'src/client', // [!code ++] - // ...other options // [!code ++] - }, // [!code ++] -}; -``` - - -::: - -You can learn more about complex use cases in the [Advanced](/openapi-ts/configuration#advanced) section. - -## File - -Control how files are named and annotated in the generated output. - -### File Name - -You can customize the naming and casing pattern for files using the `fileName` option. - -::: code-group - -```js [default] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - fileName: '{{name}}', // [!code ++] - path: 'src/client', - }, -}; -``` - -```js [snake_case] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - fileName: { - case: 'snake_case', // [!code ++] - }, - path: 'src/client', - }, -}; -``` - -::: - -By default, we append every file name with a `.gen` suffix to highlight it's automatically generated. You can customize or disable this suffix using the `fileName.suffix` option. - -::: code-group - -```js [default] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - fileName: { - suffix: '.gen', // [!code ++] - }, - path: 'src/client', - }, -}; -``` - -```js [disabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - fileName: { - suffix: null, // [!code ++] - }, - path: 'src/client', - }, -}; -``` - -```js [custom] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - fileName: { - suffix: '.generated', // [!code ++] - }, - path: 'src/client', - }, -}; -``` - -::: - -### File Header - -The generated output includes a notice in every file warning that any modifications will be lost when the files are regenerated. You can customize or disable this notice using the `header` option. - -::: code-group - -```js [example] -/* eslint-disable */ -// This file is auto-generated by @hey-api/openapi-ts - -/** ... */ -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - header: (ctx) => [ // [!code ++] - '/* eslint-disable */', // [!code ++] - ...ctx.defaultValue, // [!code ++] - ], // [!code ++] - path: 'src/client', - }, -}; -``` - - -::: - -## Module - -Control how module specifiers are generated in the output. - -### Module Extension - -Set `module.extension` to define the file extension used in import specifiers. This is useful when targeting environments that require fully specified imports (e.g., Node ESM or certain bundlers). - -::: code-group - -```js [example] -import foo from './foo.js'; -import bar from './bar.js'; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - module: { - extension: '.js', // [!code ++] - }, - path: 'src/client', - }, -}; -``` - -::: - -### Module Path - -Use `module.resolve` for full control over how module specifiers are generated. This lets you override specific modules or redirect them to custom locations (e.g., CDNs or internal aliases). - -::: code-group - -```js [example] -import * as z from 'https://esm.sh/zod'; -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - module: { - resolve(path) { // [!code ++] - if (path === 'zod') { // [!code ++] - return 'https://esm.sh/zod'; // [!code ++] - } // [!code ++] - }, // [!code ++] - }, - path: 'src/client', - }, -}; -``` - - -::: - -## Source - -Source is a copy of the input specification used to generate your output. It can be used to power documentation tools or to persist a stable snapshot alongside your generated files. - -Enabling the `source` option with `true` creates a `source.json` file in your output folder. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - source: true, // [!code ++] - }, -}; -``` - -You can customize the file name and location using `fileName` and `path`. For example, this configuration will create an `openapi.json` file inside `src/client/source` directory. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - source: { - fileName: 'openapi', // [!code ++] - path: './source', // [!code ++] - }, - }, -}; -``` - -To use the source without writing it to disk, you can provide a `callback` function. This is useful for logging or integrating with external systems. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - source: { - callback: (source) => console.log(source), // [!code ++] - path: null, // [!code ++] - }, - }, -}; -``` - -## Post Process - -Post-processing allows you to run commands on the generated output folder after files are written. This is typically used to run formatters, linters, or other cleanup tools. - -Commands are executed in order, and each command receives the output path via the `path` placeholder. - -### Presets - -You can use built-in presets for common tools: - -::: code-group - -```js [biome:check] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['biome:check'], // [!code ++] - }, -}; -``` - -```js [biome:format] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['biome:format'], // [!code ++] - }, -}; -``` - -```js [biome:lint] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['biome:lint'], // [!code ++] - }, -}; -``` - -```js [eslint] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['eslint'], // [!code ++] - }, -}; -``` - -```js [oxfmt] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['oxfmt'], // [!code ++] - }, -}; -``` - -```js [oxlint] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['oxlint'], // [!code ++] - }, -}; -``` - -```js [prettier] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: ['prettier'], // [!code ++] - }, -}; -``` - -::: - -### Custom - -You can also provide custom post processors: - - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - postProcess: [{ // [!code ++] - command: 'dprint', // [!code ++] - args: ['fmt', '{{path}}'], // [!code ++] - }], // [!code ++] - }, -}; -``` - - -You can skip processing by adding the output path to the tool's ignore file (for example `.eslintignore` or `.prettierignore`). - -## Name Conflicts - -As your project grows, the chances of name conflicts increase. We use a simple conflict resolver that appends numeric suffixes to duplicate identifiers. If you prefer a different strategy, you can provide your own `nameConflictResolver` function. - -::: code-group - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - nameConflictResolver({ attempt, baseName }) { // [!code ++] - return attempt === 0 ? baseName : `${baseName}_N${attempt + 1}`; // [!code ++] - }, // [!code ++] - path: 'src/client', - }, -}; -``` - - -```ts [example] -export type ChatCompletion = string; - -export type ChatCompletion_N2 = number; -``` - -::: - -## TSConfig Path - -We use the [TSConfig file](https://www.typescriptlang.org/tsconfig/) to generate output matching your project's settings. By default, we attempt to find a TSConfig file starting from the location of the `@hey-api/openapi-ts` configuration file and traversing up. - -::: code-group - -```js [default] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - tsConfigPath: undefined, // [!code ++] - }, -}; -``` - -```js [custom] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - tsConfigPath: './config/tsconfig.custom.json', // [!code ++] - }, -}; -``` - -```js [disabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - tsConfigPath: null, // [!code ++] - }, -}; -``` - -::: - -## Custom Files - -By default, you can't keep custom files in the `path` folder because it's emptied on every run. If you're sure you need to disable this behavior, set `clean` to `false`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - clean: false, // [!code ++] - path: 'src/client', - }, -}; -``` - -::: warning -Setting `clean` to `false` may result in broken output. Ensure you typecheck your code. -::: - - - diff --git a/docs/openapi-ts/configuration/parser.md b/docs/openapi-ts/configuration/parser.md deleted file mode 100644 index 85950a0ac5..0000000000 --- a/docs/openapi-ts/configuration/parser.md +++ /dev/null @@ -1,738 +0,0 @@ ---- -title: Parser -description: Configure @hey-api/openapi-ts. ---- - -# Parser - -We parse your input before making it available to plugins. Configuring the parser is optional, but it provides an ideal opportunity to modify or validate your input as needed. - -## Patch - -Sometimes you need to modify raw input before it's processed further. A common use case is fixing an invalid specification or adding a missing field. For this reason, custom patches are applied before any parsing takes place. - -You can add custom patches with `patch`. - - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - patch: { - schemas: { - Foo: (schema) => { // [!code ++] - // convert date-time format to timestamp // [!code ++] - delete schema.properties.updatedAt.format; // [!code ++] - schema.properties.updatedAt.type = 'number'; // [!code ++] - }, // [!code ++] - Bar: (schema) => { // [!code ++] - // add missing property // [!code ++] - schema.properties.meta = { // [!code ++] - additionalProperties: true, // [!code ++] - type: 'object', // [!code ++] - }; // [!code ++] - schema.required = ['meta']; // [!code ++] - }, // [!code ++] - Baz: (schema) => { // [!code ++] - // remove property // [!code ++] - delete schema.properties.internalField; // [!code ++] - }, // [!code ++] - }, - }, - }, -}; -``` - - -## Validate - -::: warning -The validator feature is very limited. You can help improve it by submitting more [use cases](https://github.com/hey-api/openapi-ts/issues/1970#issuecomment-2933189789). -::: - -If you don't control or trust your input, you might want to validate it. Any detected errors in your input will exit `@hey-api/openapi-ts` and no plugins will be executed. - -To validate your input, set `validate_EXPERIMENTAL` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - validate_EXPERIMENTAL: true, // [!code ++] - }, -}; -``` - -## Filters - -Filters allow you to trim your input before it's processed further, so your output contains only relevant resources. - -### Operations - -Set `include` to match operations to be included or `exclude` to match operations to be excluded. Both exact keys and regular expressions are supported. When both rules match the same operation, `exclude` takes precedence over `include`. - -::: code-group - -```js [include] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - operations: { - include: ['GET /api/v1/foo', '/^[A-Z]+ /api/v1//'], // [!code ++] - }, - }, - }, -}; -``` - -```js [exclude] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - operations: { - exclude: ['GET /api/v1/foo', '/^[A-Z]+ /api/v1//'], // [!code ++] - }, - }, - }, -}; -``` - -::: - -### Tags - -Set `include` to match tags to be included or `exclude` to match tags to be excluded. When both rules match the same tag, `exclude` takes precedence over `include`. - -::: code-group - -```js [include] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - tags: { - include: ['v2'], // [!code ++] - }, - }, - }, -}; -``` - -```js [exclude] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - tags: { - exclude: ['v1'], // [!code ++] - }, - }, - }, -}; -``` - -::: - -### Deprecated - -You can filter out deprecated resources by setting `deprecated` to `false`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - deprecated: false, // [!code ++] - }, - }, -}; -``` - -### Schemas - -Set `include` to match schemas to be included or `exclude` to match schemas to be excluded. Both exact keys and regular expressions are supported. When both rules match the same schema, `exclude` takes precedence over `include`. - -::: code-group - -```js [include] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - schemas: { - include: ['Foo', '/^Bar/'], // [!code ++] - }, - }, - }, -}; -``` - -```js [exclude] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - schemas: { - exclude: ['Foo', '/^Bar/'], // [!code ++] - }, - }, - }, -}; -``` - -::: - -### Parameters - -Set `include` to match parameters to be included or `exclude` to match parameters to be excluded. Both exact keys and regular expressions are supported. When both rules match the same parameter, `exclude` takes precedence over `include`. - -::: code-group - -```js [include] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - parameters: { - include: ['QueryParameter', '/^MyQueryParameter/'], // [!code ++] - }, - }, - }, -}; -``` - -```js [exclude] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - parameters: { - exclude: ['QueryParameter', '/^MyQueryParameter/'], // [!code ++] - }, - }, - }, -}; -``` - -::: - -### Request Bodies - -Set `include` to match request bodies to be included or `exclude` to match request bodies to be excluded. Both exact keys and regular expressions are supported. When both rules match the same request body, `exclude` takes precedence over `include`. - -::: code-group - -```js [include] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - requestBodies: { - include: ['Payload', '/^SpecialPayload/'], // [!code ++] - }, - }, - }, -}; -``` - -```js [exclude] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - requestBodies: { - exclude: ['Payload', '/^SpecialPayload/'], // [!code ++] - }, - }, - }, -}; -``` - -::: - -### Responses - -Set `include` to match responses to be included or `exclude` to match responses to be excluded. Both exact keys and regular expressions are supported. When both rules match the same response, `exclude` takes precedence over `include`. - -::: code-group - -```js [include] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - responses: { - include: ['Foo', '/^Bar/'], // [!code ++] - }, - }, - }, -}; -``` - -```js [exclude] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - responses: { - exclude: ['Foo', '/^Bar/'], // [!code ++] - }, - }, - }, -}; -``` - -::: - -### Orphaned resources - -If you only want to exclude orphaned resources, set `orphans` to `false`. This is the default value when combined with any other filters. If this isn't the desired behavior, you may want to set `orphans` to `true` to always preserve unused resources. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - orphans: false, // [!code ++] - }, - }, -}; -``` - -### Order - -For performance reasons, we don't preserve the original order when filtering out resources. If maintaining the original order is important to you, set `preserveOrder` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - filters: { - preserveOrder: true, // [!code ++] - }, - }, -}; -``` - -## Transforms - -You can think of transforms as deterministic [patches](#patch). They provide an easy way to apply the most commonly used input transformations. - -### Enums - -Your input might contain two types of enums: - -- enums defined as reusable components (root enums) -- non-reusable enums nested within other schemas (inline enums) - -You may want all enums to be reusable. This is because only root enums are typically exported by plugins. Inline enums will never be directly importable since they're nested inside other schemas. - -::: code-group - -```js [root] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - enums: 'root', // [!code ++] - }, - }, -}; -``` - -```js [inline] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - enums: 'inline', // [!code ++] - }, - }, -}; -``` - -::: - -You can customize the naming and casing pattern for `enums` schemas using the `.name` and `.case` options. - -### Properties required by default - -By default, any object schema with a missing `required` keyword is interpreted as "no properties are required." This is the correct behavior according to the OpenAPI standard. However, some specifications interpret a missing `required` keyword as "all properties should be required." - -This option allows you to change the default behavior so that properties are required by default unless explicitly marked as optional. - -::: code-group - -```js [default] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - propertiesRequiredByDefault: false, // [!code ++] - }, - }, -}; -``` - -```js [required] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - propertiesRequiredByDefault: true, // [!code ++] - }, - }, -}; -``` - -::: - -### Read-write - -Your schemas might contain read-only or write-only fields. Using such schemas directly could mean asking the user to provide a read-only field in requests, or expecting a write-only field in responses. We separate schemas for requests and responses if direct usage would result in such scenarios. - -::: code-group - -```js [default] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - readWrite: { - requests: '{{name}}Writable', // [!code ++] - responses: '{{name}}', // [!code ++] - }, - }, - }, -}; -``` - -```js [disabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - readWrite: false, // [!code ++] - }, - }, -}; -``` - -::: - -You can customize the naming and casing pattern for `requests` and `responses` schemas using the `.name` and `.case` options. - -### Schema Name - -Sometimes your schema names are auto-generated or follow a naming convention that produces verbose or awkward type names. You can rename schema component keys throughout the specification, automatically updating all `$ref` pointers. For example, stripping version markers from schema names, removing vendor prefixes, converting naming conventions, or shortening deeply qualified names. - -::: code-group - - -```js [function] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - schemaName: (name) => { // [!code ++] - // Strip version markers: ServiceRoot_v1_20_0_ServiceRoot โ†’ ServiceRoot // [!code ++] - let clean = name.replace(/([A-Za-z\d]+)_v\d+_\d+_\d+_([A-Za-z\d]*)/g, (_, p1, p2) => // [!code ++] - p2.startsWith(p1) ? p2 : p1 + p2, // [!code ++] - ); // [!code ++] - // Deduplicate prefixes: Foo_Foo โ†’ Foo // [!code ++] - const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); // [!code ++] - if (m) clean = m[1] + m[2]; // [!code ++] - return clean; // [!code ++] - }, // [!code ++] - }, - }, -}; -``` - - -```js [template] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - transforms: { - schemaName: 'Api{{name}}', // [!code ++] - }, - }, -}; -``` - -::: - -::: tip Name Collisions -If a transformed schema name conflicts with an existing schema, the rename is skipped for that schema to prevent overwrites. The original name is preserved. -::: - -## Pagination - -Paginated operations are detected by having a pagination keyword in its parameters or request body. By default, we consider the following to be pagination keywords: `after`, `before`, `cursor`, `offset`, `page`, and `start`. - -You can provide custom pagination keywords using `pagination.keywords`. - -::: code-group - -```js [extend] -import { defaultPaginationKeywords } from '@hey-api/openapi-ts'; - -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - pagination: { - keywords: [ - ...defaultPaginationKeywords, // [!code ++] - 'extra', // [!code ++] - 'pagination', // [!code ++] - 'keywords', // [!code ++] - ], - }, - }, -}; -``` - -```js [override] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - pagination: { - keywords: [ - 'custom', // [!code ++] - 'pagination', // [!code ++] - 'keywords', // [!code ++] - ], - }, - }, -}; -``` - -::: - -## Hooks - -Hooks affect runtime behavior but aren't tied to any single plugin. They can be configured globally via `hooks` or per plugin through the `~hooks` property. - -::: code-group - -```js [parser] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - hooks: {}, // configure global hooks // [!code ++] - }, -}; -``` - -```js [plugin] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@tanstack/react-query', - '~hooks': {}, // configure plugin hooks // [!code ++] - }, - ], -}; -``` - -::: - -We always use the first hook that returns a value. If a hook returns no value, we fall back to less specific hooks until one does. - -### Operations {#hooks-operations} - -Each operation has a list of classifiers that can include `query`, `mutation`, both, or none. Plugins may use these values to decide whether to generate specific output. For example, you usually don't want to generate [TanStack Query options](/openapi-ts/plugins/tanstack-query#queries) for PATCH operations. - -#### Query operations {#hooks-query-operations} - -By default, GET operations are classified as `query` operations. - -#### Mutation operations {#hooks-mutation-operations} - -By default, DELETE, PATCH, POST, and PUT operations are classified as `mutation` operations. - -#### Example: POST search query - -Imagine your API has a POST `/search` endpoint that accepts a large payload. By default, it's classified as a `mutation`, but in practice it behaves like a `query`, and your [state management](/openapi-ts/state-management) plugin should generate query hooks. - -You can achieve this by classifying the operation as `query` in a matcher. - -::: code-group - - -```js [isQuery] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - hooks: { - operations: { - isQuery: (op) => { - if (op.method === 'post' && op.path === '/search') { // [!code ++] - return true; // [!code ++] - } // [!code ++] - }, - }, - }, - }, -}; -``` - - -```js [getKind] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - hooks: { - operations: { - getKind: (op) => { - if (op.method === 'post' && op.path === '/search') { // [!code ++] - return ['query']; // [!code ++] - } // [!code ++] - }, - }, - }, - }, -}; -``` - - -::: - -### Symbols {#hooks-symbols} - -Each symbol can have a placement function deciding its output location. - -#### Example: Alphabetic sort - -While we work on a better example, let's imagine a world where it's desirable to place every symbol in a file named after its initial letter. For example, a function named `Foo` should end up in the file `f.ts`. - -You can achieve this by using the symbol's name. - - -```js [getKind] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - hooks: { - symbols: { - getFilePath: (symbol) => { // [!code ++] - if (symbol.name) { // [!code ++] - return symbol.name[0]?.toLowerCase(); // [!code ++] - } // [!code ++] - }, // [!code ++] - }, - }, - }, -}; -``` - - -Most plugins expose configuration options that allow you to rename many of the generated symbols. If you need even more control, use the `getName()` hook. - -#### Example: Enum naming - -By default, generated enums use the same name for both the type and the runtime value. - -::: code-group - -```ts [example] -export const Flags = { - ALPHA: 'alpha', - BETA: 'beta', -} as const; - -export type Flags = (typeof Flags)[keyof typeof Flags]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - enums: 'javascript', - name: '@hey-api/typescript', - }, - ], -}; -``` - -::: - -While this code works perfectly fine due to TypeScript's declaration merging, let's say we want to use a different name for the type. We can accomplish this with the `getName()` hook. - -::: code-group - -```ts [example] -export const Flags = { - ALPHA: 'alpha', - BETA: 'beta', -} as const; - -export type FlagsType = (typeof Flags)[keyof typeof Flags]; // [!code ++] -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - enums: 'javascript', - name: '@hey-api/typescript', - '~hooks': { - symbols: { - getName({ meta, name, schema }) { // [!code ++] - if (schema?.type === 'enum' && meta.category === 'type') { // [!code ++] - return `${name}Type`; // [!code ++] - } // [!code ++] - }, // [!code ++] - }, - }, - }, - ], -}; -``` - - -::: - - - diff --git a/docs/openapi-ts/configuration/vite.md b/docs/openapi-ts/configuration/vite.md deleted file mode 100644 index 8e48a277cd..0000000000 --- a/docs/openapi-ts/configuration/vite.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: Vite Plugin -description: Integrate @hey-api/openapi-ts into your Vite 5, 6, 7, or 8 build pipeline with the official Vite plugin. ---- - -# Vite - -### About - -[Vite](https://vite.dev) is a blazing fast frontend build tool powering the next generation of web applications. - -The Vite plugin integrates `@hey-api/openapi-ts` into the Vite build pipeline, running automatically whenever Vite resolves its configuration โ€“ no separate script or manual step required. - -## Features - -- runs automatically as part of your Vite build -- reads your existing [configuration](/openapi-ts/get-started) (or accepts inline config) -- supports Vite 5, 6, 7, and 8 - -## Installation - -You can download `@hey-api/vite-plugin` from npm using your favorite package manager. - -::: code-group - -```sh [npm] -npm install @hey-api/vite-plugin -D -E -``` - -```sh [pnpm] -pnpm add @hey-api/vite-plugin -D -E -``` - -```sh [yarn] -yarn add @hey-api/vite-plugin -D -E -``` - -```sh [bun] -bun add @hey-api/vite-plugin -D -``` - -::: - -## Usage - -Add the plugin to your `vite.config.ts`: - -::: code-group - -```ts [vite.config.ts] -import { heyApiPlugin } from '@hey-api/vite-plugin'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [heyApiPlugin()], -}); -``` - -::: - -The plugin will automatically pick up your [configuration](/openapi-ts/configuration) file. You can also pass options inline using the `config` option: - -::: code-group - -```js [vite.config.ts] -import { heyApiPlugin } from '@hey-api/vite-plugin'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [ - heyApiPlugin({ - config: { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - }, - }), - ], -}); -``` - -::: - -## Vite Options - -You can pass Vite Plugin API options using the `vite` option. For example, to run the plugin only during development: - -::: code-group - -```js [vite.config.ts] -import { heyApiPlugin } from '@hey-api/vite-plugin'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [ - heyApiPlugin({ - config: { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - }, - vite: { - apply: 'serve', - }, - }), - ], -}); -``` - -::: - - - diff --git a/docs/openapi-ts/core.md b/docs/openapi-ts/core.md deleted file mode 100644 index 6bfc69e414..0000000000 --- a/docs/openapi-ts/core.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: Core Plugins -description: Learn about the core plugins provided by Hey API. ---- - -# Core - -Apart from being responsible for the default output, core plugins are the foundation for other plugins. Instead of creating their own primitives, other plugins can reuse the artifacts from core plugins. This results in a smaller output size and a better user experience. - -## Options - -Hey API provides the following core plugins. - -- [TypeScript](/openapi-ts/plugins/typescript) -- [SDK](/openapi-ts/plugins/sdk) -- [Transformers](/openapi-ts/plugins/transformers) -- [Schemas](/openapi-ts/plugins/schemas) - -Need another core plugin? Let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues). - - - diff --git a/docs/openapi-ts/get-started.md b/docs/openapi-ts/get-started.md deleted file mode 100644 index d019fa646c..0000000000 --- a/docs/openapi-ts/get-started.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -title: Get Started -description: Get started with @hey-api/openapi-ts. ---- - - - -# Get Started - -[@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) generates TypeScript code from OpenAPI specifications. Point it at your spec, pick your plugins, and get production-grade code in seconds. - -Used by companies like Vercel, OpenCode, and PayPal. - -> _โ€œOpenAPI codegen that just works.โ€_ -> -> โ€” Guillermo Rauch, CEO of Vercel - -### Demo - - - -## Features - -- production-grade code that compiles -- runs in any Node.js 22+ environment -- accepts any OpenAPI specification -- core plugins for SDKs, types, and schemas -- HTTP clients for Fetch API, Angular, Axios, Next.js, Nuxt, and more -- 20+ plugins to reduce third-party boilerplate -- highly customizable via plugins -- [sync with Hey API Registry](/openapi-ts/integrations) for spec management - -## Quick Start - -The fastest way to use `@hey-api/openapi-ts` is via npx - -```sh -npx @hey-api/openapi-ts -i hey-api/backend -o src/client -``` - -Congratulations on creating your first client! ๐ŸŽ‰ You can learn more about the generated files on the [Output](/openapi-ts/output) page. - -## Installation - -You can download `@hey-api/openapi-ts` from npm using your favorite package manager. - -::: code-group - -```sh [npm] -npm install @hey-api/openapi-ts -D -E -``` - -```sh [pnpm] -pnpm add @hey-api/openapi-ts -D -E -``` - -```sh [yarn] -yarn add @hey-api/openapi-ts -D -E -``` - -```sh [bun] -bun add @hey-api/openapi-ts -D -``` - -::: - -### Versioning - -This package is in [initial development](https://semver.org/#spec-item-4). Please pin an exact version so you can safely upgrade when you're ready. - -We publish [migration notes](/openapi-ts/migrating) for every breaking release. You might not be impacted by a breaking change if you don't use the affected features. - -## Usage - -### CLI - -Most people run `@hey-api/openapi-ts` via CLI. To do that, add a script to your `package.json` file which will make `openapi-ts` executable through script. - -```json -"scripts": { - "openapi-ts": "openapi-ts" -} -``` - -The above script can be executed by running `npm run openapi-ts` or equivalent command in other package managers. Next, we will create a [configuration](/openapi-ts/configuration) file and move our options from Quick Start to it. - -### Node.js - -You can also generate output programmatically by calling `createClient()` in a JavaScript/TypeScript file. - -::: code-group - -```ts [script.ts] -import { createClient } from '@hey-api/openapi-ts'; - -createClient({ - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}); -``` - -::: - -### Vite - -If you're using [Vite](https://vite.dev) 5, 6, 7, or 8, you can integrate `@hey-api/openapi-ts` directly into your build pipeline with `@hey-api/vite-plugin`. Install it alongside the main package: - -::: code-group - -```sh [npm] -npm install @hey-api/vite-plugin -D -E -``` - -```sh [pnpm] -pnpm add @hey-api/vite-plugin -D -E -``` - -```sh [yarn] -yarn add @hey-api/vite-plugin -D -E -``` - -```sh [bun] -bun add @hey-api/vite-plugin -D -``` - -::: - -Then add the plugin to your Vite configuration: - -::: code-group - -```ts [vite.config.ts] -import { heyApiPlugin } from '@hey-api/vite-plugin'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [ - heyApiPlugin({ - config: { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - }, - }), - ], -}); -``` - -::: - -See the [Vite](/openapi-ts/configuration/vite) page for full configuration options. - -### Configuration - -It's a good practice to extract your configuration into a separate file. Learn how to do that and discover available options on the [Configuration](/openapi-ts/configuration) page. - - - diff --git a/docs/openapi-ts/integrations.md b/docs/openapi-ts/integrations.md deleted file mode 100644 index dc21c60cef..0000000000 --- a/docs/openapi-ts/integrations.md +++ /dev/null @@ -1,194 +0,0 @@ ---- -title: Hey API Platform -description: Automate your client generation with our OpenAPI specifications storage. ---- - -# Hey API Platform - -::: warning -This feature is in development! :tada: Try it out and provide feedback on [GitHub](https://github.com/orgs/hey-api/discussions/1773). -::: - -You can automate your client generation with Hey API Platform thanks to reproducible builds. Create dependency links between your clients and APIs, and watch the magic unfold. It's completely language and codegen agnostic. - -## Features - -- API version history -- real-time updates -- reproducible builds -- language and codegen agnostic (TypeScript/Python/Go/Java/etc codegens are welcome) - -## Upload Specifications - -Before you can generate clients, you must publish your OpenAPI specifications to Hey API. - -### Prerequisites - -1. Create a **free account** with [Hey API](https://app.heyapi.dev). -1. Create a new **organization** and **project** for your API provider. We recommend your naming matches your GitHub structure as it will be referenced by API clients. For example, we are using **hey-api/backend** for the platform. -1. Inside your project, go to _Integrations_ > _APIs_ and generate an **API key**. Keep this value secret, it will be used to upload files. - -### Add GitHub CI workflow - -Once you have your API key, you can start uploading OpenAPI specifications on every API build. We'll use our [GitHub Action](https://github.com/marketplace/actions/upload-openapi-spec-by-hey-api), but you can also make the API call manually if you're not using GitHub. - -Create a new GitHub workflow or add an upload step to an existing workflow inside your API codebase. The example below will upload your OpenAPI specification to Hey API on every pull request and push to the `main` branch. - -```yaml -name: Upload OpenAPI Specification - -on: - push: - branches: - - main - pull_request: - -jobs: - upload-openapi-spec: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Upload OpenAPI spec - uses: hey-api/upload-openapi-spec@v1.3.0 - with: - path-to-file: path/to/openapi.json - tags: optional,custom,tags - env: - API_KEY: ${{ secrets.HEY_API_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -``` - -### Inputs - -To successfully upload an OpenAPI specification, you need to provide the following inputs (see `with` in the example above) - -#### `path-to-file` - -A relative path to your OpenAPI file within the repository. Note that you might need an additional step in your GitHub workflow to generate this file (see [FastAPI example](https://fastapi.tiangolo.com/how-to/extending-openapi/#generate-the-openapi-schema)). - -#### `tags` (optional) - -A comma-separated string value representing any custom tags you wish to add to your OpenAPI specification. - -### Environment Variables - -In addition to the required `path-to-file` input, you must provide the following environment variables. - -#### `API_KEY` - -This is the project API key you obtained from [Hey API](https://app.heyapi.dev). - -::: warning -Personal API keys can't be used to upload specifications. -::: - -#### `GITHUB_TOKEN` - -This variable will be available inside your workflow by default. It's used to -fetch information about your repository, i.e., default branch. - -## Generate Clients - -You can generate clients from public projects or any private projects you can access. The setup is largely the same, you want to configure the input path used by your codegen. - -::: code-group - -```sh [Hey API] -npx @hey-api/openapi-ts -i hey-api/backend -o src/client -``` - -```sh [OpenAPI TypeScript] -npx openapi-typescript \ - https://get.heyapi.dev/hey-api/backend \ - -o schema.ts -``` - -```sh [Orval] -npx orval \ - --input https://get.heyapi.dev/hey-api/backend \ - --output ./src/client.ts -``` - -```sh [Other] -other-cli \ - --input https://get.heyapi.dev/hey-api/backend \ # [!code ++] - --output refer/to/other/tools/docs -``` - -::: - -By default, we preserve the current behavior and return the latest specification. Let's have a closer look at the input path and change that. - -## Get API - -As you can deduce from the examples above, the default command for fetching OpenAPI specifications looks like this. - -``` -https://get.heyapi.dev// -``` - -If you created an organization `foo` with project `bar` earlier, your URL would look like this. - -``` -https://get.heyapi.dev/foo/bar -``` - -### Auth - -Projects are private by default, you will need to be authenticated to download OpenAPI specifications. We recommend using [project API keys](#prerequisites) in CI workflows and [personal API keys](https://app.heyapi.dev/settings/user/apis) for local development. - -Once you have your API key, you can authenticate the request using the `Authorization` header or `api_key` query parameter. - -``` -https://get.heyapi.dev/foo/bar?api_key= -``` - -Congratulations on fetching your first OpenAPI specification! ๐ŸŽ‰ - -### Filters - -The default behavior returns the last uploaded specification. This might not be what you want. You can use a range of filters to narrow down the possible specifications, or pin your builds to an exact version. - -#### `branch` - -You can fetch the last build from branch by providing the `branch` query parameter. - -``` -https://get.heyapi.dev/foo/bar?branch=production -``` - -#### `commit_sha` - -You can fetch an exact specification by providing the `commit_sha` query parameter. This will always return the same file. - -``` -https://get.heyapi.dev/foo/bar?commit_sha=0eb34c2024841ce95620f3ec02a2fea164ea4e9d -``` - -#### `tags` - -If you're tagging your specifications with [custom tags](#tags-optional), you can use them to filter the results. When you provide multiple tags, only the first match will be returned. - -``` -https://get.heyapi.dev/foo/bar?tags=optional,custom,tags -``` - -#### `version` - -Every OpenAPI document contains a required version field. You can use this value to fetch the last uploaded specification matching the value. - -``` -https://get.heyapi.dev/foo/bar?version=1.0.0 -``` - -## Feedback - -We'd love your feedback! You can contact us on social media (search Hey API), [email](mailto:lubos@heyapi.dev), or [GitHub](https://github.com/orgs/hey-api/discussions/1773). - -## Pricing - -The platform is currently in beta with our focus being on delivering a great experience. We plan to announce pricing once we have gathered enough data around usage patterns. However, we can guarantee there will always be a free plan available. Our mission to bring the finest tooling for working with APIs remains unchanged. - - diff --git a/docs/openapi-ts/license.md b/docs/openapi-ts/license.md deleted file mode 100644 index 0da8b3e324..0000000000 --- a/docs/openapi-ts/license.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: License -description: License FAQ. ---- - -# License - -### MIT License - -Copyright (c) Hey API - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/docs/openapi-ts/migrating.md b/docs/openapi-ts/migrating.md deleted file mode 100644 index d22932362b..0000000000 --- a/docs/openapi-ts/migrating.md +++ /dev/null @@ -1,1642 +0,0 @@ ---- -title: Migrating -description: Migrating to @hey-api/openapi-ts. ---- - -# Migrating - -While we try to avoid breaking changes, sometimes it's unavoidable in order to offer you the latest features. This page lists changes that require updates to your code. If you run into a problem with migration, please [open an issue](https://github.com/hey-api/openapi-ts/issues). - -## v0.97.0 - -### Changed `runtimeConfigPath` behavior - -This was a known, long-standing issue confusing first-time users. Before, defining client `runtimeConfigPath` value would paste it verbatim to the generated output. This release changes the behavior to resolve relative to the output folder. - -### Changed Ky client behavior - -The Ky client was updated to be more intuitive. Some Ky options now need to be passed via the `kyOptions` field and you need to pass `undefined` to unset an option. - -### Changed error interceptors behavior - -Error interceptors now receive the result of the previous error interceptor. This aligns their behavior with request and response interceptors. This change only affects you if you use multiple interceptors. - -### Optional client request and response - -The returned request and response objects are now typed as optional. This aligns the types with the actual runtime behavior, which remains unchanged. - -### Respect `throwOnError` option - -Previously, there were instances where setting `throwOnError` to `false` would still throw an error. This most commonly happened when request validation failed. With this change, `throwOnError` is now truly respected. - -## v0.96.0 - -### Removed Node 20 support - -This release bumps the minimum required Node version to 22.13. - -## v0.95.0 - -### Validator request schemas - -Valibot and Zod plugins no longer export composite request `Data` schemas. Instead, each layer is exported as a separate schema. If you're using validators with SDKs, you can preserve the composite schema with `shouldExtract`: - -::: code-group - - -```js [Zod] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'sdk', - validator: 'zod', - }, - { - name: 'zod', - requests: { // [!code ++] - shouldExtract: true, // [!code ++] - }, // [!code ++] - }, - ], -}; -``` - - -```js [Valibot] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'sdk', - validator: 'valibot', - }, - { - name: 'valibot', - requests: { // [!code ++] - shouldExtract: true, // [!code ++] - }, // [!code ++] - }, - ], -}; -``` - - -::: - -### Removed `plugin.getSymbol()` function - -This function has been removed. You can use `plugin.querySymbol()` instead. It accepts the same arguments and returns the same result. - -## v0.93.0 - -### Removed resolver node - -Valibot and Zod plugins no longer expose the `enum.nodes.nullable` node. Both plugins were refactored so that nullable values are handled outside of resolvers. - -## v0.92.0 - -### Updated Symbol interface - -The `exportFrom` property has been replaced with the `getExportFromFilePath()` function. This allows you to dynamically determine export paths based on symbol properties. This is a low-level feature, so you're most likely unaffected. - -## v0.91.0 - -### Removed CommonJS (CJS) support - -`@hey-api/openapi-ts` is now ESM-only. This change simplifies the codebase, improves tree-shaking, and enables better integration with modern bundlers and TypeScript tooling. - -CommonJS entry points (`require()`, `module.exports`) are no longer supported. If you are in a CJS environment, you can still load the package dynamically using `import()` like: - -```js -const { defineConfig } = await import('@hey-api/openapi-ts'); -``` - -If you have previously written: - -```js -const { defineConfig } = require('@hey-api/openapi-ts'); -``` - -Migrate by updating your static imports: - -```js -import { defineConfig } from '@hey-api/openapi-ts'; -``` - -If your environment cannot use ESM, pin to a previous version. - -## v0.90.0 - -### Resolvers API - -The [Resolvers API](/openapi-ts/plugins/concepts/resolvers) has been simplified and expanded to provide a more consistent behavior across plugins. You can view a few common examples on the [Resolvers](/openapi-ts/plugins/concepts/resolvers) page. - -### Structure API - -The [SDK plugin](/openapi-ts/plugins/sdk) and [Angular plugin](/openapi-ts/plugins/angular) now implement the Structure API, enabling more complex structures and fixing several known issues. - -Some Structure APIs are incompatible with the previous configuration, most notably the `methodNameBuilder` function, which accepted the operation object as an argument. You can read the [SDK Output](/openapi-ts/plugins/sdk#output) section to familiarize yourself with the Structure API. - -Please [open an issue](https://github.com/hey-api/openapi-ts/issues) if you're unable to migrate your configuration to the new syntax. - -## v0.89.0 - -### Prefer named exports - -This release changes the default for `index.ts` to prefer named exports. Named exports may lead to better IDE and bundler performance compared to asterisk (`*`) as your tooling doesn't have to inspect the underlying module to discover exports. - -While this change is merely cosmetic, you can set `output.preferExportAll` to `true` if you prefer to use the asterisk. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - preferExportAll: true, // [!code ++] - }, -}; -``` - -### Removed `symbol:setValue:*` events - -These events have been removed in favor of `node:set:*` events. - -## v0.88.0 - -### Removed `compiler` and `tsc` exports - -This release removes the `compiler` utility functions. Instead, it introduces a new TypeScript DSL exposed under the `$` symbol. All plugins now use this interface, so you may notice slight changes in the generated output. - -## v0.87.0 - -### Removed legacy clients - -This release removes support for legacy clients and plugins. Please migrate to the new clients if you haven't done so yet. If you're unable to do so due to a missing feature, let us know on [GitHub](https://github.com/hey-api/openapi-ts/issues). - -## v0.86.0 - -### Removed Node 18 support - -This release bumps the minimum required Node version to 20.19. - -## v0.85.0 - -### Updated `output` options - -We made the `output` configuration more consistent by using `null` to represent disabled options. This change does not affect boolean options. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - format: false, // [!code --] - format: null, // [!code ++] - lint: false, // [!code --] - lint: null, // [!code ++] - path: 'src/client', - tsConfigPath: 'off', // [!code --] - tsConfigPath: null, // [!code ++] - }, -}; -``` - -### Updated Pinia Colada query options - -Pinia Colada query options now use `defineQueryOptions` to improve reactivity support. Instead of calling the query options function, you can use one of the following approaches. - -::: code-group - -```ts [no params] -useQuery(getPetsQuery); -``` - -```ts [constant] -useQuery(getPetByIdQuery, () => ({ - path: { - petId: 1, - }, -})); -``` - -```ts [reactive] -const petId = ref(1); - -useQuery(getPetByIdQuery, () => ({ - path: { - petId: petId.value, - }, -})); -``` - -```ts [properties] -const petId = ref(1); - -useQuery(() => ({ - ...getPetByIdQuery({ - path: { petId: petId.value as number }, - }), - enabled: () => petId.value !== null, -})); -``` - -::: - -## v0.84.0 - -### Symbol API - -This release improves the Symbol API, which adds the capability to place symbols in arbitrary files. We preserved the previous output structure for all plugins except Angular. - -You can preserve the previous Angular output by writing your own [placement function](/openapi-ts/configuration/parser#hooks-symbols). - -### TypeScript renderer - -We ship a dedicated TypeScript renderer for `.ts` files. This release improves the renderer's ability to group and sort imported modules, resulting in a more polished output. - -### Removed `output` plugin option - -Due to the Symbol API release, this option has been removed from the Plugin API. - -## v0.83.0 - -### Symbol API - -This release adds the Symbol API, which significantly reduces the risk of naming collisions. While the generated output should only include formatting changes, this feature introduces breaking changes to the Plugin API that affect custom plugins. - -We will update the [custom plugin guide](/openapi-ts/plugins/custom) once the Plugin API becomes more stable. - -### Removed `groupByTag` Pinia Colada option - -This option has been removed to provide a more consistent API across plugins. We plan to bring it back in a future release. - -## v0.82.0 - -### Hooks API - -This release adds the [Hooks API](/openapi-ts/configuration/parser#hooks), giving you granular control over which operations generate queries and mutations. As a result, we tightened the previous behavior and POST operations no longer generate queries by default. To preserve the old behavior, add a custom matcher. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - parser: { - hooks: { - operations: { - isQuery: (op) => (op.method === 'post' ? true : undefined), // [!code ++] - }, - }, - }, -}; -``` - -## v0.81.0 - -### Server-Sent Events (SSE) - -This release adds support for server-sent events (SSE). Instead of treating `text/event-stream` content types as regular HTTP methods, we now generate SSE streams. In practice, you will want to update your affected endpoints to process streamed events. - -::: code-group - -```js [before] -const { data } = await foo(); -console.log(data.type); -``` - -```js [after] -const { stream } = await foo(); -for await (const event of stream) { - console.log(event.type); -} -``` - -::: - -## v0.80.0 - -### Added Zod 4 and Zod Mini - -This release adds support for Zod 4 and Zod Mini. By default, the `zod` plugin will generate output for Zod 4. If you want to preserve the previous output for Zod 3 or use Zod Mini, set `compatibilityVersion` to `3` or `mini`. - -::: code-group - -```js [Zod 3] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, // [!code ++] - }, - ], -}; -``` - -```js [Zod Mini] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', // [!code ++] - }, - ], -}; -``` - -::: - -## v0.79.0 - -### Removed `typescript+namespace` enums mode - -Due to a simpler TypeScript plugin implementation, the `typescript+namespace` enums mode is no longer necessary. This mode was used in the past to group inline enums under the same namespace. With the latest changes, this behavior is no longer supported. You can either choose to ignore inline enums (default), or use the `enums` transform (added in v0.78.0) to convert them into reusable components which will get exported as usual. - -## v0.78.0 - -### Added `parser` options - -Previously, `@hey-api/typescript` would generate correct types, but the validator plugins would have to re-implement the same logic or generate schemas that didn't match the generated types. - -Since neither option was ideal, this release adds a dedicated place for `parser` options. Parser is responsible for preparing the input so plugins can generate more accurate output with less effort. - -You can learn more about configuring parser on the [Parser](/openapi-ts/configuration/parser) page. - -### Moved `input` options - -The following options were moved to the new `parser` group. - -- `input.filters` moved to `parser.filters` -- `input.pagination` moved to `parser.pagination` -- `input.patch` moved to `parser.patch` -- `input.validate_EXPERIMENTAL` moved to `parser.validate_EXPERIMENTAL` - -### Updated `typescript` options - -The following options were renamed. - -- `enumsCase` moved to `enums.case` -- `enumsConstantsIgnoreNull` moved to `enums.constantsIgnoreNull` - -### Moved `typescript` options - -The following options were moved to the new `parser` group. - -- `exportInlineEnums` moved to `parser.transforms.enums` -- `readOnlyWriteOnlyBehavior` moved to `parser.transforms.readWrite.enabled` -- `readableNameBuilder` moved to `parser.transforms.readWrite.responses.name` -- `writableNameBuilder` moved to `parser.transforms.readWrite.requests.name` - -### Updated `readWrite.responses` name - -Additionally, the naming pattern for response schemas has changed from `{name}Readable` to `{name}`. This is to prevent your code from breaking by default when using a schema that gets updated with a write-only field. - -## v0.77.0 - -### Updated `sdk.validator` option - -Clients can now validate both request and response data. As a result, passing a boolean or string to `validator` will control both of these options. To preserve the previous behavior, set `validator.request` to `false` and `validator.response` to your previous configuration. - - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - validator: true, // [!code --] - validator: { // [!code ++] - request: false, // [!code ++] - response: true, // [!code ++] - }, // [!code ++] - }, - ], -}; -``` - - -### Updated Plugin API - -Please refer to the [custom plugin](/openapi-ts/plugins/custom) tutorial for the latest guide. - -## v0.76.0 - -### Single Valibot schema per request - -Previously, we generated a separate schema for each endpoint parameter and request body. In v0.76.0, a single request schema is generated for the whole endpoint. It may contain a request body, parameters, and headers. - -```ts -const vData = v.object({ - body: v.optional( - v.object({ - foo: v.optional(v.string()), - bar: v.optional(v.union([v.number(), v.null()])), - }), - ), - headers: v.optional(v.never()), - path: v.object({ - baz: v.string(), - }), - query: v.optional(v.never()), -}); -``` - -If you need to access individual fields, you can do so using the [`.entries`](https://valibot.dev/api/object/) API. For example, we can get the request body schema with `vData.entries.body`. - -## v0.75.0 - -### Updated TanStack Query options - -The TanStack Query plugin options have been expanded to support more naming and casing patterns. As a result, the following options have been renamed. - -- `queryOptionsNameBuilder` renamed to `queryOptions` -- `infiniteQueryOptionsNameBuilder` renamed to `infiniteQueryOptions` -- `mutationOptionsNameBuilder` renamed to `mutationOptions` -- `queryKeyNameBuilder` renamed to `queryKeys` -- `infiniteQueryKeyNameBuilder` renamed to `infiniteQueryKeys` - -### Added `plugin.forEach()` method - -This method replaces the `.subscribe()` method. Additionally, `.forEach()` is executed immediately, which means we don't need the `before` and `after` events โ€“ simply move your code before and after the `.forEach()` block. - -```ts -plugin.subscribe('operation', (event) => { // [!code --] - // do something with event // [!code --] -}); // [!code --] -plugin.subscribe('schema', (event) => { // [!code --] -plugin.forEach('operation', 'schema', (event) => { // [!code ++] - // do something with event -}); -``` - -## v0.74.0 - -### Single Zod schema per request - -Previously, we generated a separate schema for each endpoint parameter and request body. In v0.74.0, a single request schema is generated for the whole endpoint. It may contain a request body, parameters, and headers. - -```ts -const zData = z.object({ - body: z - .object({ - foo: z.string().optional(), - bar: z.union([z.number(), z.null()]).optional(), - }) - .optional(), - headers: z.never().optional(), - path: z.object({ - baz: z.string(), - }), - query: z.never().optional(), -}); -``` - -If you need to access individual fields, you can do so using the [`.shape`](https://zod.dev/api?id=shape) API. For example, we can get the request body schema with `zData.shape.body`. - -## v0.73.0 - -### Bundle `@hey-api/client-*` plugins - -In previous releases, you had to install a separate client package to generate a fully working output, e.g., `npm install @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`. - -```sh -npm uninstall @hey-api/client-fetch -``` - -## v0.72.0 - -### Added `sdk.classStructure` option - -When generating class-based SDKs, we now try to infer the ideal structure using `operationId` keywords. If you'd like to preserve the previous behavior, set `classStructure` to `off`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - classStructure: 'off', // [!code ++] - name: '@hey-api/sdk', - }, - ], -}; -``` - -## v0.71.0 - -### Renamed `sdk.serviceNameBuilder` option - -This option has been renamed to `sdk.classNameBuilder` to better represent its functionality. Additionally, it's no longer set by default. To preserve the previous behavior, update your configuration. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - classNameBuilder: '{{name}}Service', // [!code ++] - name: '@hey-api/sdk', - serviceNameBuilder: '{{name}}Service', // [!code --] - }, - ], -}; -``` - -## v0.68.0 - -### Upgraded input filters - -Input filters now avoid generating invalid output without requiring you to specify every missing schema as in the previous releases. As part of this release, we changed the way filters are configured and removed the support for regular expressions. Let us know if regular expressions are still useful for you and want to bring them back! - -::: code-group - -```js [include] -export default { - input: { - // match only the schema named `foo` and `GET` operation for the `/api/v1/foo` path - filters: { - operations: { - include: ['GET /api/v1/foo'], // [!code ++] - }, - schemas: { - include: ['foo'], // [!code ++] - }, - }, - include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code --] - path: 'hey-api/backend', // sign up at app.heyapi.dev - }, - output: 'src/client', - plugins: ['@hey-api/client-fetch'], -}; -``` - -```js [exclude] -export default { - input: { - // match everything except for the schema named `foo` and `GET` operation for the `/api/v1/foo` path - exclude: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code --] - filters: { - operations: { - exclude: ['GET /api/v1/foo'], // [!code ++] - }, - schemas: { - exclude: ['foo'], // [!code ++] - }, - }, - path: 'hey-api/backend', // sign up at app.heyapi.dev - }, - output: 'src/client', - plugins: ['@hey-api/client-fetch'], -}; -``` - -::: - -## v0.67.0 - -### Respecting `moduleResolution` value in `tsconfig.json` - -This release introduces functionality related to your `tsconfig.json` file. The initial feature properly respects the value of your `moduleResolution` field. If you're using `nodenext`, the relative module paths in your output will be appended with `.js`. To preserve the previous behavior where we never appended `.js` to relative module paths, set `output.tsConfigPath` to `off`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - path: 'src/client', - tsConfigPath: 'off', // [!code ++] - }, -}; -``` - -## v0.66.0 - -### Read-only and write-only fields - -Starting with v0.66.0, `@hey-api/typescript` will generate separate types for payloads and responses if it detects any read-only or write-only fields. To preserve the previous behavior and generate a single type regardless, set `readOnlyWriteOnlyBehavior` to `off`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/typescript', - readOnlyWriteOnlyBehavior: 'off', // [!code ++] - }, - ], -}; -``` - -## v0.64.0 - -### Added `ClientOptions` interface - -The `Config` interface now accepts an optional generic extending `ClientOptions` instead of `boolean` type `ThrowOnError`. - -```ts -type Foo = Config; // [!code --] -type Foo = Config<{ throwOnError: false }>; // [!code ++] -``` - -### Added `client.baseUrl` option - -You can use this option to configure the default base URL for the generated client. By default, we will attempt to resolve the first defined server or infer the base URL from the input path. If you'd like to preserve the previous behavior, set `baseUrl` to `false`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - baseUrl: false, // [!code ++] - name: '@hey-api/client-fetch', - }, - ], -}; -``` - -## v0.63.0 - -### Client plugins - -Clients are now plugins generating their own `client.gen.ts` file. There's no migration needed if you're using CLI. If you're using the configuration file, move `client` options to `plugins`. - -```js -export default { - client: '@hey-api/client-fetch', // [!code --] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: ['@hey-api/client-fetch'], // [!code ++] -}; -``` - -### Added `client.gen.ts` file - -Related to above, the internal `client` instance previously located in `sdk.gen.ts` is now defined in `client.gen.ts`. If you're importing it in your code, update the import module. - -```js -import { client } from 'client/sdk.gen'; // [!code --] -import { client } from 'client/client.gen'; // [!code ++] -``` - -### Moved `sdk.throwOnError` option - -This SDK configuration option has been moved to the client plugins where applicable. Not every client can be configured to throw on error, so it didn't make sense to expose the option when it didn't have any effect. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - { - name: '@hey-api/client-fetch', - throwOnError: true, // [!code ++] - }, - { - name: '@hey-api/sdk', - throwOnError: true, // [!code --] - }, - ], -}; -``` - -## v0.62.0 - -### Changed parser - -Formerly known as the experimental parser, this is now the default parser. This change should not impact the generated output's functionality. However, there might be cases where this results in breaking changes due to different handling of certain scenarios. If you need to revert to the legacy parser, set the `experimentalParser` flag to `false`. - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: false, // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -Note that the legacy parser is no longer supported and will be removed in the v1 release. - -## v0.61.0 - -### Added `auth` option - -Client package functions `accessToken` and `apiKey` were replaced with a single `auth` function for fetching auth tokens. If your API supports multiple auth mechanisms, you can use the `auth` argument to return the appropriate token. - -```js -import { client } from 'client/sdk.gen'; - -client.setConfig({ - accessToken: () => '', // [!code --] - apiKey: () => '', // [!code --] - auth: (auth) => '', // [!code ++] -}); -``` - -Due to conflict with the Axios native `auth` option, we removed support for configuring Axios auth. Please let us know if you require this feature added back. - -### Added `watch` option - -While this is a new feature, supporting it involved replacing the `@apidevtools/json-schema-ref-parser` dependency with our own implementation. Since this was a big change, we're applying caution and marking this as a breaking change. - -### Changed `parseAs: 'auto'` behavior - -The Fetch API client will return raw response body as `ReadableStream` when `Content-Type` response header is undefined and `parseAs` is `auto`. - -## v0.60.0 - -### Added `sdk.transformer` option - -When generating SDKs, you now have to specify `transformer` in order to modify response data. By default, adding `@hey-api/transformers` to your plugins will only produce additional output. To preserve the previous functionality, set `sdk.transformer` to `true`. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - dates: true, - name: '@hey-api/transformers', - }, - { - name: '@hey-api/sdk', - transformer: true, // [!code ++] - }, - ], -}; -``` - -## v0.59.0 - -### Added `logs.level` option - -You can now configure different log levels. As part of this feature, we had to introduce a breaking change by moving the `debug` option to `logs.level`. This will affect you if you're calling `@hey-api/openapi-ts` from Node.js (not CLI) or using the configuration file. - -```js -export default { - client: '@hey-api/client-fetch', - debug: true, // [!code --] - input: 'hey-api/backend', // sign up at app.heyapi.dev - logs: { - level: 'debug', // [!code ++] - }, - output: 'src/client', -}; -``` - -### Updated default `plugins` - -`@hey-api/schemas` has been removed from the default plugins. To continue using it, add it to your plugins array. - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@hey-api/schemas', // [!code ++] - ], -}; -``` - -## v0.58.0 - -### Removed `schemas.gen.ts` re-export - -`index.ts` will no longer re-export `schemas.gen.ts` to reduce the chance of producing broken output. Please update your code to import from `schemas.gen.ts` directly. - -```js -import { mySchema } from 'client'; // [!code --] -import { mySchema } from 'client/schemas.gen'; // [!code ++] -``` - -### Removed `transformers.gen.ts` re-export - -`index.ts` will no longer re-export `transformers.gen.ts` to reduce the chance of producing broken output. Please update your code to import from `transformers.gen.ts` directly. - -```js -import { myTransformer } from 'client'; // [!code --] -import { myTransformer } from 'client/transformers.gen'; // [!code ++] -``` - -### Added `output.clean` option - -By default, the `output.path` folder will be emptied on every run. To preserve the previous behavior, set `output.clean` to `false`. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - clean: false, // [!code ++] - path: 'src/client', - }, -}; -``` - -### Added `typescript.identifierCase` option - -**This change affects only the experimental parser.** By default, the generated TypeScript interfaces will follow the PascalCase naming convention. In the previous versions, we tried to preserve the original name as much as possible. To keep the previous behavior, set `typescript.identifierCase` to `preserve`. - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - identifierCase: 'preserve', // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -## v0.57.0 - -### Renamed `@hey-api/services` plugin - -This plugin has been renamed to `@hey-api/sdk`. - -### Changed `sdk.output` value - -To align with the updated name, the `@hey-api/sdk` plugin will generate an `sdk.gen.ts` file. This will result in a breaking change if you're importing from `services.gen.ts`. Please update your imports to reflect this change. - -```js -import { client } from 'client/services.gen'; // [!code --] -import { client } from 'client/sdk.gen'; // [!code ++] -``` - -### Renamed `@hey-api/types` plugin - -This plugin has been renamed to `@hey-api/typescript`. - -### Added `typescript.exportInlineEnums` option - -By default, inline enums (enums not defined as reusable components in the input file) will be generated only as inlined union types. You can set `exportInlineEnums` to `true` to treat inline enums as reusable components. When `true`, the exported enums will follow the style defined in `enums`. - -This is a breaking change since in the previous versions, inline enums were always treated as reusable components. To preserve your current output, set `exportInlineEnums` to `true`. This feature works only with the experimental parser. - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - exportInlineEnums: true, // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -## v0.56.0 - -### Deprecated `tree` in `@hey-api/types` - -This config option is deprecated and will be removed when the experimental parser becomes the default. - -## v0.55.0 - -This release adds the ability to filter your OpenAPI specification before it's processed. This feature will be useful if you are working with a large specification and are interested in generating output only from a small subset. - -This feature is available only in the experimental parser. In the future, this will become the default parser. To opt-in to the experimental parser, set the `experimentalParser` flag in your configuration to `true`. - -### Deprecated `include` in `@hey-api/types` - -This config option is deprecated and will be removed when the experimental parser becomes the default. - -### Deprecated `filter` in `@hey-api/services` - -This config option is deprecated and will be removed when the experimental parser becomes the default. - -### Added `input.include` option - -This config option can be used to replace the deprecated options. It accepts a regular expression string matching against references within the bundled specification. - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, - input: { - include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++] - path: 'hey-api/backend', // sign up at app.heyapi.dev - }, - output: 'src/client', -}; -``` - -The configuration above will process only the schema named `foo` and `GET` operation for the `/api/v1/foo` path. - -## v0.54.0 - -This release makes plugins first-class citizens. In order to achieve that, the following breaking changes were introduced. - -### Removed CLI options - -The `--types`, `--schemas`, and `--services` CLI options have been removed. You can list which plugins you'd like to use explicitly by passing a list of plugins as `--plugins ` - -### Removed `*.export` option - -Previously, you could explicitly disable export of certain artifacts using the `*.export` option or its shorthand variant. These were both removed. You can now disable export of specific artifacts by manually defining an array of `plugins` and excluding the unwanted plugin. - -::: code-group - -```js [shorthand] -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - schemas: false, // [!code --] - plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++] -}; -``` - -```js [*.export] -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - schemas: { - export: false, // [!code --] - }, - plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++] -}; -``` - -::: - -### Renamed `schemas.name` option - -Each plugin definition contains a `name` field. This was conflicting with the `schemas.name` option. As a result, it has been renamed to `nameBuilder`. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - schemas: { - name: (name) => `${name}Schema`, // [!code --] - }, - plugins: [ - // ...other plugins - { - nameBuilder: (name) => `${name}Schema`, // [!code ++] - name: '@hey-api/schemas', - }, - ], -}; -``` - -### Removed `services.include` shorthand option - -Previously, you could use a string value as a shorthand for the `services.include` configuration option. You can now achieve the same result using the `include` option. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: '^MySchema', // [!code --] - plugins: [ - // ...other plugins - { - include: '^MySchema', // [!code ++] - name: '@hey-api/services', - }, - ], -}; -``` - -### Renamed `services.name` option - -Each plugin definition contains a `name` field. This was conflicting with the `services.name` option. As a result, it has been renamed to `serviceNameBuilder`. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: { - name: '{{name}}Service', // [!code --] - }, - plugins: [ - // ...other plugins - { - serviceNameBuilder: '{{name}}Service', // [!code ++] - name: '@hey-api/services', - }, - ], -}; -``` - -### Renamed `types.dates` option - -Previously, you could set `types.dates` to a boolean or a string value, depending on whether you wanted to transform only type strings into dates, or runtime code too. Many people found these options confusing, so they have been simplified to a boolean and extracted into a separate `@hey-api/transformers` plugin. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - types: { - dates: 'types+transform', // [!code --] - }, - plugins: [ - // ...other plugins - { - dates: true, // [!code ++] - name: '@hey-api/transformers', - }, - ], -}; -``` - -### Removed `types.include` shorthand option - -Previously, you could use a string value as a shorthand for the `types.include` configuration option. You can now achieve the same result using the `include` option. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - types: '^MySchema', // [!code --] - plugins: [ - // ...other plugins - { - include: '^MySchema', // [!code ++] - name: '@hey-api/types', - }, - ], -}; -``` - -### Renamed `types.name` option - -Each plugin definition contains a `name` field. This was conflicting with the `types.name` option. As a result, it has been renamed to `style`. - -```js -export default { - client: '@hey-api/client-fetch', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - types: { - name: 'PascalCase', // [!code --] - }, - plugins: [ - // ...other plugins - { - name: '@hey-api/types', - style: 'PascalCase', // [!code ++] - }, - ], -}; -``` - -## v0.53.0 - -### Changed schemas name pattern - -Previously, generated schemas would have their definition names prefixed with `$`. This was problematic when using them with Svelte due to reserved keyword conflicts. The new naming pattern for schemas suffixes their definition names with `Schema`. You can continue using the previous pattern by setting the `schemas.name` configuration option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - schemas: { - name: (name) => `$${name}`, // [!code ++] - }, -}; -``` - -### Renamed legacy clients - -Legacy clients were renamed to signal they are deprecated more clearly. To continue using legacy clients, you will need to update your configuration and prefix them with `legacy/`. - -::: code-group - -```js [fetch] -export default { - client: 'fetch', // [!code --] - client: 'legacy/fetch', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -```js [axios] -export default { - client: 'axios', // [!code --] - client: 'legacy/axios', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -```js [angular] -export default { - client: 'angular', // [!code --] - client: 'legacy/angular', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -```js [node] -export default { - client: 'node', // [!code --] - client: 'legacy/node', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -```js [xhr] -export default { - client: 'xhr', // [!code --] - client: 'legacy/xhr', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -::: - -## v0.52.0 - -### Removed internal `client` export - -Previously, client packages would create a default client which you'd then import and configure. - -```js -import { client, createClient } from '@hey-api/client-fetch'; - -createClient({ - baseUrl: 'https://example.com', -}); - -console.log(client.getConfig().baseUrl); // <-- 'https://example.com' -``` - -This client instance was used internally by services unless overridden. Apart from running `createClient()` twice, people were confused about the meaning of `global` configuration option. - -Starting with v0.52.0, client packages will not create a default client. Instead, services will define their own client. You can now achieve the same configuration by importing `client` from services and using the new `setConfig()` method. - -```js -import { client } from 'client/services.gen'; - -client.setConfig({ - baseUrl: 'https://example.com', -}); - -console.log(client.getConfig().baseUrl); // <-- 'https://example.com' -``` - -## v0.51.0 - -### Required `client` option - -Client now has to be explicitly specified and `@hey-api/openapi-ts` will no longer generate a legacy Fetch API client by default. To preserve the previous default behavior, set the `client` option to `fetch`. - -```js -export default { - client: 'fetch', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -## v0.48.0 - -### Changed `methodNameBuilder()` signature - -The `services.methodNameBuilder()` function now provides a single `operation` argument instead of multiple cherry-picked properties from it. - -```js -import { createClient } from '@hey-api/openapi-ts'; - -createClient({ - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: { - methodNameBuilder: (service, name) => name, // [!code --] - methodNameBuilder: (operation) => operation.name, // [!code ++] - }, -}); -``` - -## v0.46.0 - -### Tree-shakeable services - -By default, your services will now support [tree-shaking](https://developer.mozilla.org/docs/Glossary/Tree_shaking). You can either use wildcard imports - -```js -import { DefaultService } from 'client/services.gen'; // [!code --] -import * as DefaultService from 'client/services.gen'; // [!code ++] - -DefaultService.foo(); // only import needs to be changed -``` - -or update all references to service classes - -```js -import { DefaultService } from 'client/services.gen'; // [!code --] -import { foo } from 'client/services.gen'; // [!code ++] - -foo(); // all references need to be changed -``` - -If you want to preserve the old behavior, you can set the newly exposed `services.asClass` option to `true.` - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: { - asClass: true, // [!code ++] - }, -}; -``` - -## v0.45.0 - -### Removed `client` inference - -`@hey-api/openapi-ts` will no longer infer which client you want to generate. By default, we will create a `fetch` client. If you want a different client, you can specify it using the `client` option. - -```js -export default { - client: 'axios', // [!code ++] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -}; -``` - -## v0.44.0 - -### Moved `format` - -This config option has been moved. You can now configure formatter using the `output.format` option. - -```js -export default { - format: 'prettier', // [!code --] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - format: 'prettier', // [!code ++] - path: 'src/client', - }, -}; -``` - -### Moved `lint` - -This config option has been moved. You can now configure linter using the `output.lint` option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - lint: 'eslint', // [!code --] - output: { - lint: 'eslint', // [!code ++] - path: 'src/client', - }, -}; -``` - -## v0.43.0 - -### Removed `enums.gen.ts` - -This file has been removed. Instead, enums are exported from `types.gen.ts`. If you use imports from `enums.gen.ts`, you should be able to easily find and replace all instances. - -```js -import { Foo } from 'client/enums.gen'; // [!code --] -import { Foo } from 'client/types.gen'; // [!code ++] -``` - -### Removed `Enum` postfix - -Generated enum names are no longer postfixed with `Enum`. You can either alias your imports - -```js -import { FooEnum } from 'client/types.gen'; // [!code --] -import { Foo as FooEnum } from 'client/types.gen'; // [!code ++] - -console.log(FooEnum.value); // only import needs to be changed -``` - -or update all references to enums - -```js -import { FooEnum } from 'client/types.gen'; // [!code --] -import { Foo } from 'client/types.gen'; // [!code ++] - -console.log(Foo.value); // all references need to be changed -``` - -### Moved `enums` - -This config option has been moved. You can now configure enums using the `types.enums` option. - -```js -export default { - enums: 'javascript', // [!code --] - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - types: { - enums: 'javascript', // [!code ++] - }, -}; -``` - -## v0.42.0 - -### Changed `format` - -This config option has changed. You now need to specify a value (`biome` or `prettier`) to format the output (default: `false`). - -```js{2} -export default { - format: 'prettier', - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', -} -``` - -### Changed `lint` - -This config option has changed. You now need to specify a value (`biome` or `eslint`) to lint the output (default: `false`). - -```js{3} -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - lint: 'eslint', - output: 'src/client', -} -``` - -### Moved `operationId` - -This config option has been moved. You can now configure it using the `services.operationId` option. - -```js{5} -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: { - operationId: true, - }, -} -``` - -## v0.41.0 - -### Removed `postfixServices` - -This config option has been removed. You can now transform service names using the string pattern parameter. - -```js{5} -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: { - name: 'myAwesome{{name}}Api', - }, -} -``` - -### Removed `serviceResponse` - -This config option has been removed. You can now configure service responses using the `services.response` option. - -```js{5} -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - services: { - response: 'body', - }, -} -``` - -### Removed `useDateType` - -This config option has been removed. You can now configure date type using the `types.dates` option. - -```js{5} -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - type: { - dates: true, - }, -} -``` - -## v0.40.0 - -### Renamed `models.gen.ts` file - -`models.gen.ts` is now called `types.gen.ts`. If you use imports from `models.gen.ts`, you should be able to easily find and replace all instances. - -```js -import type { Model } from 'client/models.gen' // [!code --] -import type { Model } from 'client/types.gen' // [!code ++] -``` - -### Renamed `exportModels` - -This config option is now called `types`. - -### PascalCase for types - -You can now choose to export types using the PascalCase naming convention. - -```js{5} -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - types: { - name: 'PascalCase', - }, -} -``` - -### Exported `enums.gen.ts` file - -Enums are now re-exported from the main `index.ts` file. - -## v0.39.0 - -### Single `enums.gen.ts` file - -Enums are now exported from a separate file. If you use imports from `models.ts`, you can change them to `enums.gen.ts`. - -```js -import { Enum } from 'client/models'; // [!code --] -import { Enum } from 'client/enums.gen'; // [!code ++] -``` - -### Renamed `models.ts` file - -`models.ts` is now called `models.gen.ts`. If you use imports from `models.ts`, you should be able to easily find and replace all instances. - -```js -import type { Model } from 'client/models' // [!code --] -import type { Model } from 'client/models.gen' // [!code ++] -``` - -### Renamed `schemas.ts` file - -`schemas.ts` is now called `schemas.gen.ts`. If you use imports from `schemas.ts`, you should be able to easily find and replace all instances. - -```js -import { $Schema } from 'client/schemas'; // [!code --] -import { $Schema } from 'client/schemas.gen'; // [!code ++] -``` - -### Renamed `services.ts` file - -`services.ts` is now called `services.gen.ts`. If you use imports from `services.ts`, you should be able to easily find and replace all instances. - -```js -import { DefaultService } from 'client/services'; // [!code --] -import { DefaultService } from 'client/services.gen'; // [!code ++] -``` - -### Deprecated exports from `index.ts` - -Until this release, `index.ts` file exported all generated artifacts. Starting from this release, enums are no longer exported from `index.ts`. Models, schemas, and services will continue to be exported from `index.ts` to avoid a huge migration lift, but we recommend migrating to import groups per artifact type. - -```js -import { Enum, type Model, $Schema, DefaultService } from 'client' // [!code --] -import { Enum } from 'client/enums.gen' // [!code ++] -import type { Model } from 'client/models.gen' // [!code ++] -import { $Schema } from 'client/schemas.gen' // [!code ++] -import { DefaultService } from 'client/services.gen' // [!code ++] -``` - -### Prefer `unknown` - -Types that cannot be determined will now be generated as `unknown` instead of `any`. To dismiss any errors, you can cast your variables back to `any`, but we recommend updating your code to work with `unknown` types. - -```js -const foo = bar as any -``` - -## v0.38.0 - -### Renamed `write` - -This config option is now called `dryRun` (file) or `--dry-run` (CLI). To restore existing functionality, invert the value, ie. `write: true` is `dryRun: false` and `write: false` is `dryRun: true`. - -## v0.36.0 - -### JSON Schema 2020-12 - -Schemas are exported directly from OpenAPI specification. This means your schemas might change depending on which OpenAPI version you're using. If this release caused a field to be removed, consult the JSON Schema documentation on how to obtain the same value from JSON Schema (eg. [required properties](https://json-schema.org/understanding-json-schema/reference/object#required)). - -### Renamed `exportSchemas` - -This config option is now called `schemas`. - -## v0.35.0 - -### Removed `postfixModels` - -This config option has been removed. - -## v0.34.0 - -### Single `services.ts` file - -Services are now exported from a single file. If you used imports from individual service files, these will need to be updated to refer to the single `services.ts` file. - -## v0.31.1 - -### Merged enums options - -`useLegacyEnums` config option is now `enums: 'typescript'` and existing `enums: true` option is now `enums: 'javascript'`. - -## v0.31.0 - -### Single `models.ts` file - -TypeScript interfaces are now exported from a single file. If you used imports from individual model files, these will need to be updated to refer to the single `models.ts` file. - -### Single `schemas.ts` file - -Schemas are now exported from a single file. If you used imports from individual schema files, these will need to be updated to refer to the single `schemas.ts` file. - -## v0.27.38 - -### `useOptions: true` - -By default, generated clients will use a single object argument to pass values to API calls. This is a significant change from the previous default of unspecified array of arguments. If migrating your application in one go isn't feasible, we recommend deprecating your old client and generating a new client. - -```ts -import { DefaultService } from 'client/services'; // <-- old client with array arguments - -import { DefaultService } from 'client_v2/services'; // <-- new client with options argument -``` - -This way, you can gradually switch over to the new syntax as you update parts of your code. Once you've removed all instances of `client` imports, you can safely delete the old `client` folder and find and replace all `client_v2` calls to `client`. - -## v0.27.36 - -### `exportSchemas: true` - -By default, we will create schemas from your OpenAPI specification. Use `exportSchemas: false` to preserve the old behavior. - -## v0.27.32 - -### Renamed `Config` interface - -This interface is now called `UserConfig`. - -## v0.27.29 - -### Renamed `openapi` CLI command - -This command is now called `openapi-ts`. - -## v0.27.26 - -### Removed `indent` - -This config option has been removed. Use a [code formatter](/openapi-ts/configuration/output#post-process) to modify the generated files code style according to your preferences. - -## v0.27.24 - -### Removed `useUnionTypes` - -This config option has been removed. Generated types will behave the same as `useUnionTypes: true` before. - -## OpenAPI TypeScript Codegen - -`@hey-api/openapi-ts` was originally forked from Ferdi Koomen's [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen). Therefore, we want you to be able to migrate your projects. Migration should be relatively straightforward if you follow the release notes on this page. Start on [v0.27.24](#v0-27-24) and scroll to the release you're migrating to. diff --git a/docs/openapi-ts/mocks.md b/docs/openapi-ts/mocks.md deleted file mode 100644 index 9f66360d8d..0000000000 --- a/docs/openapi-ts/mocks.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: Mocks -description: Learn about mocking HTTP servers with @hey-api/openapi-ts. ---- - -# Mocks - -Realistic mock data is an important component of every robust development process, testing strategy, and product presentation. - -## Options - -Hey API natively supports the following mocking frameworks. - -- [Chance](/openapi-ts/plugins/chance) vote -- [Faker](/openapi-ts/plugins/faker) vote -- [Falso](/openapi-ts/plugins/falso) vote -- [MSW](/openapi-ts/plugins/msw) vote -- [Nock](/openapi-ts/plugins/nock) vote -- [Supertest](/openapi-ts/plugins/supertest) vote - -Don't see your framework? Let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues). - - - diff --git a/docs/openapi-ts/output.md b/docs/openapi-ts/output.md deleted file mode 100644 index 23db04913c..0000000000 --- a/docs/openapi-ts/output.md +++ /dev/null @@ -1,153 +0,0 @@ ---- -title: Output -description: Learn about files generated with @hey-api/openapi-ts. ---- - -# Output - -Every generated file in your output folder is created by a plugin. This page describes the default output, but similar logic applies to all plugins. - -## Overview - -If you use the default configuration, your [project](https://stackblitz.com/edit/hey-api-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fsdk.gen.ts,src%2Fclient%2Ftypes.gen.ts) might look like this. - -```txt -my-app/ -โ”œโ”€โ”€ node_modules/ -โ”œโ”€โ”€ src/ -โ”‚ โ”œโ”€โ”€ client/ -โ”‚ โ”‚ โ”œโ”€โ”€ client/ -โ”‚ โ”‚ โ”œโ”€โ”€ core/ -โ”‚ โ”‚ โ”œโ”€โ”€ client.gen.ts -โ”‚ โ”‚ โ”œโ”€โ”€ index.ts -โ”‚ โ”‚ โ”œโ”€โ”€ sdk.gen.ts -โ”‚ โ”‚ โ””โ”€โ”€ types.gen.ts -โ”‚ โ””โ”€โ”€ index.ts -โ””โ”€โ”€ package.json -``` - -Your actual output depends on your Hey API configuration. It may contain a different number of files and their contents might differ. - -Let's go through each file in the `src/client` folder and explain what it looks like, what it does, and how to use it. - -## Client - -`client.gen.ts` is generated by [client plugins](/openapi-ts/clients). If you choose to generate SDKs (enabled by default), we use the Fetch client unless specified otherwise. - -::: code-group - -```ts [client.gen.ts] -import { createClient, createConfig } from './client'; - -export const client = createClient(createConfig()); -``` - -::: - -The contents of this file are consumed by SDKs, but you can also import `client` in your application to perform additional configuration or send manual requests. - -### Bundle - -Client plugins provide their bundles inside `client` and `core` folders. The contents of these folders don't depend on the provided input. Everything inside these folders serves as a scaffolding so the generated code can make HTTP requests. - -## TypeScript - -You can learn more on the [TypeScript](/openapi-ts/plugins/typescript) page. - -## SDK - -You can learn more on the [SDK](/openapi-ts/plugins/sdk) page. - -## Entry File - -`index.ts` is not generated by any specific plugin. It's meant for convenience and by default, it re-exports every artifact generated by default plugins (TypeScript and SDK). - -::: code-group - -```ts [index.ts] -export * from './sdk.gen'; -export * from './types.gen'; -``` - -::: - -### Disable entry file - -We recommend importing artifacts from their respective files to avoid ambiguity, but we leave this choice up to you. - -```ts -import type { Pet } from './client'; -// or -import type { Pet } from './client/types.gen'; -``` - -If you're not importing artifacts from the entry file, you can skip generating it altogether by setting the `output.entryFile` option to `false`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: { - entryFile: false, // [!code ++] - path: 'src/client', - }, -}; -``` - -### Re-export artifacts - -You can choose which artifacts should be re-exported from the entry file using the `includeInEntry` option on any plugin. For example, we can re-export all [Zod](/openapi-ts/plugins/zod) plugin artifacts by setting `includeInEntry` to `true`: - -::: code-group - -```ts [example] -export { - zAddPetData, - zAddPetResponse, - zApiResponse, - zCategory, - // ...more exports -} from './zod.gen'; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - includeInEntry: true, // [!code ++] - name: 'zod', - }, - ], -}; -``` - -::: - -Or we can re-export only specific artifacts by providing a predicate function: - -::: code-group - -```ts [example] -export { zTag } from './zod.gen'; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - includeInEntry: (symbol) => symbol.name === 'zTag', // [!code ++] - name: 'zod', - }, - ], -}; -``` - -::: - - - diff --git a/docs/openapi-ts/plugins/adonis.md b/docs/openapi-ts/plugins/adonis.md deleted file mode 100644 index 576e9a478c..0000000000 --- a/docs/openapi-ts/plugins/adonis.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: AdonisJS -description: AdonisJS plugin for Hey API. Compatible with all our features. ---- - - - -# AdonisJS vote - - - -### About - -[AdonisJS](https://adonisjs.com) is a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more. - - diff --git a/docs/openapi-ts/plugins/ajv.md b/docs/openapi-ts/plugins/ajv.md deleted file mode 100644 index 0cf5272856..0000000000 --- a/docs/openapi-ts/plugins/ajv.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Ajv -description: Ajv plugin for Hey API. Compatible with all our features. ---- - - - -# Ajv vote - - - -### About - -[Ajv](https://ajv.js.org) is the fastest JSON validator for Node.js and browser. - - diff --git a/docs/openapi-ts/plugins/angular.md b/docs/openapi-ts/plugins/angular.md deleted file mode 100644 index 0e04c8a25e..0000000000 --- a/docs/openapi-ts/plugins/angular.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: Angular v20 Plugin -description: Generate Angular v20 HTTP requests and resources from OpenAPI with the Angular plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Angular v20

    - -
    - -::: warning -Angular client is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Angular](https://angular.dev/) is a web framework that empowers developers to build fast, reliable applications. - -The Angular plugin for Hey API generates HTTP requests and resources from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Collaborators - - - -## Features - -- Angular v20 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- generate HTTP requests -- generate HTTP resources -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@angular/common` to your plugins and you'll be ready to generate Angular artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@angular/common', // [!code ++] - ], -}; -``` - -## Output - -The Angular plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A single function is generated for each endpoint. It returns an [`HttpRequest`](https://angular.dev/api/common/http/HttpRequest) result. - -::: code-group - -```ts [example] -export const addPetRequest = (options) => - client.requestOptions({ - method: 'POST', - responseStyle: 'data', - url: '/pet', - ...options, - }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@angular/common', - httpRequests: true, // [!code ++] - }, - ], -}; -``` - -::: - -## Resources - -A single function is generated for each endpoint. It returns a result from [`httpResource`](https://angular.dev/api/common/http/httpResource) call. - -::: code-group - -```ts [example] -export const addPetResource = (options) => httpResource(() => addPetRequest(options())); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@angular/common', - httpResources: true, // [!code ++] - }, - ], -}; -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@angular/common/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/angular/v19.md b/docs/openapi-ts/plugins/angular/v19.md deleted file mode 100644 index d3185ffa74..0000000000 --- a/docs/openapi-ts/plugins/angular/v19.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: Angular v19 Plugin -description: Generate Angular v19 HTTP requests and resources from OpenAPI with the Angular plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Angular v19

    - -
    - -::: warning -Angular client is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Angular](https://angular.dev/) is a web framework that empowers developers to build fast, reliable applications. - -The Angular plugin for Hey API generates HTTP requests and resources from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -### Collaborators - - - -## Features - -- Angular v19 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- generate HTTP requests -- generate HTTP resources -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@angular/common` to your plugins and you'll be ready to generate Angular artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@angular/common', // [!code ++] - ], -}; -``` - -## Output - -The Angular plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A single function is generated for each endpoint. It returns an [`HttpRequest`](https://v19.angular.dev/api/common/http/HttpRequest) result. - -::: code-group - -```ts [example] -export const addPetRequest = (options) => - client.requestOptions({ - method: 'POST', - responseStyle: 'data', - url: '/pet', - ...options, - }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@angular/common', - httpRequests: true, // [!code ++] - }, - ], -}; -``` - -::: - -## Resources - -A single function is generated for each endpoint. It returns a result from [`httpResource`](https://v19.angular.dev/api/common/http/httpResource) call. - -::: code-group - -```ts [example] -export const addPetResource = (options) => httpResource(() => addPetRequest(options())); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@angular/common', - httpResources: true, // [!code ++] - }, - ], -}; -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@angular/common/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/arktype.md b/docs/openapi-ts/plugins/arktype.md deleted file mode 100644 index be16a9d325..0000000000 --- a/docs/openapi-ts/plugins/arktype.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Arktype -description: Arktype plugin for Hey API. Compatible with all our features. ---- - - - -# Arktype vote - - - -### About - -[Arktype](https://arktype.io) is a TypeScript's 1:1 validator, optimized from editor to runtime. - - diff --git a/docs/openapi-ts/plugins/chance.md b/docs/openapi-ts/plugins/chance.md deleted file mode 100644 index f79ddcca54..0000000000 --- a/docs/openapi-ts/plugins/chance.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Chance -description: Chance plugin for Hey API. Compatible with all our features. ---- - - - -# Chance vote - - - -### About - -[Chance](https://chancejs.com/) is a minimalist generator of random strings, numbers, etc. to help reduce some monotony particularly while writing automated tests or anywhere else you need anything random. - - diff --git a/docs/openapi-ts/plugins/concepts/resolvers.md b/docs/openapi-ts/plugins/concepts/resolvers.md deleted file mode 100644 index 2549e1b5cf..0000000000 --- a/docs/openapi-ts/plugins/concepts/resolvers.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -title: Resolvers -description: Understand the concepts behind plugins. ---- - -# Resolvers - -Sometimes the default plugin behavior isn't what you need or expect. Resolvers let you patch plugins in a safe and performant way, without forking or reimplementing core logic. - -Currently available for [TypeScript](/openapi-ts/plugins/typescript), [Valibot](/openapi-ts/plugins/valibot), and [Zod](/openapi-ts/plugins/zod). - -## Examples - -This page demonstrates resolvers through a few common scenarios. - -1. [Handle arbitrary schema formats](#example-1) -2. [Validate high precision numbers](#example-2) -3. [Replace default base](#example-3) -4. [Create permissive enums](#example-4) - -## Terminology - -Before we look at examples, let's go through the resolvers API to help you understand how they work. Plugins that support resolvers expose them through the `~resolvers` option. Each resolver is a function that receives context and returns an implemented node (or patches existing ones). - -The resolver context will usually contain: - -- `$` - The node builder interface. Use it to build your custom logic. -- `nodes` - Parts of the plugin logic. You can use these to avoid reimplementing the functionality, or replace them with custom implementation. -- `plugin` - The plugin instance. You'll most likely use it to register new symbols. -- `symbols` - Frequently used symbols. These are effectively shorthands for commonly used `plugin.referenceSymbol()` calls. - -Other fields may include the current schema or relevant utilities. - -## Example 1 - -### Handle arbitrary schema formats - -By default, the Valibot plugin may produce the following schemas for `date` and `date-time` strings. - -```js -export const vDates = v.object({ - created: v.pipe(v.string(), v.isoDate()), - modified: v.pipe(v.string(), v.isoTimestamp()), -}); -``` - -We can override this behavior by patching the `nodes.format` function only for strings with `date` or `date-time` formats. - -```js -{ - name: 'valibot', - '~resolvers': { - string(ctx) { - const { $, schema, symbols } = ctx; - const { v } = symbols; - if (schema.format === 'date' || schema.format === 'date-time') { - ctx.nodes.format = () => $(v).attr('isoDateTime').call(); - } - } - } -} -``` - -This applies custom logic with surgical precision, without affecting the rest of the default behavior. - -::: code-group - -```js [after] -export const vDates = v.object({ - created: v.pipe(v.string(), v.isoDateTime()), - modified: v.pipe(v.string(), v.isoDateTime()), -}); -``` - -```js [before] -export const vDates = v.object({ - created: v.pipe(v.string(), v.isoDate()), - modified: v.pipe(v.string(), v.isoTimestamp()), -}); -``` - -::: - -## Example 2 - -### Validate high precision numbers - -Let's say you're dealing with very large or unsafe numbers. - -```js -export const vAmount = v.number(); -``` - -In this case, you'll want to use a third-party library to validate your values. We can use big.js to validate all numbers by replacing the whole resolver. - -```js -{ - name: 'valibot', - '~resolvers': { - number(ctx) { - const { $, plugin, symbols } = ctx; - const { v } = symbols; - const big = plugin.symbolOnce('Big', { - external: 'big.js', - importKind: 'default', - }); - return $(v).attr('instance').call(big); - } - } -} -``` - -We're calling `plugin.symbolOnce()` to ensure we always use the same symbol reference. - -::: code-group - -```js [after] -import Big from 'big.js'; - -export const vAmount = v.instance(Big); -``` - -```js [before] -export const vAmount = v.number(); -``` - -::: - -## Example 3 - -### Replace default base - -You might want to replace the default base schema, e.g., `v.object()`. - -```js -export const vUser = v.object({ - age: v.number(), -}); -``` - -Let's say we want to interpret any schema without explicitly defined additional properties as a loose object. - -```js -{ - name: 'valibot', - '~resolvers': { - object(ctx) { - const { $, symbols } = ctx; - const { v } = symbols; - const additional = ctx.nodes.additionalProperties(ctx); - if (additional === undefined) { - const shape = ctx.nodes.shape(ctx); - ctx.nodes.base = () => $(v).attr('looseObject').call(shape); - } - } - } -} -``` - -Above we demonstrate patching a node based on the result of another node. - -::: code-group - -```js [after] -export const vUser = v.looseObject({ - age: v.number(), -}); -``` - -```js [before] -export const vUser = v.object({ - age: v.number(), -}); -``` - -::: - -## Example 4 - -### Create permissive enums - -By default, enum schemas are strict and will reject unknown values. - -```js -export const zStatus = z.enum(['active', 'inactive', 'pending']); -``` - -You might want to accept unknown enum values, for example when the API adds new values that haven't been added to the spec yet. You can use the enum resolver to create a permissive union. - -```js -{ - name: 'zod', - '~resolvers': { - enum(ctx) { - const { $, symbols } = ctx; - const { z } = symbols; - const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx); - - if (!allStrings || !enumMembers.length) { - return; - } - - const enumSchema = $(z).attr('enum').call($.array(...enumMembers)); - return $(z).attr('union').call( - $.array(enumSchema, $(z).attr('string').call()) - ); - } - } -} -``` - -This resolver creates a union that accepts both the known enum values and any other string. - -::: code-group - -```js [after] -export const zStatus = z.union([z.enum(['active', 'inactive', 'pending']), z.string()]); -``` - -```js [before] -export const zStatus = z.enum(['active', 'inactive', 'pending']); -``` - -::: - -## Feedback - -We welcome feedback on the Resolvers API. [Open a GitHub issue](https://github.com/hey-api/openapi-ts/issues) to request support for additional plugins. - - diff --git a/docs/openapi-ts/plugins/custom.md b/docs/openapi-ts/plugins/custom.md deleted file mode 100644 index 19e2f7de03..0000000000 --- a/docs/openapi-ts/plugins/custom.md +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: Custom Plugin -description: Learn how to create your own Hey API plugin. ---- - -# Custom Plugin - -::: warning -Plugin API is in development. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -::: warning -This page is out of date as of [v0.83.0](/openapi-ts/migrating#v0-83-0). If you have an existing custom plugin, we recommend waiting for a more stable Plugin API to avoid multiple plugin rewrites. -::: - -You may need to write your own plugin if the available plugins do not suit your needs or you're working on a proprietary use case. This can be easily achieved using the Plugin API. But don't take our word for it โ€“ all Hey API plugins are written this way! - -## File Structure - -We recommend following the design pattern of the native plugins. You can browse the code on [GitHub](https://github.com/hey-api/openapi-ts/tree/main/packages/openapi-ts/src/plugins) as you follow this tutorial. First, create a `my-plugin` folder for your plugin files. Inside, create a barrel file `index.ts` exporting the plugin. - -::: code-group - -```ts [index.ts] -export { defaultConfig, defineConfig } from './config'; -export type { MyPlugin } from './types'; -``` - -::: - -## TypeScript - -`index.ts` references two files, so we need to create them. `types.ts` contains the TypeScript interface for your plugin options. It must have the reserved `name` and `output` fields, everything else will become user-configurable options. - -::: code-group - -```ts [types.ts] -import type { DefinePlugin } from '@hey-api/openapi-ts'; - -export type UserConfig = { - /** - * Plugin name. Must be unique. - */ - name: 'my-plugin'; - /** - * Name of the generated file. - * - * @default 'my-plugin' - */ - output?: string; - /** - * User-configurable option for your plugin. - * - * @default false - */ - myOption?: boolean; -}; - -export type MyPlugin = DefinePlugin; -``` - -::: - -## Configuration - -`config.ts` contains the runtime configuration for your plugin. It must implement the `MyPlugin` interface we created above and define the `handler()` function from the `MyPlugin['Config']` interface. - -::: code-group - -```ts [config.ts] -import { definePluginConfig } from '@hey-api/openapi-ts'; - -import { handler } from './plugin'; -import type { MyPlugin } from './types'; - -export const defaultConfig: MyPlugin['Config'] = { - config: { - myOption: false, // implements default value from types - }, - dependencies: ['@hey-api/typescript'], - handler, - name: 'my-plugin', -}; - -/** - * Type helper for `my-plugin` plugin, returns {@link Plugin.Config} object - */ -export const defineConfig = definePluginConfig(defaultConfig); -``` - -::: - -In the file above, we define a `my-plugin` plugin which will generate a `my-plugin.gen.ts` file. We also demonstrate declaring `@hey-api/typescript` as a dependency for our plugin, so we can safely import artifacts from `types.gen.ts`. - -By default, your plugin output won't be re-exported from the `index.ts` file. To enable this feature, add `includeInEntry: true` to your `config.ts` file. - -::: warning -Re-exporting your plugin from index file may result in broken output due to naming conflicts. Ensure your exported identifiers are unique. -::: - -## Handler - -Notice we defined `handler` in our `config.ts` file. This method is responsible for generating the actual output. We recommend implementing it in `plugin.ts`. - -::: code-group - -```ts [plugin.ts] -import type { MyPlugin } from './types'; - -export const handler: MyPlugin['Handler'] = ({ plugin }) => { - // create an output file. it will not be - // generated until it contains nodes - const file = plugin.createFile({ - id: plugin.name, - path: plugin.output, - }); - - plugin.forEach('operation', 'schema', (event) => { - if (event.type === 'operation') { - // do something with the operation model - } else if (event.type === 'schema') { - // do something with the schema model - } - }); - - // we're using the TypeScript Compiler API - const stringLiteral = ts.factory.createStringLiteral('Hello, world!'); - const variableDeclaration = ts.factory.createVariableDeclaration( - 'foo', - undefined, - undefined, - stringLiteral, - ); - const node = ts.factory.createVariableStatement( - [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)], - ts.factory.createVariableDeclarationList([variableDeclaration], ts.NodeFlags.Const), - ); - - // add a node to our file - file.add(node); -}; -``` - -::: - -### Legacy Handler - -You can also define an optional `handlerLegacy` function in `config.ts`. This method is responsible for generating the output when using the legacy parser. We do not recommend implementing this method unless you must use the legacy parser. You can use one of our [`plugin-legacy.ts`](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/%40hey-api/typescript/plugin-legacy.ts) files as an inspiration for potential implementation. - -## Usage - -Once we're satisfied with our plugin, we can register it in the [configuration](/openapi-ts/configuration) file. - -```js -import { defineConfig } from 'path/to/my-plugin'; - -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - defineConfig({ - myOption: true, - }), - ], -}; -``` - -## Output - -Putting all of this together will generate the following `my-plugin.gen.ts` file. - -::: code-group - -```ts [my-plugin.gen.ts] -export const foo = 'Hello, world!'; -``` - -::: - -Congratulations! You've successfully created your own plugin! :tada: - - - diff --git a/docs/openapi-ts/plugins/elysia.md b/docs/openapi-ts/plugins/elysia.md deleted file mode 100644 index 1d08d3b478..0000000000 --- a/docs/openapi-ts/plugins/elysia.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Elysia -description: Elysia plugin for Hey API. Compatible with all our features. ---- - - - -# Elysia vote - - - -### About - -[Elysia](https://elysiajs.com/) is an ergonomic framework for humans. TypeScript with end-to-end type safety, type integrity, and exceptional developer experience. Supercharged by Bun. - - diff --git a/docs/openapi-ts/plugins/express.md b/docs/openapi-ts/plugins/express.md deleted file mode 100644 index 77350a9484..0000000000 --- a/docs/openapi-ts/plugins/express.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Express -description: Express plugin for Hey API. Compatible with all our features. ---- - - - -# Express vote - - - -### About - -[Express](https://expressjs.com) is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. - - diff --git a/docs/openapi-ts/plugins/faker.md b/docs/openapi-ts/plugins/faker.md deleted file mode 100644 index d014d4a572..0000000000 --- a/docs/openapi-ts/plugins/faker.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Faker -description: Faker plugin for Hey API. Compatible with all our features. ---- - - - -# Faker vote - - - -### About - -[Faker](https://fakerjs.dev) is a popular library that generates fake (but reasonable) data that can be used for things such as unit testing, performance testing, building demos, and working without a completed backend. - - diff --git a/docs/openapi-ts/plugins/falso.md b/docs/openapi-ts/plugins/falso.md deleted file mode 100644 index a056dd13fb..0000000000 --- a/docs/openapi-ts/plugins/falso.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Falso -description: Falso plugin for Hey API. Compatible with all our features. ---- - - - -# Falso vote - - - -### About - -[Falso](https://ngneat.github.io/falso/) creates massive amounts of fake data in the browser and NodeJS. Tree shakeable & fully typed. - - diff --git a/docs/openapi-ts/plugins/fastify.md b/docs/openapi-ts/plugins/fastify.md deleted file mode 100644 index e63cad2df7..0000000000 --- a/docs/openapi-ts/plugins/fastify.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: Fastify v5 Plugin -description: Generate Fastify v5 route handlers from OpenAPI with the Fastify plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Fastify v5

    - -
    - -::: warning -Fastify plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Fastify](https://fastify.dev) is a fast and low overhead web framework for Node.js. - -The Fastify plugin for Hey API generates route handlers from your OpenAPI spec, fully compatible with all core features. - -### Collaborators - - - -## Features - -- Fastify v5 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe route handlers -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `fastify` to your plugins and you'll be ready to generate Fastify artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'fastify', // [!code ++] - ], -}; -``` - -## Output - -The Fastify plugin will generate the following artifacts, depending on the input specification. - -## Route Handlers - -Route handlers are generated from all endpoints. The generated interface follows the naming convention of SDK functions. - -::: code-group - -```ts [example] -const fastify = Fastify(); -const serviceHandlers: RouteHandlers = { - createPets(request, reply) { - reply.code(201).send(); - }, - listPets(request, reply) { - reply.code(200).send([]); - }, - showPetById(request, reply) { - reply.code(200).send({ - id: Number(request.params.petId), - name: 'Kitty', - }); - }, -}; -fastify.register(glue, { serviceHandlers }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'fastify', - ], -}; -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/fastify/types.ts) interface. - - - - diff --git a/docs/openapi-ts/plugins/hono.md b/docs/openapi-ts/plugins/hono.md deleted file mode 100644 index a7f414783d..0000000000 --- a/docs/openapi-ts/plugins/hono.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Hono -description: Hono plugin for Hey API. Compatible with all our features. ---- - - - -# Hono vote - - - -### About - -[Hono](https://hono.dev) is a small, simple, and ultrafast web framework built on Web Standards. It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Netlify, AWS Lambda, Lambda@Edge, and Node.js. - - diff --git a/docs/openapi-ts/plugins/joi.md b/docs/openapi-ts/plugins/joi.md deleted file mode 100644 index 5cca2aa350..0000000000 --- a/docs/openapi-ts/plugins/joi.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Joi -description: Joi plugin for Hey API. Compatible with all our features. ---- - - - -# Joi vote - - - -### About - -[Joi](https://joi.dev) is the most powerful schema description language and data validator for JavaScript. - - diff --git a/docs/openapi-ts/plugins/koa.md b/docs/openapi-ts/plugins/koa.md deleted file mode 100644 index e6d2824d5c..0000000000 --- a/docs/openapi-ts/plugins/koa.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Koa -description: Koa plugin for Hey API. Compatible with all our features. ---- - - - -# Koa vote - - - -### About - -[Koa](https://koajs.com) is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. - - diff --git a/docs/openapi-ts/plugins/msw.md b/docs/openapi-ts/plugins/msw.md deleted file mode 100644 index c2fef6406f..0000000000 --- a/docs/openapi-ts/plugins/msw.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: MSW -description: MSW plugin for Hey API. Compatible with all our features. ---- - - - -# MSW vote - - - -### About - -[MSW](https://mswjs.io) is an API mocking library that allows you to write client-agnostic mocks and reuse them across any frameworks, tools, and environments. - - diff --git a/docs/openapi-ts/plugins/nest.md b/docs/openapi-ts/plugins/nest.md deleted file mode 100644 index a158ec5507..0000000000 --- a/docs/openapi-ts/plugins/nest.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: NestJS v11 Plugin -description: Generate NestJS v11 controller methods from OpenAPI with the NestJS plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    NestJS v11

    - -
    - -::: warning -NestJS plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[Nest](https://nestjs.com) is a progressive Node.js framework for building efficient, reliable and scalable server-side applications. - -The NestJS plugin for Hey API generates type-safe controller method signatures from your OpenAPI spec, fully compatible with all core features. - -### Collaborators - - - -## Features - -- NestJS v11 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- type-safe controller methods -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `nestjs` to your plugins and you'll be ready to generate NestJS artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'nestjs', // [!code ++] - ], -}; -``` - -## Output - -The NestJS plugin will generate the following artifacts, depending on the input specification. - -## Controller Methods - -Operations are grouped by their first tag into separate types. - -::: code-group - -```ts [example] -export type PetsControllerMethods = { - createPet: (body: CreatePetData['body']) => Promise; - listPets: (query?: ListPetsData['query']) => Promise; - showPetById: (path: ShowPetByIdData['path']) => Promise; -}; - -export type StoreControllerMethods = { - getInventory: () => Promise; -}; -``` - -```ts [usage] -import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common'; - -import type { PetsControllerMethods } from '../client/nestjs.gen'; -import type { CreatePetData, ListPetsData, ShowPetByIdData } from '../client/types.gen'; - -@Controller('pets') -export class PetsController implements Pick< - PetsControllerMethods, - 'createPet' | 'listPets' | 'showPetById' -> { - @Post() - async createPet(@Body() body: CreatePetData['body']) {} - - @Get() - async listPets(@Query() query?: ListPetsData['query']) {} - - @Get(':petId') - async showPetById(@Param() path: ShowPetByIdData['path']) {} -} -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/nestjs/types.ts) interface. - - - - diff --git a/docs/openapi-ts/plugins/nock.md b/docs/openapi-ts/plugins/nock.md deleted file mode 100644 index a9a95faacc..0000000000 --- a/docs/openapi-ts/plugins/nock.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Nock -description: Nock plugin for Hey API. Compatible with all our features. ---- - - - -# Nock vote - - - -### About - -[Nock](https://github.com/nock/nock) is an HTTP server mocking and expectations library for Node.js. - - diff --git a/docs/openapi-ts/plugins/orpc.md b/docs/openapi-ts/plugins/orpc.md deleted file mode 100644 index 66f8a21124..0000000000 --- a/docs/openapi-ts/plugins/orpc.md +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: oRPC v1 Plugin -description: Generate oRPC v1 contracts from OpenAPI with the oRPC plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    oRPC v1

    - -
    - -::: warning -oRPC plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -### About - -[oRPC](https://orpc.dev) combines RPC with OpenAPI, allowing you to define and call remote or local procedures through a type-safe API while adhering to the OpenAPI specification. - -The oRPC plugin for Hey API generates contracts from your OpenAPI spec, fully compatible with all core features. - -### Collaborators - - - -## Features - -- oRPC v1 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- generated contracts -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `orpc` to your plugins and you'll be ready to generate oRPC artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'orpc', // [!code ++] - ], -}; -``` - -## Output - -The oRPC plugin will generate the following artifacts, depending on the input specification. - -## Contracts - -Contracts are generated from all endpoints. - -::: code-group - -```js [example] -import { oc } from '@orpc/contract'; - -const addPet = oc.route({ - description: 'Add a new pet to the store.', - inputStructure: 'detailed', - method: 'POST', - operationId: 'addPet', - path: '/pet', - summary: 'Add a new pet to the store.', - tags: ['pet'], -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'orpc', - ], -}; -``` - -::: - -### Validators - -To enable schema validation, set `validator` to `zod` or one of the available [validator plugins](/openapi-ts/validators). This will implicitly add the selected plugin with default values. - -For a more granular approach, manually add a validator plugin and set `validator` to the plugin name or `true` to automatically select a compatible plugin. Until you customize the validator plugin, both approaches will produce the same default output. - -::: code-group - -```js [example] -import { oc } from '@orpc/contract'; - -import { vAddPetBody, vAddPetResponse } from './valibot.gen'; - -const addPet = oc - .route({ - description: 'Add a new pet to the store.', - inputStructure: 'detailed', - method: 'POST', - operationId: 'addPet', - path: '/pet', - summary: 'Add a new pet to the store.', - tags: ['pet'], - }) - .input(v.object({ body: vAddPetBody })) // [!code ++] - .output(vAddPetResponse); // [!code ++] -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'orpc', - validator: true, // or 'valibot' // [!code ++] - }, - { - name: 'valibot', // customize (optional) // [!code ++] - // other options - }, - ], -}; -``` - -::: - -You can choose to validate only inputs or outputs. - -::: code-group - -```js [inputs] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'orpc', - validator: { - input: 'zod', // [!code ++] - }, - }, - ], -}; -``` - -```js [outputs] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'orpc', - validator: { - output: 'zod', // [!code ++] - }, - }, - ], -}; -``` - -::: - -Learn more about available validators on the [Validators](/openapi-ts/validators) page. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/orpc/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/pinia-colada.md b/docs/openapi-ts/plugins/pinia-colada.md deleted file mode 100644 index c4853f4e7c..0000000000 --- a/docs/openapi-ts/plugins/pinia-colada.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -title: Pinia Colada v0 Plugin -description: Generate Pinia Colada v0 functions and query keys from OpenAPI with the Pinia Colada plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Pinia Colada v0

    - -
    - -### About - -[Pinia Colada](https://pinia-colada.esm.dev) is the perfect companion to Pinia to handle async state management in your Vue applications. - -The Pinia Colada plugin for Hey API generates functions and query keys from your OpenAPI spec, fully compatible with SDKs, transformers, and all core features. - -### Collaborators - - - -## Features - -- Pinia Colada v0 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- create query keys following the best practices -- type-safe query options and mutation options -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@pinia/colada` to your plugins and you'll be ready to generate Pinia Colada artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@pinia/colada', // [!code ++] - ], -}; -``` - -::: tip -When using this plugin in a Nuxt app, prefer the [ofetch client](/openapi-ts/clients/ofetch) for universal compatibility. - -The [nuxt client](/openapi-ts/clients/nuxt) is tailored for working directly with Nuxt composables (`$fetch` / `useFetch` / `useAsyncData`) and is not intended as a universal HTTP client for libraries like `@pinia/colada`. -::: - -## Output - -The Pinia Colada plugin will generate the following artifacts, depending on the input specification. - -## Queries - -Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Query`, e.g., `getPetByIdQuery()`. - -::: code-group - -```ts [example] -const query = useQuery(getPetByIdQuery, () => ({ - path: { - petId: 1, - }, -})); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@pinia/colada', - queryOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `queryOptions` functions using the `.name` and `.case` options. - -## Query Keys - -Query keys contain normalized SDK function parameters and additional metadata. - -::: code-group - -```ts [example] -const queryKey = [ - { - _id: 'getPetById', - baseUrl: 'https://app.heyapi.dev', - path: { - petId: 1, - }, - }, -]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@pinia/colada', - queryKeys: true, // [!code ++] - }, - ], -}; -``` - -::: - -### Tags - -You can include operation tags in your query keys by setting `tags` to `true`. This will make query keys larger but provides better cache invalidation capabilities. - -::: code-group - -```ts [example] -const key = [ - { - _id: 'getPetById', - baseUrl: 'https://app.heyapi.dev', - path: { - petId: 1, - }, - tags: ['pets', 'one', 'get'], // [!code ++] - }, -]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@pinia/colada', - queryKeys: { - tags: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Accessing Query Keys - -If you have access to the result of query options function, you can get the query key from the `key` field. - -::: code-group - -```ts [example] -const { key } = getPetByIdQuery({ - path: { - petId: 1, - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@pinia/colada', - queryOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `QueryKey`, e.g., `getPetByIdQueryKey()`. - -::: code-group - -```ts [example] -const key = getPetByIdQueryKey({ - path: { - petId: 1, - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@pinia/colada', - queryKeys: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `queryKeys` functions using the `.name` and `.case` options. - -## Mutations - -Mutations are generated from [mutation operations](/openapi-ts/configuration/parser#hooks-mutation-operations). The generated mutation functions follow the naming convention of SDK functions and by default append `Mutation`, e.g., `addPetMutation()`. - -::: code-group - -```ts [example] -const addPet = useMutation({ - ...addPetMutation(), - onError: (error) => { - console.log(error); - }, -}); - -addPet.mutate({ - body: { - name: 'Kitty', - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@pinia/colada', - mutationOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `mutationOptions` functions using the `.name` and `.case` options. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@pinia/colada/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/schemas.md b/docs/openapi-ts/plugins/schemas.md deleted file mode 100644 index 01bc7fd485..0000000000 --- a/docs/openapi-ts/plugins/schemas.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: JSON Schema -description: Learn about files generated with @hey-api/openapi-ts. ---- - -# JSON Schemas - -Schemas are located in the `schemas.gen.ts` file. This file contains runtime schemas generated from your OpenAPI specification definitions located in `#/components/schemas`. If you're using OpenAPI 3.1, your schemas are fully JSON Schema compliant and can be used with other tools supporting JSON Schema. - -## Configuration - -You can modify the contents of `schemas.gen.ts` by configuring the `@hey-api/schemas` plugin. Note that you must specify the default plugins to preserve the default output. - -::: code-group - -```js [json] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/schemas', - type: 'json', // [!code ++] - }, - ], -}; -``` - -```js [form] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/schemas', - type: 'form', // [!code ++] - }, - ], -}; -``` - -```js [disabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@hey-api/schemas', // [!code --] - ], -}; -``` - -::: - -## Output - -Below is an example output generated in the `type: 'form'` style. Disabling schemas will not generate the `schemas.gen.ts` file. - -```ts -export const PetSchema = { - required: ['name'], - properties: { - id: { - type: 'integer', - format: 'int64', - example: 10, - }, - name: { - type: 'string', - example: 'doggie', - }, - }, - type: 'object', -} as const; -``` - -## Usage - -A great use case for schemas is client-side form input validation. - -```ts -import { $Schema } from './client/schemas.gen'; - -const maxInputLength = $Schema.properties.text.maxLength; - -if (userInput.length > maxInputLength) { - throw new Error(`Text length can't exceed ${maxInputLength} characters!`); -} -``` - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/sdk.md b/docs/openapi-ts/plugins/sdk.md deleted file mode 100644 index 350c5a9a3c..0000000000 --- a/docs/openapi-ts/plugins/sdk.md +++ /dev/null @@ -1,550 +0,0 @@ ---- -title: SDK Plugin -description: Generate SDKs from OpenAPI with the SDK plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - -# SDK - -### About - -The SDK plugin generates a high-level, ergonomic API layer on top of the low-level HTTP client. - -It exposes typed functions or methods for each operation, with built-in auth handling, configurable request and response validation, and ready-to-use code examples. - -## Features - -- high-level SDK layer on top of the HTTP client -- typed functions or methods per operation -- built-in authentication handling -- request and response validation -- ready-to-use code examples - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/sdk` to your plugins and you'll be ready to generate SDK artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@hey-api/sdk', // [!code ++] - ], -}; -``` - -## Output - -The SDK plugin supports a wide range of configuration options. This guide focuses on two main SDK formats: tree-shakeable functions and instantiable classes, but you can apply the same concepts to create more advanced configurations. - -## Flat - -This is the default setting. Flat SDKs support tree-shaking, which can lead to a reduced bundle size. You select flat mode by setting `operations.strategy` to `flat`. - -::: code-group - -```ts [example] -import type { AddPetData } from './types.gen'; - -export const addPet = (options: Options) => { - /** ... */ -}; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - operations: { - strategy: 'flat', // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Instance - -Class SDKs do not support tree-shaking, which results in a larger bundle size, but you may prefer their syntax. You select class mode by setting `operations.strategy` to `single`. - -::: code-group - -```ts [example] -import type { AddPetData } from './types.gen'; - -export class Sdk extends HeyApiClient { - public addPet(options: Options) { - /** ... */ - } -} -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - operations: { - strategy: 'single', // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Name - -As shown above, by default our SDK class is called `Sdk`. The first thing you'll likely want to do is change this to your preferred name, which you can do using `operation.containerName`. - -::: code-group - - -```ts [example] -import { client } from './client.gen'; -import type { AddPetData, AddPetErrors, AddPetResponses } from './types.gen'; - -export class PetStore extends HeyApiClient { // [!code ++] - /** ... */ -} -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', // [!code ++] - strategy: 'single', - }, - }, - ], -}; -``` - -::: - -### Structure - -While we try to infer the SDK structure from `operationId` fields, you'll likely want to customize it further. You can do this using `operations.nesting`. - -Similar to the `operations.strategy` option, we provide a few presets. However, you gain the most control by providing your own function. - -To demonstrate the power of this feature, let's nest a few endpoints inside a `Pet` class and rename them. Our original `addPet()` method will now become `pet.add()`. Notice that we use the built-in `OperationPath.fromOperationId()` helper to handle the remaining operations. - -::: code-group - - -```ts [example] -import { client } from './client.gen'; -import type { AddPetData, AddPetErrors, AddPetResponses } from './types.gen'; - -export class Pet extends HeyApiClient { - public add(options: Options) { // [!code ++] - /** ... */ - } -} - -export class PetStore extends HeyApiClient { - get pet(): Pet { // [!code ++] - /** ... */ - } -} -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', - nesting(operation) { - if (operation.path === '/pet/{petId}' || operation.path === '/pet') { // [!code ++] - return ['pet', operation.operationId?.replace(/Pet/, '') // [!code ++] - || operation.method.toLocaleLowerCase()]; // [!code ++] - } // [!code ++] - return OperationPath.fromOperationId()(operation); // [!code ++] - }, - strategy: 'single', - }, - }, - ], -}; -``` - - -::: - -## Auth - -Most APIs require some form of authentication, which is why the SDK plugin provides built-in auth mechanisms by default. All you need to do is return the data from the `auth()` function, and the SDK will handle serialization and encoding for you. There are several ways to do this, for example on the client instance. - -::: code-group - -```ts [example] -import { client } from './client.gen'; - -client.setConfig({ - auth() { - return ''; - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - auth: true, // [!code ++] - name: '@hey-api/sdk', - }, - ], -}; -``` - -::: - -::: info -The SDK plugin currently supports only the `bearer` and `basic` auth schemes. [Open an issue](https://github.com/hey-api/openapi-ts/issues) if you'd like support for additional mechanisms. -::: - -## Validators - -Validating data at runtime comes with a performance cost, which is why it's not enabled by default. To enable validation, set `validator` to `zod` or one of the available [validator plugins](/openapi-ts/validators). This will implicitly add the selected plugin with default values. - -For a more granular approach, manually add a validator plugin and set `validator` to the plugin name or `true` to automatically select a compatible plugin. Until you customize the validator plugin, both approaches will produce the same default output. - -::: code-group - - -```ts [example] -import * as v from 'valibot'; - -export const addPet = (options: Options) => - (options.client ?? client).post({ - requestValidator: async (data) => // [!code ++] - await v.parseAsync(vAddPetData, data), // [!code ++] - responseValidator: async (data) => // [!code ++] - await v.parseAsync(vAddPetResponse, data), // [!code ++] - /** ... */ - }); -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - validator: true, // or 'valibot' // [!code ++] - }, - { - name: 'valibot', // customize (optional) // [!code ++] - // other options - }, - ], -}; -``` - -::: - -You can choose to validate only requests or responses. - -::: code-group - -```js [requests] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - validator: { - request: 'zod', // [!code ++] - }, - }, - ], -}; -``` - -```js [responses] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@hey-api/sdk', - validator: { - response: 'zod', // [!code ++] - }, - }, - ], -}; -``` - -::: - -Learn more about available validators on the [Validators](/openapi-ts/validators) page. - -## Code Examples - -The SDK plugin can generate ready-to-use code examples for each operation, showing how to call the SDK methods with proper parameters and setup. - -Examples are not generated by default, but you can enable and customize them through the `examples` option. With the default settings, an example might look like this. - -::: code-group - -```ts [example] -import { PetStore } from 'your-package'; - -await new PetStore().addPet(); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - examples: true, // [!code ++] - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', - strategy: 'single', - }, - }, - ], -}; -``` - -::: - -### Module and Setup - -To make examples more practical, configure `moduleName` to specify the package from which users import your SDK. - -Next, set `setupName` to indicate how users should instantiate the SDK, typically only once per application. - -::: code-group - -```ts [example] -import { PetStore } from '@petstore/client'; // [!code ++] - -const client = new PetStore(); // [!code ++] - -await client.addPet(); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - examples: { - moduleName: '@petstore/client', // [!code ++] - setupName: 'client', // [!code ++] - }, - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', - strategy: 'single', - }, - }, - ], -}; -``` - -::: - -### Initialization - -Often, your SDK needs to be instantiated with an API key or other configuration. In examples, `importSetup` lets you control how the SDK is initialized. - -::: code-group - - -```ts [example] -import { PetStore } from '@petstore/client'; - -const client = new PetStore({ // [!code ++] - apiKey: 'YOUR_API_KEY', // [!code ++] -}); // [!code ++] - -await client.addPet(); -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - examples: { - importSetup: ({ $, node }) => // [!code ++] - $.new( // [!code ++] - node.name, // [!code ++] - $.object() // [!code ++] - .pretty() // [!code ++] - .prop('apiKey', $.literal('YOUR_API_KEY')), // [!code ++] - ), // [!code ++] - moduleName: '@petstore/client', - setupName: 'client', - }, - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', - strategy: 'single', - }, - }, - ], -}; -``` - - -::: - -### Import Style - -If you re-export the generated SDK from your own module, you can adjust `importName` and `importKind` to match your actual import style. - -::: code-group - - -```ts [example] -import CatStore from '@petstore/client'; // [!code ++] - -const client = new CatStore({ // [!code ++] - apiKey: 'YOUR_API_KEY', -}); - -await client.addPet(); -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - examples: { - importKind: 'default', // [!code ++] - importName: 'CatStore', // [!code ++] - importSetup: ({ $, node }) => - $(node.name).call($.object().pretty().prop('apiKey', $.literal('YOUR_API_KEY'))), - moduleName: '@petstore/client', - setupName: 'client', - }, - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', - strategy: 'single', - }, - }, - ], -}; -``` - -::: - -### Payload - -You can customize the example request using the `payload` option. Requests can also be customized selectively. For example, we can provide a default payload only for the `addPet()` method. - -::: code-group - - -```ts [example] -import CatStore from '@petstore/client'; - -const client = new CatStore({ - apiKey: 'YOUR_API_KEY', -}); - -await client.addPet({ // [!code ++] - petId: 1234, // [!code ++] -}); // [!code ++] -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - examples: { - importKind: 'default', - importName: 'CatStore', - importSetup: ({ $, node }) => - $(node.name).call( - $.object().pretty().prop('apiKey', $.literal('YOUR_API_KEY')), - ), - moduleName: '@petstore/client', - payload(operation, ctx) { // [!code ++] - const { $ } = ctx; // [!code ++] - if (operation.path === '/pet/{petId}' || operation.path === '/pet') { // [!code ++] - return $.object().pretty().prop('petId', $.literal(1234)); // [!code ++] - } // [!code ++] - }, // [!code ++] - setupName: 'client', - }, - name: '@hey-api/sdk', - operations: { - containerName: 'PetStore', - strategy: 'single', - }, - }, - ], -}; -``` - - -::: - -### Display - -Enabling examples does not produce visible output on its own. Examples are written into the source specification and can be consumed by documentation tools such as [Scalar](https://kutt.to/skQUVd). To persist that specification, enable [Source](/openapi-ts/configuration/output#source) generation. - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/sdk/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/superstruct.md b/docs/openapi-ts/plugins/superstruct.md deleted file mode 100644 index 955551152e..0000000000 --- a/docs/openapi-ts/plugins/superstruct.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Superstruct -description: Superstruct plugin for Hey API. Compatible with all our features. ---- - - - -# Superstruct vote - - - -### About - -[Superstruct](https://docs.superstructjs.org) makes it easy to define interfaces and then validate JavaScript data against them. - - diff --git a/docs/openapi-ts/plugins/supertest.md b/docs/openapi-ts/plugins/supertest.md deleted file mode 100644 index 181a620f06..0000000000 --- a/docs/openapi-ts/plugins/supertest.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Supertest -description: Supertest plugin for Hey API. Compatible with all our features. ---- - - - -# Supertest vote - - - -### About - -[Supertest](https://github.com/ladjs/supertest) is a super-agent driven library for testing node.js HTTP servers using a fluent API. - - diff --git a/docs/openapi-ts/plugins/swr.md b/docs/openapi-ts/plugins/swr.md deleted file mode 100644 index 119740fc6c..0000000000 --- a/docs/openapi-ts/plugins/swr.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: SWR -description: SWR plugin for Hey API. Compatible with all our features. ---- - - - -# SWR vote - - - -### About - -[SWR](https://swr.vercel.app) is a strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data. - - diff --git a/docs/openapi-ts/plugins/tanstack-query.md b/docs/openapi-ts/plugins/tanstack-query.md deleted file mode 100644 index ace8cd5ad8..0000000000 --- a/docs/openapi-ts/plugins/tanstack-query.md +++ /dev/null @@ -1,625 +0,0 @@ ---- -title: TanStack Query v5 Plugin -description: Generate TanStack Query v5 functions and query keys from OpenAPI with the TanStack Query plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    TanStack Query v5

    - -
    - -### About - -[TanStack Query](https://tanstack.com/query) is a powerful asynchronous state management solution for TypeScript/JavaScript, React, Solid, Vue, Svelte, Angular, and Preact. - -The TanStack Query plugin for Hey API generates functions and query keys from your OpenAPI spec, fully compatible with SDKs, transformers, and all core features. - -### Demo - - - -## Features - -- TanStack Query v5 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- create query keys following the best practices -- type-safe query options, infinite query options, and mutation options -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add TanStack Query to your plugins and you'll be ready to generate TanStack Query artifacts. :tada: - -::: code-group - -```js [react] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@tanstack/react-query', // [!code ++] - ], -}; -``` - -```js [vue] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@tanstack/vue-query', // [!code ++] - ], -}; -``` - -```js [angular] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@tanstack/angular-query-experimental', // [!code ++] - ], -}; -``` - -```js [svelte] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@tanstack/svelte-query', // [!code ++] - ], -}; -``` - -```js [solid] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@tanstack/solid-query', // [!code ++] - ], -}; -``` - -```js [preact] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@tanstack/preact-query', // [!code ++] - ], -}; -``` - -::: - -## Output - -The TanStack Query plugin will generate the following artifacts, depending on the input specification. - -## Queries - -Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Options`, e.g., `getPetByIdOptions()`. - -::: code-group - -```ts [example] -const query = useQuery({ - ...getPetByIdOptions({ - path: { - petId: 1, - }, - }), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - queryOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `queryOptions` functions using the `.name` and `.case` options. - -### Meta - -You can use the `meta` field to attach arbitrary information to a query. To generate metadata for `queryOptions`, provide a function to the `.meta` option. - -::: code-group - -```ts [example] -queryOptions({ - // ...other fields - meta: { - id: 'getPetById', - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - queryOptions: { - meta: (operation) => ({ id: operation.id }), // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Query Keys - -Query keys contain normalized SDK function parameters and additional metadata. - -::: code-group - -```ts [example] -const queryKey = [ - { - _id: 'getPetById', - baseUrl: 'https://app.heyapi.dev', - path: { - petId: 1, - }, - }, -]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - queryKeys: true, // [!code ++] - }, - ], -}; -``` - -::: - -### Tags - -You can include operation tags in your query keys by setting `tags` to `true`. This will make query keys larger but provides better cache invalidation capabilities. - -::: code-group - -```ts [example] -const queryKey = [ - { - _id: 'getPetById', - baseUrl: 'https://app.heyapi.dev', - path: { - petId: 1, - }, - tags: ['pets', 'one', 'get'], // [!code ++] - }, -]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - queryKeys: { - tags: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Accessing Query Keys - -If you have access to the result of query options function, you can get the query key from the `queryKey` field. - -::: code-group - -```ts [example] -const { queryKey } = getPetByIdOptions({ - path: { - petId: 1, - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - queryOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `QueryKey`, e.g., `getPetByIdQueryKey()`. - -::: code-group - -```ts [example] -const queryKey = getPetByIdQueryKey({ - path: { - petId: 1, - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - queryKeys: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `queryKeys` functions using the `.name` and `.case` options. - -## Infinite Queries - -Infinite queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations) if we detect a [pagination](/openapi-ts/configuration/parser#pagination) parameter. The generated infinite query functions follow the naming convention of SDK functions and by default append `InfiniteOptions`, e.g., `getFooInfiniteOptions()`. - -::: code-group - -```ts [example] -const query = useInfiniteQuery({ - ...getFooInfiniteOptions({ - path: { - fooId: 1, - }, - }), - getNextPageParam: (lastPage, pages) => lastPage.nextCursor, - initialPageParam: 0, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - infiniteQueryOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `infiniteQueryOptions` functions using the `.name` and `.case` options. - -### Meta - -You can use the `meta` field to attach arbitrary information to a query. To generate metadata for `infiniteQueryOptions`, provide a function to the `.meta` option. - -::: code-group - -```ts [example] -infiniteQueryOptions({ - // ...other fields - meta: { - id: 'getPetById', - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - infiniteQueryOptions: { - meta: (operation) => ({ id: operation.id }), // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Infinite Query Keys - -Infinite query keys contain normalized SDK function parameters and additional metadata. - -::: code-group - -```ts [example] -const queryKey = [ - { - _id: 'getPetById', - _infinite: true, - baseUrl: 'https://app.heyapi.dev', - path: { - petId: 1, - }, - }, -]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - infiniteQueryKeys: true, // [!code ++] - }, - ], -}; -``` - -::: - -### Tags - -You can include operation tags in your infinite query keys by setting `tags` to `true`. This will make query keys larger but provides better cache invalidation capabilities. - -::: code-group - -```ts [example] -const queryKey = [ - { - _id: 'getPetById', - _infinite: true, - baseUrl: 'https://app.heyapi.dev', - path: { - petId: 1, - }, - tags: ['pets', 'one', 'get'], // [!code ++] - }, -]; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - infiniteQueryKeys: { - tags: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Accessing Infinite Query Keys - -If you have access to the result of infinite query options function, you can get the query key from the `queryKey` field. - -::: code-group - -```ts [example] -const { queryKey } = getPetByIdInfiniteOptions({ - path: { - petId: 1, - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - infiniteQueryOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `InfiniteQueryKey`, e.g., `getPetByIdInfiniteQueryKey()`. - -::: code-group - -```ts [example] -const queryKey = getPetByIdInfiniteQueryKey({ - path: { - petId: 1, - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - infiniteQueryKeys: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `infiniteQueryKeys` functions using the `.name` and `.case` options. - -## Mutations - -Mutations are generated from [mutation operations](/openapi-ts/configuration/parser#hooks-mutation-operations). The generated mutation functions follow the naming convention of SDK functions and by default append `Mutation`, e.g., `addPetMutation()`. - -::: code-group - -```ts [example] -const addPet = useMutation({ - ...addPetMutation(), - onError: (error) => { - console.log(error); - }, -}); - -addPet.mutate({ - body: { - name: 'Kitty', - }, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - mutationOptions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `mutationOptions` functions using the `.name` and `.case` options. - -### Meta - -You can use the `meta` field to attach arbitrary information to a mutation. To generate metadata for `mutationOptions`, provide a function to the `.meta` option. - -::: code-group - -```ts [example] -const mutationOptions = { - // ...other fields - meta: { - id: 'getPetById', - }, -}; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: '@tanstack/react-query', - mutationOptions: { - meta: (operation) => ({ id: operation.id }), // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Reactivity - -In Vue applications, you need to wrap the options functions in [`computed()`](https://vuejs.org/guide/essentials/computed) to make them reactive. Otherwise, TanStack Query won't know it should execute the query when its dependencies change. - -::: code-group - -```js [reactive] -// โœ… Query will execute on `petId` change -const query = useQuery( - computed(() => - getPetByIdOptions({ - path: { - petId: petId.value, - }, - }), - ), -); -``` - -```js [static] -// โŒ Query will execute only once -const query = useQuery( - getPetByIdOptions({ - path: { - petId: petId.value, - }, - }), -); -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/transformers.md b/docs/openapi-ts/plugins/transformers.md deleted file mode 100644 index 08e6e34bd3..0000000000 --- a/docs/openapi-ts/plugins/transformers.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -title: Transformers -description: Learn about transforming data with @hey-api/openapi-ts. ---- - -# Transformers - -JSON is the most commonly used data format in REST APIs. However, it does not map well to complex data types. For example, both regular strings and date strings become simple strings in JSON. - -One approach to this problem is using a [JSON superset](https://github.com/blitz-js/superjson). For most people, switching formats is not feasible. That's why we provide the `@hey-api/transformers` plugin. - -::: warning -Transformers currently handle only the most common use cases. If your data isn't being transformed as expected, we encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). -::: - -## Considerations - -Before deciding whether transformers are right for you, let's explain how they work. Transformers generate a runtime file, therefore they impact the bundle size. We generate a single transformer per operation response for the most efficient result, just like a human engineer would. - -### Limitations - -Transformers handle only the most common scenarios. Some of the known limitations are: - -- union types are not transformed (e.g., if you have multiple possible response shapes) -- only types defined through `$ref` are transformed -- error responses are not transformed - -If your data isn't being transformed as expected, we encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/transformers` to your plugins and you'll be ready to generate transformers. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@hey-api/transformers', // [!code ++] - ], -}; -``` - -## SDKs - -To automatically transform response data in your SDKs, set `sdk.transformer` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@hey-api/transformers', - { - name: '@hey-api/sdk', // [!code ++] - transformer: true, // [!code ++] - }, - ], -}; -``` - -## Dates - -To convert date strings into `Date` objects, use the `dates` configuration option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - dates: true, // [!code ++] - name: '@hey-api/transformers', - }, - ], -}; -``` - -This will generate types that use `Date` instead of `string` and appropriate transformers. Note that third-party date packages are not supported at the moment. - -## BigInt - -The `@hey-api/transformers` plugin will natively type all BigInts as `bigint` instead of `number`, which can affect arithmetic operations if your application previously used `number`. To force BigInts to be numbers, use the `bigInt` configuration option. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - bigInt: true, // [!code ++] - name: '@hey-api/transformers', - }, - ], -}; -``` - -## Example - -A generated response transformer might look something like this. Please note the example has been edited for brevity. - -::: code-group - -```ts [transformers.gen.ts] -import type { GetFooResponse } from './types.gen'; - -const quxSchemaResponseTransformer = (data: any) => { - if (data.baz) { - data.baz = new Date(data.baz); - } - return data; -}; - -const bazSchemaResponseTransformer = (data: any) => { - data = quxSchemaResponseTransformer(data); - data.bar = new Date(data.bar); - return data; -}; - -export const getFooResponseTransformer = async (data: any): Promise => { - data = bazSchemaResponseTransformer(data); - return data; -}; -``` - -```ts [types.gen.ts] -export type Baz = Qux & { - id: 'Baz'; -} & { - foo: number; - bar: Date; - baz: 'foo' | 'bar' | 'baz'; - qux: number; -}; - -export type Qux = { - foo: number; - bar: number; - baz?: Date; - id: string; -}; - -export type GetFooResponse = Baz; -``` - -::: - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/transformers/types.ts) interface. - - diff --git a/docs/openapi-ts/plugins/typebox.md b/docs/openapi-ts/plugins/typebox.md deleted file mode 100644 index 067a4f701d..0000000000 --- a/docs/openapi-ts/plugins/typebox.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: TypeBox -description: TypeBox plugin for Hey API. Compatible with all our features. ---- - - - -# TypeBox vote - - - -### About - -[TypeBox](https://github.com/sinclairzx81/typebox) is a JSON Schema type builder with static type resolution for TypeScript. - - diff --git a/docs/openapi-ts/plugins/typescript.md b/docs/openapi-ts/plugins/typescript.md deleted file mode 100644 index 90c4079ed5..0000000000 --- a/docs/openapi-ts/plugins/typescript.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: TypeScript -description: Learn about files generated with @hey-api/openapi-ts. ---- - -# TypeScript - -TypeScript interfaces are located in the `types.gen.ts` file. This is the only file that does not impact your bundle size and runtime performance. It will get discarded during build time, unless you configured to emit runtime [enums](#enums). - -## Installation - -In your [configuration](/openapi-ts/get-started), add `@hey-api/typescript` to your plugins and you'll be ready to generate TypeScript artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - '@hey-api/typescript', // [!code ++] - ], -}; -``` - -:::tip -The `@hey-api/typescript` plugin might be implicitly added to your `plugins` if another plugin depends on it. -::: - -## Output - -The TypeScript plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A single request type is generated for each endpoint. It may contain a request body, parameters, and headers. - -```ts -export type AddPetData = { - body: { - id?: number; - name: string; - }; - path?: never; - query?: never; - url: '/pets'; -}; -``` - -You can customize the naming and casing pattern for `requests` types using the `.name` and `.case` options. - -## Responses - -A single type is generated for all endpoint's responses. - -```ts -export type AddPetResponses = { - 200: { - id?: number; - name: string; - }; -}; - -export type AddPetResponse = AddPetResponses[keyof AddPetResponses]; -``` - -You can customize the naming and casing pattern for `responses` types using the `.name` and `.case` options. - -## Definitions - -A type is generated for every reusable definition from your input. - -```ts -export type Pet = { - id?: number; - name: string; -}; -``` - -You can customize the naming and casing pattern for `definitions` types using the `.name` and `.case` options. - -## Enums - -By default, `@hey-api/typescript` will emit enums only as types. You may want to generate runtime artifacts. A good use case is iterating through possible field values without manually typing arrays. To emit runtime enums, set `enums` to a valid option. - -::: code-group - -```js [disabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - enums: false, // default // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -```js [javascript] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - enums: 'javascript', // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -```js [typescript] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - enums: 'typescript', // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -::: - -We recommend exporting enums as plain JavaScript objects. [TypeScript enums](https://www.typescriptlang.org/docs/handbook/enums.html) are not a type-level extension of JavaScript and pose [typing challenges](https://dev.to/ivanzm123/dont-use-enums-in-typescript-they-are-very-dangerous-57bh). - -## Comments - -By default, `@hey-api/typescript` will include comments in the generated code based on descriptions from your OpenAPI specification. If you want to reduce the size of your generated files or prefer cleaner output, you can disable comments. - -::: code-group - -```js [enabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - comments: true, // default // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -```js [disabled] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - comments: false, // [!code ++] - name: '@hey-api/typescript', - }, - ], -}; -``` - -::: - -## Resolvers - -You can further customize this plugin's behavior using [resolvers](/openapi-ts/plugins/concepts/resolvers). - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/@hey-api/typescript/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/valibot.md b/docs/openapi-ts/plugins/valibot.md deleted file mode 100644 index 013cff5ca6..0000000000 --- a/docs/openapi-ts/plugins/valibot.md +++ /dev/null @@ -1,249 +0,0 @@ ---- -title: Valibot v1 Plugin -description: Generate Valibot v1 schemas from OpenAPI with the Valibot plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Valibot v1

    - -
    - -### About - -[Valibot](https://valibot.dev) is the open source schema library for TypeScript with bundle size, type safety and developer experience in mind. - -The Valibot plugin for Hey API generates schemas from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -## Features - -- Valibot v1 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- Valibot schemas for requests, responses, and reusable definitions -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `valibot` to your plugins and you'll be ready to generate Valibot artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'valibot', // [!code ++] - ], -}; -``` - -### SDKs - -To add data validators to your SDKs, set `sdk.validator` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'valibot', - { - name: '@hey-api/sdk', // [!code ++] - validator: true, // [!code ++] - }, - ], -}; -``` - -Learn more about data validators in your SDKs on the [SDKs](/openapi-ts/plugins/sdk#validators) page. - -## Output - -The Valibot plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A Valibot schema is generated for every request layer of each endpoint. - -::: code-group - -```ts [example] -const vDeletePetHeaders = v.object({ - api_key: v.optional(v.string()), -}); - -const vDeletePetPath = v.object({ - petId: v.number(), -}); - -const vDeletePetQuery = v.object({ - additionalMetadata: v.string(), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'valibot', - requests: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `requests` schemas using the `.name` and `.case` options. - -## Responses - -A single Valibot schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes. - -::: code-group - -```ts [example] -const vResponse = v.union([ - v.object({ - foo: v.optional(v.string()), - }), - v.object({ - bar: v.optional(v.number()), - }), -]); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'valibot', - responses: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `responses` schemas using the `.name` and `.case` options. - -## Definitions - -A Valibot schema is generated for every reusable definition from your input. - -::: code-group - -```ts [example] -const vFoo = v.pipe(v.number(), v.integer()); - -const vBar = v.object({ - bar: v.optional(v.array(v.pipe(v.number(), v.integer()))), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'valibot', - definitions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `definitions` schemas using the `.name` and `.case` options. - -## Metadata - -It's often useful to associate a schema with some additional [metadata](https://valibot.dev/api/metadata/) for documentation, code generation, AI structured outputs, form validation, and other purposes. You can set `metadata` to `true` to attach descriptions to schemas when available. - -::: code-group - -```ts [example] -export const vFoo = v.pipe( - v.string(), - v.metadata({ - description: 'Additional metadata', - }), -); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'valibot', - metadata: true, // [!code ++] - }, - ], -}; -``` - -::: - -For more control over metadata, you can provide your own function. It receives the source `schema`, the target `node` object, and the `$` builder for populating metadata. - -::: code-group - -```ts [example] -export const vFoo = v.pipe( - v.string(), - v.metadata({ - hasTitle: false, - createdAt: 1735732800000, - }), -); -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'valibot', - metadata({ $, node, schema }) { // [!code ++] - node.prop('hasTitle', $.literal(Boolean(schema.title))); // [!code ++] - node.prop('createdAt', $.literal(Date.now())); // [!code ++] - }, // [!code ++] - }, - ], -}; -``` - - -::: - -## Resolvers - -You can further customize this plugin's behavior using [resolvers](/openapi-ts/plugins/concepts/resolvers). - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/valibot/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/yup.md b/docs/openapi-ts/plugins/yup.md deleted file mode 100644 index cad6db8d42..0000000000 --- a/docs/openapi-ts/plugins/yup.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Yup -description: Yup plugin for Hey API. Compatible with all our features. ---- - - - -# Yup vote - - - -### About - -[Yup](https://github.com/jquense/yup) is a schema builder for runtime value parsing and validation. - - diff --git a/docs/openapi-ts/plugins/zod.md b/docs/openapi-ts/plugins/zod.md deleted file mode 100644 index 7c471ceef9..0000000000 --- a/docs/openapi-ts/plugins/zod.md +++ /dev/null @@ -1,338 +0,0 @@ ---- -title: Zod v4 Plugin -description: Generate Zod v4 schemas from OpenAPI with the Zod plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Zod v4

    - -
    - -### About - -[Zod](https://zod.dev) is a TypeScript-first schema validation library with static type inference. - -The Zod plugin for Hey API generates schemas from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -## Features - -- Zod v4 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- Zod schemas for requests, responses, and reusable definitions -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `zod` to your plugins and you'll be ready to generate Zod artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'zod', // [!code ++] - ], -}; -``` - -### SDKs - -To add data validators to your SDKs, set `sdk.validator` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - 'zod', - { - name: '@hey-api/sdk', // [!code ++] - validator: true, // [!code ++] - }, - ], -}; -``` - -Learn more about data validators in your SDKs on the [SDKs](/openapi-ts/plugins/sdk#validators) page. - -## Output - -The Zod plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A Zod schema is generated for every request layer of each endpoint. - -::: code-group - -```ts [example] -const zDeletePetHeaders = z.object({ - api_key: z.string().optional(), -}); - -const zDeletePetPath = z.object({ - petId: z.number(), -}); - -const zDeletePetQuery = z.object({ - additionalMetadata: z.string(), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - requests: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `requests` schemas using the `.name` and `.case` options. - -## Responses - -A single Zod schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes. - -::: code-group - -```ts [example] -const zResponse = z.union([ - z.object({ - foo: z.optional(z.string()), - }), - z.object({ - bar: z.optional(z.number()), - }), -]); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - responses: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `responses` schemas using the `.name` and `.case` options. - -## Definitions - -A Zod schema is generated for every reusable definition from your input. - -::: code-group - -```ts [example] -const zFoo = z.int(); - -const zBar = z.object({ - bar: z.optional(z.array(z.int())), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - definitions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `definitions` schemas using the `.name` and `.case` options. - -## ISO Datetimes - -By default, values without a timezone or with a timezone offset are not allowed in the `z.iso.datetime()` method. - -### Timezone offsets - -You can allow values with timezone offsets by setting `dates.offset` to `true`. - -::: code-group - -```ts [example] -export const zFoo = z.iso.datetime({ offset: true }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - dates: { - offset: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Local times - -You can allow values without a timezone by setting `dates.local` to `true`. - -::: code-group - -```ts [example] -export const zFoo = z.iso.datetime({ local: true }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - dates: { - local: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Metadata - -It's often useful to associate a schema with some additional [metadata](https://zod.dev/metadata) for documentation, code generation, AI structured outputs, form validation, and other purposes. You can set `metadata` to `true` to attach descriptions to schemas when available. - -::: code-group - -```ts [example] -export const zFoo = z.string().register(z.globalRegistry, { - description: 'Additional metadata', -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - metadata: true, // [!code ++] - }, - ], -}; -``` - -::: - -For more control over metadata, you can provide your own function. It receives the source `schema`, the target `node` object, and the `$` builder for populating metadata. - -::: code-group - -```ts [example] -export const zFoo = z.string().register(z.globalRegistry, { - hasTitle: true, - createdAt: 1735732800000, -}); -``` - - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - metadata({ $, node, schema }) { // [!code ++] - node.prop('hasTitle', $.literal(Boolean(schema.title))); // [!code ++] - node.prop('createdAt', $.literal(Date.now())); // [!code ++] - }, // [!code ++] - }, - ], -}; -``` - - -::: - -## Types - -In addition to Zod schemas, you can generate schema-specific types. These can be generated for all schemas or for specific resources. - -::: code-group - -```ts [example] -export type ResponseZodType = z.infer; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - types: { - infer: false, // by default, no `z.infer` types [!code ++] - }, - responses: { - types: { - infer: true, // `z.infer` types only for response schemas [!code ++] - }, - }, - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for schema-specific `types` using the `.name` and `.case` options. - -## Resolvers - -You can further customize this plugin's behavior using [resolvers](/openapi-ts/plugins/concepts/resolvers). - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/zod/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/zod/mini.md b/docs/openapi-ts/plugins/zod/mini.md deleted file mode 100644 index 5ad63ee729..0000000000 --- a/docs/openapi-ts/plugins/zod/mini.md +++ /dev/null @@ -1,351 +0,0 @@ ---- -title: Zod Mini Plugin -description: Generate Zod Mini schemas from OpenAPI with the Zod plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Zod Mini

    - -
    - -### About - -[Zod](https://zod.dev) is a TypeScript-first schema validation library with static type inference. - -The Zod plugin for Hey API generates schemas from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -## Features - -- Zod Mini support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- Zod schemas for requests, responses, and reusable definitions -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `zod` to your plugins and you'll be ready to generate Zod artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', // [!code ++] - compatibilityVersion: 'mini', // [!code ++] - }, - ], -}; -``` - -### SDKs - -To add data validators to your SDKs, set `sdk.validator` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - }, - { - name: '@hey-api/sdk', // [!code ++] - validator: true, // [!code ++] - }, - ], -}; -``` - -Learn more about data validators in your SDKs on the [SDKs](/openapi-ts/plugins/sdk#validators) page. - -## Output - -The Zod plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A Zod schema is generated for every request layer of each endpoint. - -::: code-group - -```ts [example] -const zDeletePetHeaders = z.object({ - api_key: z.optional(z.string()), -}); - -const zDeletePetPath = z.object({ - petId: z.number(), -}); - -const zDeletePetQuery = z.object({ - additionalMetadata: z.string(), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - requests: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `requests` schemas using the `.name` and `.case` options. - -## Responses - -A single Zod schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes. - -::: code-group - -```ts [example] -const zResponse = z.union([ - z.object({ - foo: z.optional(z.string()), - }), - z.object({ - bar: z.optional(z.number()), - }), -]); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - responses: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `responses` schemas using the `.name` and `.case` options. - -## Definitions - -A Zod schema is generated for every reusable definition from your input. - -::: code-group - -```ts [example] -const zFoo = z.int(); - -const zBar = z.object({ - bar: z.optional(z.array(z.int())), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - definitions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `definitions` schemas using the `.name` and `.case` options. - -## ISO Datetimes - -By default, values without a timezone or with a timezone offset are not allowed in the `z.iso.datetime()` method. - -### Timezone offsets - -You can allow values with timezone offsets by setting `dates.offset` to `true`. - -::: code-group - -```ts [example] -export const zFoo = z.iso.datetime({ offset: true }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - dates: { - offset: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Local times - -You can allow values without a timezone by setting `dates.local` to `true`. - -::: code-group - -```ts [example] -export const zFoo = z.iso.datetime({ local: true }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - dates: { - local: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Metadata - -It's often useful to associate a schema with some additional [metadata](https://zod.dev/metadata) for documentation, code generation, AI structured outputs, form validation, and other purposes. You can set `metadata` to `true` to attach descriptions to schemas when available. - -::: code-group - -```ts [example] -export const zFoo = z.string().register(z.globalRegistry, { - description: 'Additional metadata', -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - metadata: true, // [!code ++] - }, - ], -}; -``` - -::: - -For more control over metadata, you can provide your own function. It receives the source `schema`, the target `node` object, and the `$` builder for populating metadata. - -::: code-group - -```ts [example] -export const zFoo = z.string().register(z.globalRegistry, { - hasTitle: true, - createdAt: 1735732800000, -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - metadata({ $, node, schema }) { - // [!code ++] - node.prop('hasTitle', $.literal(Boolean(schema.title))); // [!code ++] - node.prop('createdAt', $.literal(Date.now())); // [!code ++] - }, // [!code ++] - }, - ], -}; -``` - -::: - -## Types - -In addition to Zod schemas, you can generate schema-specific types. These can be generated for all schemas or for specific resources. - -::: code-group - -```ts [example] -export type ResponseZodType = z.infer; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 'mini', - types: { - infer: false, // by default, no `z.infer` types [!code ++] - }, - responses: { - types: { - infer: true, // `z.infer` types only for response schemas [!code ++] - }, - }, - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for schema-specific `types` using the `.name` and `.case` options. - -## Resolvers - -You can further customize this plugin's behavior using [resolvers](/openapi-ts/plugins/concepts/resolvers). - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/zod/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/zod/v3.md b/docs/openapi-ts/plugins/zod/v3.md deleted file mode 100644 index 416902d5e8..0000000000 --- a/docs/openapi-ts/plugins/zod/v3.md +++ /dev/null @@ -1,317 +0,0 @@ ---- -title: Zod v3 Plugin -description: Generate Zod v3 schemas from OpenAPI with the Zod plugin for openapi-ts. Fully compatible with validators, transformers, and all core features. ---- - - - - -

    Zod v3

    - -
    - -### About - -[Zod](https://v3.zod.dev/) is a TypeScript-first schema validation library with static type inference. - -The Zod plugin for Hey API generates schemas from your OpenAPI spec, fully compatible with validators, transformers, and all core features. - -## Features - -- Zod v3 support -- seamless integration with `@hey-api/openapi-ts` ecosystem -- Zod schemas for requests, responses, and reusable definitions -- minimal learning curve thanks to extending the underlying technology - -## Installation - -In your [configuration](/openapi-ts/get-started), add `zod` to your plugins and you'll be ready to generate Zod artifacts. :tada: - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', // [!code ++] - compatibilityVersion: 3, // [!code ++] - }, - ], -}; -``` - -### SDKs - -To add data validators to your SDKs, set `sdk.validator` to `true`. - -```js -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - }, - { - name: '@hey-api/sdk', // [!code ++] - validator: true, // [!code ++] - }, - ], -}; -``` - -Learn more about data validators in your SDKs on the [SDKs](/openapi-ts/plugins/sdk#validators) page. - -## Output - -The Zod plugin will generate the following artifacts, depending on the input specification. - -## Requests - -A Zod schema is generated for every request layer of each endpoint. - -::: code-group - -```ts [example] -const zDeletePetHeaders = z.object({ - api_key: z.string().optional(), -}); - -const zDeletePetPath = z.object({ - petId: z.number(), -}); - -const zDeletePetQuery = z.object({ - additionalMetadata: z.string(), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - requests: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `requests` schemas using the `.name` and `.case` options. - -## Responses - -A single Zod schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes. - -::: code-group - -```ts [example] -const zResponse = z.union([ - z.object({ - foo: z.string().optional(), - }), - z.object({ - bar: z.number().optional(), - }), -]); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - responses: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `responses` schemas using the `.name` and `.case` options. - -## Definitions - -A Zod schema is generated for every reusable definition from your input. - -::: code-group - -```ts [example] -const zFoo = z.number().int(); - -const zBar = z.object({ - bar: z.array(z.number().int()).optional(), -}); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - definitions: true, // [!code ++] - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for `definitions` schemas using the `.name` and `.case` options. - -## ISO Datetimes - -By default, values without a timezone or with a timezone offset are not allowed in the `z.string().datetime()` method. - -### Timezone offsets - -You can allow values with timezone offsets by setting `dates.offset` to `true`. - -::: code-group - -```ts [example] -export const zFoo = z.string().datetime({ offset: true }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - dates: { - offset: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -### Local times - -You can allow values without a timezone by setting `dates.local` to `true`. - -::: code-group - -```ts [example] -export const zFoo = z.string().datetime({ local: true }); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - dates: { - local: true, // [!code ++] - }, - }, - ], -}; -``` - -::: - -## Metadata - -It's often useful to associate a schema with some additional [metadata](https://v3.zod.dev/?id=describe) for documentation, code generation, AI structured outputs, form validation, and other purposes. If this is your use case, you can set `metadata` to `true` to generate additional metadata about schemas. - -::: code-group - -```ts [example] -export const zFoo = z.string().describe('Additional metadata'); -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - metadata: true, // [!code ++] - }, - ], -}; -``` - -::: - -## Types - -In addition to Zod schemas, you can generate schema-specific types. These can be generated for all schemas or for specific resources. - -::: code-group - -```ts [example] -export type ResponseZodType = z.infer; -``` - -```js [config] -export default { - input: 'hey-api/backend', // sign up at app.heyapi.dev - output: 'src/client', - plugins: [ - // ...other plugins - { - name: 'zod', - compatibilityVersion: 3, - types: { - infer: false, // by default, no `z.infer` types [!code ++] - }, - responses: { - types: { - infer: true, // `z.infer` types only for response schemas [!code ++] - }, - }, - }, - ], -}; -``` - -::: - -You can customize the naming and casing pattern for schema-specific `types` using the `.name` and `.case` options. - -## Resolvers - -You can further customize this plugin's behavior using [resolvers](/openapi-ts/plugins/concepts/resolvers). - -## API - -You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/zod/types.ts) interface. - - - diff --git a/docs/openapi-ts/plugins/zustand.md b/docs/openapi-ts/plugins/zustand.md deleted file mode 100644 index 1a0617d0e7..0000000000 --- a/docs/openapi-ts/plugins/zustand.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Zustand -description: Zustand plugin for Hey API. Compatible with all our features. ---- - - - -# Zustand vote - - - -### About - -[Zustand](https://zustand-demo.pmnd.rs) is a small, fast, and scalable bearbones state management solution. - - diff --git a/docs/openapi-ts/state-management.md b/docs/openapi-ts/state-management.md deleted file mode 100644 index c092e26815..0000000000 --- a/docs/openapi-ts/state-management.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: State Management -description: Learn about handling state with @hey-api/openapi-ts. ---- - -# State Management - -Any reasonably large application will have to deal with state management at some point. State-related code is often one of the biggest boilerplates in your codebase. Well, at least until you start using our state management plugins. - -## Options - -Hey API natively supports the following state managers. - -- [Pinia Colada](/openapi-ts/plugins/pinia-colada) -- [TanStack Query](/openapi-ts/plugins/tanstack-query) -- [SWR](/openapi-ts/plugins/swr) vote -- [Zustand](/openapi-ts/plugins/zustand) vote - -Don't see your state manager? Let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues). - - - diff --git a/docs/openapi-ts/validators.md b/docs/openapi-ts/validators.md deleted file mode 100644 index 74df441745..0000000000 --- a/docs/openapi-ts/validators.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Validators -description: Learn about validating data with @hey-api/openapi-ts. ---- - -# Validators - -There are times when you cannot blindly trust the server to return the correct data. You might be working on a critical application where any mistakes would be costly, or you're simply dealing with a legacy or undocumented system. - -Whatever your reason to use validators might be, you can rest assured that you're working with the correct data. - -## Features - -- seamless integration with `@hey-api/openapi-ts` ecosystem -- schemas for requests, responses, and reusable definitions - -## Options - -Hey API natively supports the following validators. - -- [Valibot](/openapi-ts/plugins/valibot) -- [Zod](/openapi-ts/plugins/zod) -- [Ajv](/openapi-ts/plugins/ajv) vote -- [Arktype](/openapi-ts/plugins/arktype) vote -- [Joi](/openapi-ts/plugins/joi) vote -- [TypeBox](/openapi-ts/plugins/typebox) vote -- [Yup](/openapi-ts/plugins/yup) vote - -Don't see your validator? Let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues). - - - diff --git a/docs/openapi-ts/web-frameworks.md b/docs/openapi-ts/web-frameworks.md deleted file mode 100644 index beb96c8e61..0000000000 --- a/docs/openapi-ts/web-frameworks.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Web Frameworks -description: Learn about generating web framework code with @hey-api/openapi-ts. ---- - -# Web Frameworks - -There are two approaches to developing APIs: code-first, where you start with the code, or spec-first, where you begin with the specification. If you use the latter, you can ensure your APIs adhere to the specification with our web framework plugins. - -## Options - -Hey API natively supports the following frameworks. - -- [Angular](/openapi-ts/plugins/angular) -- [Fastify](/openapi-ts/plugins/fastify) -- [Nest](/openapi-ts/plugins/nest) -- [oRPC](/openapi-ts/plugins/orpc) -- [Adonis](/openapi-ts/plugins/adonis) vote -- [Elysia](/openapi-ts/plugins/elysia) vote -- [Express](/openapi-ts/plugins/express) vote -- [Hono](/openapi-ts/plugins/hono) vote -- [Koa](/openapi-ts/plugins/koa) vote - -Don't see your framework? Let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues). - - - diff --git a/docs/package.json b/docs/package.json deleted file mode 100644 index 64431ed838..0000000000 --- a/docs/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "docs", - "version": "0.10.4", - "private": true, - "description": "Documentation for OpenAPI TypeScript.", - "type": "module", - "scripts": { - "build": "vitepress build", - "dev": "vitepress dev", - "preview": "vitepress preview" - }, - "dependencies": { - "@stackblitz/sdk": "1.11.0", - "vue3-select-component": "0.16.0" - }, - "devDependencies": { - "sharp": "0.34.5", - "vitepress": "2.0.0-alpha.16", - "vitepress-plugin-llms": "1.12.0", - "vue": "3.5.25" - } -} diff --git a/docs/partials/contributors-list.md b/docs/partials/contributors-list.md deleted file mode 100644 index d1b77750b1..0000000000 --- a/docs/partials/contributors-list.md +++ /dev/null @@ -1,121 +0,0 @@ -- [Ahmed Rowaihi](https://github.com/ahmedrowaihi) -- [Alessandro](https://github.com/ale18V) -- [Alex Sagal](https://github.com/spikesagal) -- [Alex Sarychev](https://github.com/Freddis) -- [Alex Vukadinov](https://github.com/alexvuka1) -- [Alex Yang](https://github.com/himself65) -- [Alexander Horner](https://github.com/alexanderhorner) -- [Alexander Skvortcov](https://github.com/askvortcov) -- [Andrea](https://github.com/andreasciamanna) -- [Andreas Adam](https://github.com/pixelmord) -- [Ben Vincent](https://github.com/bvincent1) -- [Bjรถrn Henriksson](https://github.com/bjornhenriksson) -- [Bogdan ](https://github.com/BogdanMaier) -- [Brian Tarricone](https://github.com/kelnos) -- [Bryon Larrance](https://github.com/beelarr) -- [Carl Kittelberger](https://github.com/icedream) -- [Changwan](https://github.com/WooWan) -- [Chris Wiggins](https://github.com/chriswiggins) -- [Daniel Roe](https://github.com/danielroe) -- [Daschi](https://github.com/Daschi1) -- [David Bieregger](https://github.com/BierDav) -- [David Ovฤaฤรญk](https://github.com/dovca) -- [Dmitriy Brolnickij](https://github.com/brolnickij) -- [Dmitry](https://github.com/codercms) -- [Erikwski](https://github.com/erikwski) -- [Finn Poppinga](https://github.com/fpoppinga) -- [Flo Edelmann](https://github.com/FloEdelmann) -- [Florian Lutze](https://github.com/flow96) -- [Francisco Garcรญa](https://github.com/goltra) -- [George Smith](https://github.com/georgesmith46) -- [Gergan Penkov](https://github.com/gergan) -- [Hector Ayala](https://github.com/bombillazo) -- [Hiram Chirino](https://github.com/chirino) -- [Idan Ben Ami](https://github.com/idbenami) -- [Inas Sirhan](https://github.com/inas-sirhan) -- [Jan](https://github.com/JanST123) -- [Jason Lee](https://github.com/LeeChSien) -- [Jason Westover](https://github.com/j-westover) -- [Jeff James](https://github.com/jsjames) -- [Jianqi Pan](https://github.com/Jannchie) -- [Jo](https://github.com/josh-hemphill) -- [John Gozde](https://github.com/jgoz) -- [Jordan Shatford](https://github.com/jordanshatford) -- [Joshua](https://github.com/Joshua-hypt) -- [Jostein Stuhaug](https://github.com/josstn) -- [Juan Ibarra](https://github.com/j-ibarra) -- [Julian Klumpers](https://github.com/julianklumpers) -- [Karl Stoney](https://github.com/Stono) -- [Keigo Ando](https://github.com/anchan828) -- [Kenneth Apeland](https://github.com/kennidenni) -- [Landon Gavin](https://github.com/seriouslag) -- [Laurin](https://github.com/lausek) -- [Lee Lian Hoy](https://github.com/bakakaba) -- [Leo Developer](https://github.com/Le0Developer) -- [Linus Fischer](https://github.com/LeiCraft) -- [Louis Duchemin](https://github.com/lsdch) -- [Lubos](https://github.com/mrlubos) -- [Lukas Podmelle](https://github.com/lukaspodmelle) -- [Luke Rohde](https://github.com/thyming) -- [Maarten Knijnenberg](https://github.com/mknijnenberg) -- [Mads Hougesen](https://github.com/hougesen) -- [Malcolm Kee](https://github.com/malcolm-kee) -- [Marcel Richter](https://github.com/mrclrchtr) -- [Marek Lukรกลก](https://github.com/tajnymag) -- [Martรญn Fernรกndez](https://github.com/bilby91) -- [Matsu](https://github.com/Matsuuu) -- [Maurici Abad Gutierrez](https://github.com/mauriciabad) -- [Max Scopp](https://github.com/max-scopp) -- [Maximilian Dewald](https://github.com/maxdewald) -- [Michaล‚ Grezel](https://github.com/dracomithril) -- [Michiel Lankamp](https://github.com/mlankamp) -- [Mika Vilpas](https://github.com/mikavilpas) -- [Miklos](https://github.com/jumika) -- [Nacho Garcรญa](https://github.com/nachogarcia) -- [Nicolas Chaulet](https://github.com/nicolas-chaulet) -- [Niels Mokkenstorm](https://github.com/nmokkenstorm) -- [Nikita Perepelitsa](https://github.com/quartepie) -- [Nimo Beeren](https://github.com/nimobeeren) -- [Novak Antonijevic](https://github.com/NovakAnton) -- [Ondล™ej Maxa](https://github.com/maxa-ondrej) -- [Pascal Ernst](https://github.com/LinuCC) -- [Peter Graugaard](https://github.com/pgraug) -- [Philipp Katz](https://github.com/qqilihq) -- [Phuc Tran](https://github.com/Glup3) -- [Rico](https://github.com/btmnk) -- [Roland Weiss](https://github.com/rolego) -- [Ryo Yamada](https://github.com/Liooo) -- [Sebastiaan Wouters](https://github.com/SebastiaanWouters) -- [Shinigami](https://github.com/Shinigami92) -- [Simen Bekkhus](https://github.com/SimenB) -- [Sipan Petrosyan](https://github.com/SipanP) -- [Sjoerd Scheffer](https://github.com/ixnas) -- [Spencer Sargent](https://github.com/sbs44) -- [Stephen Zhou](https://github.com/hyoban) -- [Stian Jensen](https://github.com/stianjensen) -- [Sukka](https://github.com/SukkaW) -- [Tom van de Velde](https://github.com/tomvdv) -- [Vincent Olesen](https://github.com/volesen) -- [Warren Seine](https://github.com/warrenseine) -- [Yuri Mikhin](https://github.com/mikhin) -- [a1mer](https://github.com/a1mersnow) -- [carson](https://github.com/carson2222) -- [chrg1001](https://github.com/chrg1001) -- [johnny kim](https://github.com/johnny-mh) -- [0xfurai](https://github.com/0xfurai) -- [9M6](https://github.com/9M6) -- [Ben-Pfirsich](https://github.com/Ben-Pfirsich) -- [Copilot](https://github.com/Copilot) -- [Daschi2](https://github.com/Daschi2) -- [Mxwllas](https://github.com/Mxwllas) -- [RndUsername](https://github.com/RndUsername) -- [Schroedi](https://github.com/Schroedi) -- [alexedme](https://github.com/alexedme) -- [ben-pietsch](https://github.com/ben-pietsch) -- [fml09](https://github.com/fml09) -- [henry-encord](https://github.com/henry-encord) -- [hunshcn](https://github.com/hunshcn) -- [jcx0](https://github.com/jcx0) -- [maxdew-envelio](https://github.com/maxdew-envelio) -- [nnzhadow](https://github.com/nnzhadow) -- [renoschubert](https://github.com/renoschubert) diff --git a/docs/partials/examples.md b/docs/partials/examples.md deleted file mode 100644 index 70754bf7da..0000000000 --- a/docs/partials/examples.md +++ /dev/null @@ -1,3 +0,0 @@ -## Examples - -You can view live examples on [StackBlitz](https://stackblitz.com/orgs/github/hey-api/collections/openapi-ts-examples). diff --git a/docs/partials/sponsors-list.md b/docs/partials/sponsors-list.md deleted file mode 100644 index f945979039..0000000000 --- a/docs/partials/sponsors-list.md +++ /dev/null @@ -1,87 +0,0 @@ -### Gold - - - -### Silver - - - -### Bronze - - - -### Friends - - diff --git a/docs/partials/sponsors.md b/docs/partials/sponsors.md deleted file mode 100644 index 0cab7feda2..0000000000 --- a/docs/partials/sponsors.md +++ /dev/null @@ -1,9 +0,0 @@ -## Sponsors - -Partners behind the future of API tooling. [Become a sponsor](https://github.com/sponsors/hey-api). - -
    - - - -
    diff --git a/docs/public/assets/cella/logo-dark.svg b/docs/public/assets/cella/logo-dark.svg deleted file mode 100644 index 4e8b17a124..0000000000 --- a/docs/public/assets/cella/logo-dark.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - logo - - - - - - diff --git a/docs/public/assets/cella/logo-light.svg b/docs/public/assets/cella/logo-light.svg deleted file mode 100644 index d25daa8f18..0000000000 --- a/docs/public/assets/cella/logo-light.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - logo - - - - - - diff --git a/docs/public/assets/fastapi/logo-dark.svg b/docs/public/assets/fastapi/logo-dark.svg deleted file mode 100644 index fc82afb1eb..0000000000 --- a/docs/public/assets/fastapi/logo-dark.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/fastapi/logo-light.svg b/docs/public/assets/fastapi/logo-light.svg deleted file mode 100644 index 950c97d74b..0000000000 --- a/docs/public/assets/fastapi/logo-light.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/icons/dark.svg b/docs/public/assets/icons/dark.svg deleted file mode 100644 index ce1a940ec6..0000000000 --- a/docs/public/assets/icons/dark.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/icons/light.svg b/docs/public/assets/icons/light.svg deleted file mode 100644 index 856ff682f2..0000000000 --- a/docs/public/assets/icons/light.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/mintlify/logo-dark.svg b/docs/public/assets/mintlify/logo-dark.svg deleted file mode 100644 index 81930f1ad9..0000000000 --- a/docs/public/assets/mintlify/logo-dark.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - diff --git a/docs/public/assets/mintlify/logo-light.svg b/docs/public/assets/mintlify/logo-light.svg deleted file mode 100644 index 2fb05e66e9..0000000000 --- a/docs/public/assets/mintlify/logo-light.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - diff --git a/docs/public/assets/opencode/logo-dark.svg b/docs/public/assets/opencode/logo-dark.svg deleted file mode 100644 index 10fe1eff47..0000000000 --- a/docs/public/assets/opencode/logo-dark.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/opencode/logo-light.svg b/docs/public/assets/opencode/logo-light.svg deleted file mode 100644 index 84da1dc37f..0000000000 --- a/docs/public/assets/opencode/logo-light.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/raw/hero.png b/docs/public/assets/raw/hero.png deleted file mode 100644 index 84a2da5705..0000000000 Binary files a/docs/public/assets/raw/hero.png and /dev/null differ diff --git a/docs/public/assets/raw/kinde-logo-wordmark-dark.png b/docs/public/assets/raw/kinde-logo-wordmark-dark.png deleted file mode 100644 index c16149fccf..0000000000 Binary files a/docs/public/assets/raw/kinde-logo-wordmark-dark.png and /dev/null differ diff --git a/docs/public/assets/raw/kinde-logo-wordmark.png b/docs/public/assets/raw/kinde-logo-wordmark.png deleted file mode 100644 index 6d3f965049..0000000000 Binary files a/docs/public/assets/raw/kinde-logo-wordmark.png and /dev/null differ diff --git a/docs/public/assets/raw/logo-astronaut.png b/docs/public/assets/raw/logo-astronaut.png deleted file mode 100644 index abfe4cc813..0000000000 Binary files a/docs/public/assets/raw/logo-astronaut.png and /dev/null differ diff --git a/docs/public/assets/raw/logo.png b/docs/public/assets/raw/logo.png deleted file mode 100644 index 79f4b2b142..0000000000 Binary files a/docs/public/assets/raw/logo.png and /dev/null differ diff --git a/docs/public/assets/raw/logo.svg b/docs/public/assets/raw/logo.svg deleted file mode 100644 index 154ffbc8c5..0000000000 --- a/docs/public/assets/raw/logo.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/public/assets/raw/openapi-ts-hero.png b/docs/public/assets/raw/openapi-ts-hero.png deleted file mode 100644 index 11dc1582c1..0000000000 Binary files a/docs/public/assets/raw/openapi-ts-hero.png and /dev/null differ diff --git a/docs/public/assets/raw/stainless-logo-wordmark.png b/docs/public/assets/raw/stainless-logo-wordmark.png deleted file mode 100644 index b278d4e98e..0000000000 Binary files a/docs/public/assets/raw/stainless-logo-wordmark.png and /dev/null differ diff --git a/docs/public/assets/scalar/logo-dark.svg b/docs/public/assets/scalar/logo-dark.svg deleted file mode 100644 index eac42d149e..0000000000 --- a/docs/public/assets/scalar/logo-dark.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/docs/public/assets/scalar/logo-light.svg b/docs/public/assets/scalar/logo-light.svg deleted file mode 100644 index 2b9deddfa4..0000000000 --- a/docs/public/assets/scalar/logo-light.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/docs/public/robots.txt b/docs/public/robots.txt deleted file mode 100644 index 05d945c0e5..0000000000 --- a/docs/public/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -User-agent: * -Allow: / - -Sitemap: https://heyapi.dev/sitemap.xml diff --git a/docs/tsconfig.json b/docs/tsconfig.json deleted file mode 100644 index 459dcb7cdb..0000000000 --- a/docs/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "esModuleInterop": true, - "module": "nodenext", - "paths": { - "@components/*": ["./.vitepress/theme/components/*"], - "@data": ["./data/*"], - "@versions/*": ["./.vitepress/theme/versions/*"] - } - }, - "include": [".vitepress/**/*", "./**/*.ts", "./**/*.vue"] -} diff --git a/eslint.config.js b/eslint.config.js index d9d61f2aee..b5d78bffbb 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -81,8 +81,6 @@ export default tseslint.config( '**/.nuxt/', '**/.output/', '**/.svelte-kit/', - '**/.vitepress/cache', - '**/.vitepress/dist', '**/.vercel', '**/.angular', '**/web/src/components/pages/**/previews/', diff --git a/patches/vitepress.patch b/patches/vitepress.patch deleted file mode 100644 index b6f6db6bb8..0000000000 --- a/patches/vitepress.patch +++ /dev/null @@ -1,288 +0,0 @@ -diff --git a/dist/client/shared.js b/dist/client/shared.js -index f65eb22fe2b0dfeb9bd823c00c737f5035f2c891..16a45edcf11b71881b31f1203add291a2c447d22 100644 ---- a/dist/client/shared.js -+++ b/dist/client/shared.js -@@ -16,6 +16,7 @@ export const notFoundPageData = { - lastUpdated: 0, - isNotFound: true - }; -+const versionedPaths = ['clients', 'plugins']; - export function isActive(currentPath, matchPath, asRegex = false) { - if (matchPath === undefined) { - return false; -@@ -24,8 +25,19 @@ export function isActive(currentPath, matchPath, asRegex = false) { - if (asRegex) { - return new RegExp(matchPath).test(currentPath); - } -- if (normalize(matchPath) !== currentPath) { -- return false; -+ const normalizedMatchPath = normalize(matchPath); -+ if (normalizedMatchPath !== currentPath) { -+ const currentPathParts = currentPath.split('/'); -+ if (currentPathParts.length > 3 && -+ versionedPaths.some((entry) => entry === currentPathParts[2])) { -+ currentPath = currentPathParts.slice(0, 4).join('/'); -+ if (normalizedMatchPath !== currentPath) { -+ return false; -+ } -+ } -+ else { -+ return false; -+ } - } - const hashMatch = matchPath.match(HASH_RE); - if (hashMatch) { -diff --git a/dist/node/chunk-CwUP9ZhX.js b/dist/node/chunk-CwUP9ZhX.js -index e8b4954d00f247fb852096bb1f8f077fcfc1f93f..8db594d1bdaac76359656a95ac96cd98161b1062 100644 ---- a/dist/node/chunk-CwUP9ZhX.js -+++ b/dist/node/chunk-CwUP9ZhX.js -@@ -2053,7 +2053,7 @@ function requireBrowser () { - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -- }; -+ }; - } (browser, browser.exports)); - return browser.exports; - } -@@ -2328,7 +2328,7 @@ function requireNode () { - formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -- }; -+ }; - } (node, node.exports)); - return node.exports; - } -@@ -3522,7 +3522,7 @@ function requireFs () { - 'fs.realpath.native is not a function. Is fs being monkey-patched?', - 'Warning', 'fs-extra-WARN0003' - ); -- } -+ } - } (fs$1)); - return fs$1; - } -@@ -6185,7 +6185,7 @@ class AST { - const aps = addPatternStart; - // check if we have a possibility of matching . or .., - // and prevent that. -- const needNoTrav = -+ const needNoTrav = - // dots are allowed, and the pattern starts with [ or . - (dot && aps.has(src.charAt(0))) || - // the pattern starts with \., and then [ or . -@@ -8616,11 +8616,11 @@ class LRUCache { - b.__abortController instanceof AC); - } - async fetch(k, fetchOptions = {}) { -- const { -+ const { - // get options -- allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, -+ allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, - // set options -- ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, -+ ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, - // fetch exclusive options - noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions; - if (!this.#hasFetchMethod) { -@@ -14468,7 +14468,7 @@ function requireUtils$4 () { - } - - return last; -- }; -+ }; - } (utils$5)); - return utils$5; - } -@@ -17226,7 +17226,7 @@ function requireDist$1 () { - exports.fdir = void 0; - const builder_1 = requireBuilder(); - Object.defineProperty(exports, "fdir", { enumerable: true, get: function () { return builder_1.Builder; } }); -- __exportStar(requireTypes$1(), exports); -+ __exportStar(requireTypes$1(), exports); - } (dist$1)); - return dist$1; - } -@@ -18267,6 +18267,7 @@ const notFoundPageData = { - lastUpdated: 0, - isNotFound: true - }; -+const versionedPaths = ["clients", "plugins"]; - function isActive(currentPath, matchPath, asRegex = false) { - if (matchPath === void 0) { - return false; -@@ -18275,8 +18276,17 @@ function isActive(currentPath, matchPath, asRegex = false) { - if (asRegex) { - return new RegExp(matchPath).test(currentPath); - } -- if (normalize$1(matchPath) !== currentPath) { -- return false; -+ const normalizedMatchPath = normalize$1(matchPath); -+ if (normalizedMatchPath !== currentPath) { -+ const currentPathParts = currentPath.split("/"); -+ if (currentPathParts.length > 3 && versionedPaths.some((entry) => entry === currentPathParts[2])) { -+ currentPath = currentPathParts.slice(0, 4).join("/"); -+ if (normalizedMatchPath !== currentPath) { -+ return false; -+ } -+ } else { -+ return false; -+ } - } - const hashMatch = matchPath.match(HASH_RE); - if (hashMatch) { -@@ -23631,7 +23641,7 @@ function requireEngines () { - stringify: function() { - throw new Error('stringifying JavaScript is not supported'); - } -- }; -+ }; - } (engines)); - return engines.exports; - } -@@ -23731,7 +23741,7 @@ function requireUtils$2 () { - exports.startsWith = function(str, substr, len) { - if (typeof len !== 'number') len = substr.length; - return str.slice(0, len) === substr; -- }; -+ }; - } (utils$3)); - return utils$3; - } -@@ -25043,7 +25053,7 @@ const decodeMap = new Map([ - /** - * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point. - */ --const fromCodePoint$1 = -+const fromCodePoint$1 = - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins - (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) { - let output = ""; -@@ -25135,7 +25145,7 @@ var DecodingMode; - class EntityDecoder { - constructor( - /** The tree used to decode entities. */ -- decodeTree, -+ decodeTree, - /** - * The function that is called when a codepoint is decoded. - * -@@ -25145,7 +25155,7 @@ class EntityDecoder { - * @param codepoint The decoded codepoint. - * @param consumed The number of bytes consumed by the decoder. - */ -- emitCodePoint, -+ emitCodePoint, - /** An object that is used to produce errors. */ - errors) { - this.decodeTree = decodeTree; -@@ -25458,7 +25468,7 @@ function getDecoder(decodeTree) { - while ((offset = str.indexOf("&", offset)) >= 0) { - ret += str.slice(lastIndex, offset); - decoder.startEntity(decodeMode); -- const len = decoder.write(str, -+ const len = decoder.write(str, - // Skip the "&" - offset + 1); - if (len < 0) { -@@ -38931,7 +38941,7 @@ class SignalExit extends SignalExitBase { - const process$1 = globalThis.process; - // wrap so that we call the method on the actual handler, without - // exporting it directly. --const { -+const { - /** - * Called when the process is exiting, whether via signal, explicit - * exit, or running out of stuff to do. -@@ -41070,7 +41080,7 @@ function requireEastasianwidth () { - eawLen += charLen; - } - return result; -- }; -+ }; - } (eastasianwidth)); - return eastasianwidth.exports; - } -@@ -42826,7 +42836,7 @@ function requireTypes () { - IndexTagNames["sitemapindex"] = "sitemapindex"; - IndexTagNames["loc"] = "loc"; - IndexTagNames["lastmod"] = "lastmod"; -- })(exports.IndexTagNames || (exports.IndexTagNames = {})); -+ })(exports.IndexTagNames || (exports.IndexTagNames = {})); - } (types)); - return types; - } -@@ -42840,7 +42850,7 @@ function requireSitemapXml () { - hasRequiredSitemapXml = 1; - Object.defineProperty(sitemapXml, "__esModule", { value: true }); - sitemapXml.element = sitemapXml.ctag = sitemapXml.otag = sitemapXml.text = void 0; -- const invalidXMLUnicodeRegex = -+ const invalidXMLUnicodeRegex = - // eslint-disable-next-line no-control-regex - /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u0084\u0086-\u009F\uD800-\uDFFF\uFDD0-\uFDDF\u{1FFFE}-\u{1FFFF}\u{2FFFE}-\u{2FFFF}\u{3FFFE}-\u{3FFFF}\u{4FFFE}-\u{4FFFF}\u{5FFFE}-\u{5FFFF}\u{6FFFE}-\u{6FFFF}\u{7FFFE}-\u{7FFFF}\u{8FFFE}-\u{8FFFF}\u{9FFFE}-\u{9FFFF}\u{AFFFE}-\u{AFFFF}\u{BFFFE}-\u{BFFFF}\u{CFFFE}-\u{CFFFF}\u{DFFFE}-\u{DFFFF}\u{EFFFE}-\u{EFFFF}\u{FFFFE}-\u{FFFFF}\u{10FFFE}-\u{10FFFF}]/gu; - const amp = /&/g; -@@ -43586,7 +43596,7 @@ function requireSitemapStream () { - }); - }); - } -- exports.streamToPromise = streamToPromise; -+ exports.streamToPromise = streamToPromise; - } (sitemapStream)); - return sitemapStream; - } -@@ -43809,7 +43819,7 @@ function requireSitemapIndexStream () { - }); - } - } -- exports.SitemapAndIndexStream = SitemapAndIndexStream; -+ exports.SitemapAndIndexStream = SitemapAndIndexStream; - } (sitemapIndexStream)); - return sitemapIndexStream; - } -@@ -45470,7 +45480,7 @@ function requireSax () { - } - }()); - } -- })(exports); -+ })(exports); - } (sax)); - return sax; - } -@@ -46277,7 +46287,7 @@ function requireSitemapSimple () { - } - }; - exports.simpleSitemapAndIndex = simpleSitemapAndIndex; -- exports.default = exports.simpleSitemapAndIndex; -+ exports.default = exports.simpleSitemapAndIndex; - } (sitemapSimple)); - return sitemapSimple; - } -@@ -46333,7 +46343,7 @@ function requireDist () { - Object.defineProperty(exports, "XMLToSitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_parser_1.XMLToSitemapIndexStream; } }); - Object.defineProperty(exports, "IndexObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_index_parser_1.IndexObjectStreamToJSON; } }); - var sitemap_simple_1 = requireSitemapSimple(); -- Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } }); -+ Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } }); - } (dist)); - return dist; - } -@@ -48930,7 +48940,7 @@ function requireLodash_template () { - return false; - } - -- module.exports = template; -+ module.exports = template; - } (lodash_template, lodash_template.exports)); - return lodash_template.exports; - } -@@ -49165,7 +49175,7 @@ function requirePostcssPrefixSelector () { - - return { - postcssPlugin: 'postcss-prefix-selector', -- prepare(result) { -+ prepare(result) { - const root = result.root; - const file = root.source.input.file; - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 452eb5e353..685d2bc81e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,11 +4,6 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -patchedDependencies: - vitepress: - hash: 828e6d2347338f051e3210f9d54e3a79212e9afb26e6b8a746d7ad5f58e9385b - path: patches/vitepress.patch - importers: .: @@ -176,28 +171,6 @@ importers: specifier: 4.3.6 version: 4.3.6 - docs: - dependencies: - '@stackblitz/sdk': - specifier: 1.11.0 - version: 1.11.0 - vue3-select-component: - specifier: 0.16.0 - version: 0.16.0(vue@3.5.25(typescript@6.0.2)) - devDependencies: - sharp: - specifier: 0.34.5 - version: 0.34.5 - vitepress: - specifier: 2.0.0-alpha.16 - version: 2.0.0-alpha.16(patch_hash=828e6d2347338f051e3210f9d54e3a79212e9afb26e6b8a746d7ad5f58e9385b)(@types/node@25.2.1)(axios@1.13.4)(fuse.js@7.1.0)(jiti@2.6.1)(jwt-decode@4.0.0)(less@4.4.2)(lightningcss@1.32.0)(oxc-minify@0.110.0)(postcss@8.5.14)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3) - vitepress-plugin-llms: - specifier: 1.12.0 - version: 1.12.0 - vue: - specifier: 3.5.25 - version: 3.5.25(typescript@6.0.2) - examples/openapi-ts-angular: dependencies: '@angular/common': @@ -3054,15 +3027,9 @@ packages: '@docsearch/css@3.9.0': resolution: {integrity: sha512-cQbnVbq0rrBwNAKegIac/t6a8nWoUAn8frnkLFW6YARaRmAQr5/Eoe6Ln2fqkUCZ40KpdrKbpSAmgrkviOxuWA==} - '@docsearch/css@4.6.0': - resolution: {integrity: sha512-YlcAimkXclvqta47g47efzCM5CFxDwv2ClkDfEs/fC/Ak0OxPH2b3czwa4o8O1TRBf+ujFF2RiUwszz2fPVNJQ==} - '@docsearch/js@3.9.0': resolution: {integrity: sha512-4bKHcye6EkLgRE8ze0vcdshmEqxeiJM77M0JXjef7lrYZfSlMunrDOCqyLjiZyo1+c0BhUqA2QpFartIjuHIjw==} - '@docsearch/js@4.6.0': - resolution: {integrity: sha512-9/rbgkm/BgTq46cwxIohvSAz3koOFjnPpg0mwkJItAfzKbQIj+310PvwtgUY1YITDuGCag6yOL50GW2DBkaaBw==} - '@docsearch/react@3.9.0': resolution: {integrity: sha512-mb5FOZYZIkRQ6s/NWnM98k879vu5pscWqTLubLFBO87igYYT4VzVazh4h5o/zCvTIZgEt3PvsCOMOswOUo9yHQ==} peerDependencies: @@ -3080,9 +3047,6 @@ packages: search-insights: optional: true - '@docsearch/sidepanel-js@4.6.0': - resolution: {integrity: sha512-lFT5KLwlzUmpoGArCScNoK41l9a22JYsEPwBzMrz+/ILVR5Ax87UphCuiyDFQWEvEmbwzn/kJx5W/O5BUlN1Rw==} - '@dxup/nuxt@0.3.2': resolution: {integrity: sha512-2f2usP4oLNsIGjPprvABe3f3GWuIhIDp0169pGLFxTDRI5A4d4sBbGpR+tD9bGZCT+1Btb6Q2GKlyv3LkDCW5g==} @@ -4248,15 +4212,9 @@ packages: '@floating-ui/core@1.7.3': resolution: {integrity: sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==} - '@floating-ui/core@1.7.4': - resolution: {integrity: sha512-C3HlIdsBxszvm5McXlB8PeOEWfBhcGBTZGkGlWc2U0KFY5IwG5OQEuQ8rq52DZmcHDlPLd+YFBK+cZcytwIFWg==} - '@floating-ui/dom@1.7.4': resolution: {integrity: sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==} - '@floating-ui/dom@1.7.5': - resolution: {integrity: sha512-N0bD2kIPInNHUHehXhMke1rBGs1dwqvC9O9KYMyyjK7iXt7GAhnro7UlcuYcGdS/yYOlq0MAVgrow8IbWJwyqg==} - '@floating-ui/react-dom@2.1.6': resolution: {integrity: sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==} peerDependencies: @@ -4266,9 +4224,6 @@ packages: '@floating-ui/utils@0.2.10': resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} - '@floating-ui/vue@1.1.10': - resolution: {integrity: sha512-vdf8f6rHnFPPLRsmL4p12wYl+Ux4mOJOkjzKEMYVnwdf7UFdvBtHlLvQyx8iKG5vhPRbDRgZxdtpmyigDPjzYg==} - '@fontsource/fira-mono@5.0.0': resolution: {integrity: sha512-IsinH/oLYJyv/sQv7SbKmjoAXZsSjm6Q1Tz5GBBXCXi3Jg9MzXmKvWm9bSLC8lFI6CDsi8GkH/DAgZ98t8bhTQ==} @@ -4307,12 +4262,6 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} - '@iconify-json/simple-icons@1.2.69': - resolution: {integrity: sha512-T/rhy5n7pzE0ZOxQVlF68SNPCYYjRBpddjgjrJO5WWVRG8es5BQmvxIE9kKF+t2hhPGvuGQFpXmUyqbOtnxirQ==} - - '@iconify/types@2.0.0': - resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} - '@img/colour@1.0.0': resolution: {integrity: sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==} engines: {node: '>=18'} @@ -7398,9 +7347,6 @@ packages: '@rolldown/pluginutils@1.0.0-rc.15': resolution: {integrity: sha512-UromN0peaE53IaBRe9W7CjrZgXl90fqGpK+mIZbA3qSTeYqg3pqpROBdIPvOG3F5ereDHNwoHBI2e50n1BDr1g==} - '@rolldown/pluginutils@1.0.0-rc.2': - resolution: {integrity: sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw==} - '@rolldown/pluginutils@1.0.0-rc.4': resolution: {integrity: sha512-1BrrmTu0TWfOP1riA8uakjFc9bpIUGzVKETsOtzY39pPga8zELGDl8eu1Dx7/gjM5CAz14UknsUMpBO8L+YntQ==} @@ -7650,12 +7596,6 @@ packages: os: [linux] libc: [glibc] - '@rollup/rollup-linux-x64-gnu@4.57.1': - resolution: {integrity: sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==} - cpu: [x64] - os: [linux] - libc: [glibc] - '@rollup/rollup-linux-x64-musl@4.56.0': resolution: {integrity: sha512-ZhGH1eA4Qv0lxaV00azCIS1ChedK0V32952Md3FtnxSqZTBTd6tgil4nZT5cU8B+SIw3PFYkvyR4FKo2oyZIHA==} cpu: [x64] @@ -7709,30 +7649,18 @@ packages: resolution: {integrity: sha512-OEd7RYlSwmq4zpaHPOnf+yyzWN6aON4RrA+Dd3PGo5JPBY8G5peofQpJZDwxdJJKPOvqU0C7aZ8LeL2CE2XTdA==} hasBin: true - '@shikijs/core@3.23.0': - resolution: {integrity: sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==} - '@shikijs/core@4.0.2': resolution: {integrity: sha512-hxT0YF4ExEqB8G/qFdtJvpmHXBYJ2lWW7qTHDarVkIudPFE6iCIrqdgWxGn5s+ppkGXI0aEGlibI0PAyzP3zlw==} engines: {node: '>=20'} - '@shikijs/engine-javascript@3.23.0': - resolution: {integrity: sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==} - '@shikijs/engine-javascript@4.0.2': resolution: {integrity: sha512-7PW0Nm49DcoUIQEXlJhNNBHyoGMjalRETTCcjMqEaMoJRLljy1Bi/EGV3/qLBgLKQejdspiiYuHGQW6dX94Nag==} engines: {node: '>=20'} - '@shikijs/engine-oniguruma@3.23.0': - resolution: {integrity: sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==} - '@shikijs/engine-oniguruma@4.0.2': resolution: {integrity: sha512-UpCB9Y2sUKlS9z8juFSKz7ZtysmeXCgnRF0dlhXBkmQnek7lAToPte8DkxmEYGNTMii72zU/lyXiCB6StuZeJg==} engines: {node: '>=20'} - '@shikijs/langs@3.23.0': - resolution: {integrity: sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==} - '@shikijs/langs@4.0.2': resolution: {integrity: sha512-KaXby5dvoeuZzN0rYQiPMjFoUrz4hgwIE+D6Du9owcHcl6/g16/yT5BQxSW5cGt2MZBz6Hl0YuRqf12omRfUUg==} engines: {node: '>=20'} @@ -7741,19 +7669,10 @@ packages: resolution: {integrity: sha512-M6UMPrSa3fN5ayeJwFVl9qWofl273wtK1VG8ySDZ1mQBfhCpdd8nEx7nPZ/tk7k+TYcpqBZzj/AnwxT9lO+HJw==} engines: {node: '>=20'} - '@shikijs/themes@3.23.0': - resolution: {integrity: sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==} - '@shikijs/themes@4.0.2': resolution: {integrity: sha512-mjCafwt8lJJaVSsQvNVrJumbnnj1RI8jbUKrPKgE6E3OvQKxnuRoBaYC51H4IGHePsGN/QtALglWBU7DoKDFnA==} engines: {node: '>=20'} - '@shikijs/transformers@3.23.0': - resolution: {integrity: sha512-F9msZVxdF+krQNSdQ4V+Ja5QemeAoTQ2jxt7nJCwhDsdF1JWS3KxIQXA3lQbyKwS3J61oHRUSv4jYWv3CkaKTQ==} - - '@shikijs/types@3.23.0': - resolution: {integrity: sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==} - '@shikijs/types@4.0.2': resolution: {integrity: sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==} engines: {node: '>=20'} @@ -7809,9 +7728,6 @@ packages: '@stablelib/base64@1.0.1': resolution: {integrity: sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==} - '@stackblitz/sdk@1.11.0': - resolution: {integrity: sha512-DFQGANNkEZRzFk1/rDP6TcFdM82ycHE+zfl9C/M/jXlH68jiqHWHFMQURLELoD8koxvu/eW5uhg94NSAZlYrUQ==} - '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -8288,18 +8204,9 @@ packages: '@types/json5@0.0.29': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - '@types/linkify-it@5.0.0': - resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==} - - '@types/markdown-it@14.1.2': - resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==} - '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} - '@types/mdurl@2.0.0': - resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==} - '@types/mdx@2.0.13': resolution: {integrity: sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==} @@ -8382,9 +8289,6 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} - '@types/web-bluetooth@0.0.21': - resolution: {integrity: sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==} - '@types/ws@8.18.1': resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} @@ -8817,13 +8721,6 @@ packages: vite: ^5.0.0 || ^6.0.0 vue: ^3.2.25 - '@vitejs/plugin-vue@6.0.4': - resolution: {integrity: sha512-uM5iXipgYIn13UUQCZNdWkYk+sysBeA97d5mHsAoAt1u/wpN3+zxOmsVJWosuzX+IMGRzeYUNytztrYznboIkQ==} - engines: {node: ^20.19.0 || >=22.12.0} - peerDependencies: - vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - vue: ^3.2.25 - '@vitejs/plugin-vue@6.0.6': resolution: {integrity: sha512-u9HHgfrq3AjXlysn0eINFnWQOJQLO9WN6VprZ8FXl7A2bYisv3Hui9Ij+7QZ41F/WYWarHjwBbXtD7dKg3uxbg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -9168,61 +9065,6 @@ packages: vue: optional: true - '@vueuse/core@14.2.1': - resolution: {integrity: sha512-3vwDzV+GDUNpdegRY6kzpLm4Igptq+GA0QkJ3W61Iv27YWwW/ufSlOfgQIpN6FZRMG0mkaz4gglJRtq5SeJyIQ==} - peerDependencies: - vue: ^3.5.0 - - '@vueuse/integrations@14.2.1': - resolution: {integrity: sha512-2LIUpBi/67PoXJGqSDQUF0pgQWpNHh7beiA+KG2AbybcNm+pTGWT6oPGlBgUoDWmYwfeQqM/uzOHqcILpKL7nA==} - peerDependencies: - async-validator: ^4 - axios: ^1 - change-case: ^5 - drauu: ^0.4 - focus-trap: ^7 || ^8 - fuse.js: ^7 - idb-keyval: ^6 - jwt-decode: ^4 - nprogress: ^0.2 - qrcode: ^1.5 - sortablejs: ^1 - universal-cookie: ^7 || ^8 - vue: ^3.5.0 - peerDependenciesMeta: - async-validator: - optional: true - axios: - optional: true - change-case: - optional: true - drauu: - optional: true - focus-trap: - optional: true - fuse.js: - optional: true - idb-keyval: - optional: true - jwt-decode: - optional: true - nprogress: - optional: true - qrcode: - optional: true - sortablejs: - optional: true - universal-cookie: - optional: true - - '@vueuse/metadata@14.2.1': - resolution: {integrity: sha512-1ButlVtj5Sb/HDtIy1HFr1VqCP4G6Ypqt5MAo0lCgjokrk2mvQKsK2uuy0vqu/Ks+sHfuHo0B9Y9jn9xKdjZsw==} - - '@vueuse/shared@14.2.1': - resolution: {integrity: sha512-shTJncjV9JTI4oVNyF1FQonetYAiTBd+Qj7cY89SWbXSkx7gyhrgtEdF2ZAVWS1S3SHlaROO6F2IesJxQEkZBw==} - peerDependencies: - vue: ^3.5.0 - '@webassemblyjs/ast@1.14.1': resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} @@ -11305,10 +11147,6 @@ packages: exsolve@1.0.8: resolution: {integrity: sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==} - extend-shallow@2.0.1: - resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==} - engines: {node: '>=0.10.0'} - extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} @@ -11394,9 +11232,6 @@ packages: fastq@1.19.1: resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} - fault@2.0.1: - resolution: {integrity: sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==} - faye-websocket@0.11.4: resolution: {integrity: sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==} engines: {node: '>=0.8.0'} @@ -11492,9 +11327,6 @@ packages: fn.name@1.1.0: resolution: {integrity: sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==} - focus-trap@7.8.0: - resolution: {integrity: sha512-/yNdlIkpWbM0ptxno3ONTuf+2g318kh2ez3KSeZN5dZ8YC6AAmgeWz+GasYYiBJPFaYcSAPeu4GfhUaChzIJXA==} - follow-redirects@1.15.11: resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==} engines: {node: '>=4.0'} @@ -11523,10 +11355,6 @@ packages: resolution: {integrity: sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==} engines: {node: '>= 6'} - format@0.2.2: - resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} - engines: {node: '>=0.4.x'} - formdata-polyfill@4.0.10: resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} engines: {node: '>=12.20.0'} @@ -11763,10 +11591,6 @@ packages: resolution: {integrity: sha512-gGgrVCoDKlIZ8fIqXBBb0pPKqDgki0Z/FSKNiQzSGj2uEYHr1tq5wmBegGwJx6QB5S5cM0khSBpi/JFHMCvsmQ==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} - gray-matter@4.0.3: - resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} - engines: {node: '>=6.0'} - gzip-size@7.0.0: resolution: {integrity: sha512-O1Ld7Dr+nqPnmGpdhzLmMTQ4vAsD+rHwMm1NLUmoUFFymBOMKxCCrtDxqdBRYXdeEPEi3SyoR4TizJLQrnKBNA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -12219,10 +12043,6 @@ packages: engines: {node: '>=20'} hasBin: true - is-extendable@0.1.1: - resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==} - engines: {node: '>=0.10.0'} - is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -12820,9 +12640,6 @@ packages: lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - linkify-it@5.0.0: - resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} - lint-staged@16.4.0: resolution: {integrity: sha512-lBWt8hujh/Cjysw5GYVmZpFHXDCgZzhrOm8vbcUdobADZNOK/bRshr2kM3DfgrrtR1DQhfupW9gnIXOfiFi+bw==} engines: {node: '>=20.17'} @@ -12988,24 +12805,13 @@ packages: resolution: {integrity: sha512-iyyEpDty1mwW3dGlYXAJqC/azFn5PPvgKVwXayOGBSmKLxhKZ9fg4qIan2ePpp1vJIwfFiO34LAPZgq9SZW9Aw==} engines: {node: ^20.17.0 || >=22.9.0} - mark.js@8.11.1: - resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} - markdown-extensions@2.0.0: resolution: {integrity: sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==} engines: {node: '>=16'} - markdown-it@14.1.0: - resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} - hasBin: true - markdown-table@3.0.4: resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==} - markdown-title@1.0.2: - resolution: {integrity: sha512-MqIQVVkz+uGEHi3TsHx/czcxxCbRIL7sv5K5DnYw/tI+apY54IbPefV/cmgxp6LoJSEx/TqcHdLs/298afG5QQ==} - engines: {node: '>=6'} - math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} @@ -13022,9 +12828,6 @@ packages: mdast-util-from-markdown@2.0.3: resolution: {integrity: sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==} - mdast-util-frontmatter@2.0.1: - resolution: {integrity: sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==} - mdast-util-gfm-autolink-literal@2.0.1: resolution: {integrity: sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==} @@ -13073,9 +12876,6 @@ packages: mdn-data@2.27.1: resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==} - mdurl@2.0.0: - resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} - media-typer@0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} @@ -13124,9 +12924,6 @@ packages: micromark-extension-directive@4.0.0: resolution: {integrity: sha512-/C2nqVmXXmiseSSuCdItCMho7ybwwop6RrrRPk0KbOHW21JKoCldC+8rFOaundDoRBUWBnJJcxeA/Kvi34WQXg==} - micromark-extension-frontmatter@2.0.0: - resolution: {integrity: sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg==} - micromark-extension-gfm-autolink-literal@2.1.0: resolution: {integrity: sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==} @@ -13233,10 +13030,6 @@ packages: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} - millify@6.1.0: - resolution: {integrity: sha512-H/E3J6t+DQs/F2YgfDhxUVZz/dF8JXPPKTLHL/yHCcLZLtCXJDUaqvhJXQwqOVBvbyNn4T0WjLpIHd7PAw7fBA==} - hasBin: true - mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} @@ -13349,9 +13142,6 @@ packages: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} - minisearch@7.2.0: - resolution: {integrity: sha512-dqT2XBYUOZOiC5t2HRnwADjhNS2cecp9u+TJRiJ1Qp/f5qjkeT5APcGPjHw+bz89Ms8Jp+cG4AlE+QZ/QnDglg==} - minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -14671,10 +14461,6 @@ packages: pump@3.0.3: resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==} - punycode.js@2.3.1: - resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} - engines: {node: '>=6'} - punycode@1.4.1: resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} @@ -14955,9 +14741,6 @@ packages: remark-directive@4.0.0: resolution: {integrity: sha512-7sxn4RfF1o3izevPV1DheyGDD6X4c9hrGpfdUpm7uC++dqrnJxIZVkk7CoKqcLm0VUMAuOol7Mno3m6g8cfMuA==} - remark-frontmatter@5.0.0: - resolution: {integrity: sha512-XTFYvNASMe5iPN0719nPrdItC9aU0ssC4v14mH1BCi1u0n1gAocqcujWUrByftZTbLhRtiKRyjYTSIOcr69UVQ==} - remark-gfm@4.0.1: resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==} @@ -14977,9 +14760,6 @@ packages: remark-stringify@11.0.0: resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==} - remark@15.0.1: - resolution: {integrity: sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A==} - remove-accents@0.5.0: resolution: {integrity: sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==} @@ -15284,10 +15064,6 @@ packages: search-insights@2.17.3: resolution: {integrity: sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==} - section-matter@1.0.0: - resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} - engines: {node: '>=4'} - secure-json-parse@4.1.0: resolution: {integrity: sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==} @@ -15414,9 +15190,6 @@ packages: resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==} engines: {node: '>= 0.4'} - shiki@3.23.0: - resolution: {integrity: sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==} - shiki@4.0.2: resolution: {integrity: sha512-eAVKTMedR5ckPo4xne/PjYQYrU3qx78gtJZ+sHlXEg5IHhhoQhMfZVzetTYuaJS0L2Ef3AcCRzCHV8T0WI6nIQ==} engines: {node: '>=20'} @@ -15732,10 +15505,6 @@ packages: resolution: {integrity: sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==} engines: {node: '>=12'} - strip-bom-string@1.0.0: - resolution: {integrity: sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==} - engines: {node: '>=0.10.0'} - strip-bom@3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} @@ -15864,9 +15633,6 @@ packages: resolution: {integrity: sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA==} engines: {node: '>=18'} - tabbable@6.4.0: - resolution: {integrity: sha512-05PUHKSNE8ou2dwIxTngl4EzcnsCDZGJ/iCLtDflR/SHB/ny14rXc+qU5P4mG9JkusiV7EivzY9Mhm55AzAvCg==} - tagged-tag@1.0.0: resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==} engines: {node: '>=20'} @@ -16036,9 +15802,6 @@ packages: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} engines: {node: '>=0.6'} - tokenx@1.3.0: - resolution: {integrity: sha512-NLdXTEZkKiO0gZuLtMoZKjCXTREXeZZt8nnnNeyoXtNZAfG/GKGSbQtLU5STspc0rMSwcA+UJfWZkbNU01iKmQ==} - toml@3.0.0: resolution: {integrity: sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==} @@ -16265,9 +16028,6 @@ packages: resolution: {integrity: sha512-O3oYyCMPYgNNHuO7Jjk3uacJWZF8loBgwrfd/5LE/HyZ3lUIOdniQ7DNXJcIgZbwioZxk0fLfI4EVnetdiX5jg==} hasBin: true - uc.micro@2.1.0: - resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} - ufo@1.6.1: resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==} @@ -17058,25 +16818,6 @@ packages: vite: optional: true - vitepress-plugin-llms@1.12.0: - resolution: {integrity: sha512-zuzL7a8UJuGl46le5cAy/QxKMGlpSylcsLjDDn6BYPc1u+eP3nzoQk9ne9XFBqrE7exoJlIYJELVN8HMgYlFKQ==} - engines: {node: '>=18.0.0'} - - vitepress@2.0.0-alpha.16: - resolution: {integrity: sha512-w1nwsefDVIsje7BZr2tsKxkZutDGjG0YoQ2yxO7+a9tvYVqfljYbwj5LMYkPy8Tb7YbPwa22HtIhk62jbrvuEQ==} - hasBin: true - peerDependencies: - markdown-it-mathjax3: ^4 - oxc-minify: '*' - postcss: ^8 - peerDependenciesMeta: - markdown-it-mathjax3: - optional: true - oxc-minify: - optional: true - postcss: - optional: true - vitest-environment-nuxt@2.0.0: resolution: {integrity: sha512-zEGFRiCAaRR3fHnqISHKMNTRvCzkQEI1XyFeqNgR2IBD0oYkfZ1rUHwi7C+h3Cns3KPykfB0av1B3MtLEbChDw==} @@ -17194,11 +16935,6 @@ packages: peerDependencies: typescript: '>=5.0.0' - vue3-select-component@0.16.0: - resolution: {integrity: sha512-zh1HyCXkUida15T8uG4fStC3R0rX6q9H2Q6j/0t9aduxSdbX32I+f/aZAsQRmhJnQziOlBYak/ivtv9i0nbiqQ==} - peerDependencies: - vue: ^3.5.0 - vue@3.5.13: resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==} peerDependencies: @@ -19690,8 +19426,6 @@ snapshots: '@docsearch/css@3.9.0': {} - '@docsearch/css@4.6.0': {} - '@docsearch/js@3.9.0(@algolia/client-search@5.48.1)(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(search-insights@2.17.3)': dependencies: '@docsearch/react': 3.9.0(@algolia/client-search@5.48.1)(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(search-insights@2.17.3) @@ -19703,8 +19437,6 @@ snapshots: - react-dom - search-insights - '@docsearch/js@4.6.0': {} - '@docsearch/react@3.9.0(@algolia/client-search@5.48.1)(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(search-insights@2.17.3)': dependencies: '@algolia/autocomplete-core': 1.17.9(@algolia/client-search@5.48.1)(algoliasearch@5.48.1)(search-insights@2.17.3) @@ -19719,8 +19451,6 @@ snapshots: transitivePeerDependencies: - '@algolia/client-search' - '@docsearch/sidepanel-js@4.6.0': {} - '@dxup/nuxt@0.3.2(magicast@0.5.2)': dependencies: '@dxup/unimport': 0.1.2 @@ -20392,20 +20122,11 @@ snapshots: dependencies: '@floating-ui/utils': 0.2.10 - '@floating-ui/core@1.7.4': - dependencies: - '@floating-ui/utils': 0.2.10 - '@floating-ui/dom@1.7.4': dependencies: '@floating-ui/core': 1.7.3 '@floating-ui/utils': 0.2.10 - '@floating-ui/dom@1.7.5': - dependencies: - '@floating-ui/core': 1.7.4 - '@floating-ui/utils': 0.2.10 - '@floating-ui/react-dom@2.1.6(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@floating-ui/dom': 1.7.4 @@ -20414,15 +20135,6 @@ snapshots: '@floating-ui/utils@0.2.10': {} - '@floating-ui/vue@1.1.10(vue@3.5.25(typescript@6.0.2))': - dependencies: - '@floating-ui/dom': 1.7.5 - '@floating-ui/utils': 0.2.10 - vue-demi: 0.14.10(vue@3.5.25(typescript@6.0.2)) - transitivePeerDependencies: - - '@vue/composition-api' - - vue - '@fontsource/fira-mono@5.0.0': {} '@harperfast/extended-iterable@1.0.3': @@ -20465,12 +20177,6 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@iconify-json/simple-icons@1.2.69': - dependencies: - '@iconify/types': 2.0.0 - - '@iconify/types@2.0.0': {} - '@img/colour@1.0.0': {} '@img/sharp-darwin-arm64@0.33.5': @@ -23888,8 +23594,6 @@ snapshots: '@rolldown/pluginutils@1.0.0-rc.15': {} - '@rolldown/pluginutils@1.0.0-rc.2': {} - '@rolldown/pluginutils@1.0.0-rc.4': {} '@rollup/plugin-alias@5.1.1(rollup@3.29.5)': @@ -24111,9 +23815,6 @@ snapshots: '@rollup/rollup-linux-x64-gnu@4.56.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.57.1': - optional: true - '@rollup/rollup-linux-x64-musl@4.56.0': optional: true @@ -24156,13 +23857,6 @@ snapshots: ajv-formats: 3.0.1(ajv@8.17.1) js-yaml: 4.1.1 - '@shikijs/core@3.23.0': - dependencies: - '@shikijs/types': 3.23.0 - '@shikijs/vscode-textmate': 10.0.2 - '@types/hast': 3.0.4 - hast-util-to-html: 9.0.5 - '@shikijs/core@4.0.2': dependencies: '@shikijs/primitive': 4.0.2 @@ -24171,32 +23865,17 @@ snapshots: '@types/hast': 3.0.4 hast-util-to-html: 9.0.5 - '@shikijs/engine-javascript@3.23.0': - dependencies: - '@shikijs/types': 3.23.0 - '@shikijs/vscode-textmate': 10.0.2 - oniguruma-to-es: 4.3.5 - '@shikijs/engine-javascript@4.0.2': dependencies: '@shikijs/types': 4.0.2 '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.3.5 - '@shikijs/engine-oniguruma@3.23.0': - dependencies: - '@shikijs/types': 3.23.0 - '@shikijs/vscode-textmate': 10.0.2 - '@shikijs/engine-oniguruma@4.0.2': dependencies: '@shikijs/types': 4.0.2 '@shikijs/vscode-textmate': 10.0.2 - '@shikijs/langs@3.23.0': - dependencies: - '@shikijs/types': 3.23.0 - '@shikijs/langs@4.0.2': dependencies: '@shikijs/types': 4.0.2 @@ -24207,24 +23886,10 @@ snapshots: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 - '@shikijs/themes@3.23.0': - dependencies: - '@shikijs/types': 3.23.0 - '@shikijs/themes@4.0.2': dependencies: '@shikijs/types': 4.0.2 - '@shikijs/transformers@3.23.0': - dependencies: - '@shikijs/core': 3.23.0 - '@shikijs/types': 3.23.0 - - '@shikijs/types@3.23.0': - dependencies: - '@shikijs/vscode-textmate': 10.0.2 - '@types/hast': 3.0.4 - '@shikijs/types@4.0.2': dependencies: '@shikijs/vscode-textmate': 10.0.2 @@ -24278,8 +23943,6 @@ snapshots: '@stablelib/base64@1.0.1': {} - '@stackblitz/sdk@1.11.0': {} - '@standard-schema/spec@1.1.0': {} '@stoplight/json@3.21.7': @@ -24759,19 +24422,10 @@ snapshots: '@types/json5@0.0.29': {} - '@types/linkify-it@5.0.0': {} - - '@types/markdown-it@14.1.2': - dependencies: - '@types/linkify-it': 5.0.0 - '@types/mdurl': 2.0.0 - '@types/mdast@4.0.4': dependencies: '@types/unist': 3.0.3 - '@types/mdurl@2.0.0': {} - '@types/mdx@2.0.13': {} '@types/micromatch@4.0.10': @@ -24854,8 +24508,6 @@ snapshots: '@types/unist@3.0.3': {} - '@types/web-bluetooth@0.0.21': {} - '@types/ws@8.18.1': dependencies: '@types/node': 24.12.2 @@ -25368,12 +25020,6 @@ snapshots: vite: 5.4.19(@types/node@25.2.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0) vue: 3.5.25(typescript@6.0.2) - '@vitejs/plugin-vue@6.0.4(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))(vue@3.5.27(typescript@6.0.2))': - dependencies: - '@rolldown/pluginutils': 1.0.0-rc.2 - vite: 7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3) - vue: 3.5.27(typescript@6.0.2) - '@vitejs/plugin-vue@6.0.6(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))(vue@3.5.27(typescript@6.0.2))': dependencies: '@rolldown/pluginutils': 1.0.0-rc.13 @@ -26013,30 +25659,6 @@ snapshots: typescript: 6.0.2 vue: 3.5.13(typescript@6.0.2) - '@vueuse/core@14.2.1(vue@3.5.27(typescript@6.0.2))': - dependencies: - '@types/web-bluetooth': 0.0.21 - '@vueuse/metadata': 14.2.1 - '@vueuse/shared': 14.2.1(vue@3.5.27(typescript@6.0.2)) - vue: 3.5.27(typescript@6.0.2) - - '@vueuse/integrations@14.2.1(axios@1.13.4)(focus-trap@7.8.0)(fuse.js@7.1.0)(jwt-decode@4.0.0)(vue@3.5.27(typescript@6.0.2))': - dependencies: - '@vueuse/core': 14.2.1(vue@3.5.27(typescript@6.0.2)) - '@vueuse/shared': 14.2.1(vue@3.5.27(typescript@6.0.2)) - vue: 3.5.27(typescript@6.0.2) - optionalDependencies: - axios: 1.13.4 - focus-trap: 7.8.0 - fuse.js: 7.1.0 - jwt-decode: 4.0.0 - - '@vueuse/metadata@14.2.1': {} - - '@vueuse/shared@14.2.1(vue@3.5.27(typescript@6.0.2))': - dependencies: - vue: 3.5.27(typescript@6.0.2) - '@webassemblyjs/ast@1.14.1': dependencies: '@webassemblyjs/helper-numbers': 1.13.2 @@ -28793,10 +28415,6 @@ snapshots: exsolve@1.0.8: {} - extend-shallow@2.0.1: - dependencies: - is-extendable: 0.1.1 - extend@3.0.2: {} extendable-error@0.1.7: {} @@ -28910,10 +28528,6 @@ snapshots: dependencies: reusify: 1.1.0 - fault@2.0.1: - dependencies: - format: 0.2.2 - faye-websocket@0.11.4: dependencies: websocket-driver: 0.7.4 @@ -29023,10 +28637,6 @@ snapshots: fn.name@1.1.0: {} - focus-trap@7.8.0: - dependencies: - tabbable: 6.4.0 - follow-redirects@1.15.11(debug@4.4.3): optionalDependencies: debug: 4.4.3 @@ -29056,8 +28666,6 @@ snapshots: hasown: 2.0.2 mime-types: 2.1.35 - format@0.2.2: {} - formdata-polyfill@4.0.10: dependencies: fetch-blob: 3.2.0 @@ -29324,13 +28932,6 @@ snapshots: graphql@16.13.1: {} - gray-matter@4.0.3: - dependencies: - js-yaml: 3.14.1 - kind-of: 6.0.3 - section-matter: 1.0.0 - strip-bom-string: 1.0.0 - gzip-size@7.0.0: dependencies: duplexer: 0.1.2 @@ -29956,8 +29557,6 @@ snapshots: is-docker@4.0.0: {} - is-extendable@0.1.1: {} - is-extglob@2.1.1: {} is-finalizationregistry@1.1.1: @@ -30520,10 +30119,6 @@ snapshots: lines-and-columns@1.2.4: {} - linkify-it@5.0.0: - dependencies: - uc.micro: 2.1.0 - lint-staged@16.4.0: dependencies: commander: 14.0.3 @@ -30763,23 +30358,10 @@ snapshots: transitivePeerDependencies: - supports-color - mark.js@8.11.1: {} - markdown-extensions@2.0.0: {} - markdown-it@14.1.0: - dependencies: - argparse: 2.0.1 - entities: 4.5.0 - linkify-it: 5.0.0 - mdurl: 2.0.0 - punycode.js: 2.3.1 - uc.micro: 2.1.0 - markdown-table@3.0.4: {} - markdown-title@1.0.2: {} - math-intrinsics@1.1.0: {} mdast-util-definitions@6.0.0: @@ -30826,17 +30408,6 @@ snapshots: transitivePeerDependencies: - supports-color - mdast-util-frontmatter@2.0.1: - dependencies: - '@types/mdast': 4.0.4 - devlop: 1.1.0 - escape-string-regexp: 5.0.0 - mdast-util-from-markdown: 2.0.3 - mdast-util-to-markdown: 2.1.2 - micromark-extension-frontmatter: 2.0.0 - transitivePeerDependencies: - - supports-color - mdast-util-gfm-autolink-literal@2.0.1: dependencies: '@types/mdast': 4.0.4 @@ -30980,8 +30551,6 @@ snapshots: mdn-data@2.27.1: {} - mdurl@2.0.0: {} - media-typer@0.3.0: {} media-typer@1.1.0: {} @@ -31050,13 +30619,6 @@ snapshots: micromark-util-types: 2.0.2 parse-entities: 4.0.2 - micromark-extension-frontmatter@2.0.0: - dependencies: - fault: 2.0.1 - micromark-util-character: 2.1.1 - micromark-util-symbol: 2.0.1 - micromark-util-types: 2.0.2 - micromark-extension-gfm-autolink-literal@2.1.0: dependencies: micromark-util-character: 2.1.1 @@ -31307,10 +30869,6 @@ snapshots: braces: 3.0.3 picomatch: 2.3.1 - millify@6.1.0: - dependencies: - yargs: 17.7.2 - mime-db@1.52.0: {} mime-db@1.54.0: {} @@ -31399,8 +30957,6 @@ snapshots: minipass@7.1.2: {} - minisearch@7.2.0: {} - minizlib@2.1.2: dependencies: minipass: 3.3.6 @@ -33447,8 +33003,6 @@ snapshots: end-of-stream: 1.4.5 once: 1.4.0 - punycode.js@2.3.1: {} - punycode@1.4.1: {} punycode@2.3.1: {} @@ -33802,15 +33356,6 @@ snapshots: transitivePeerDependencies: - supports-color - remark-frontmatter@5.0.0: - dependencies: - '@types/mdast': 4.0.4 - mdast-util-frontmatter: 2.0.1 - micromark-extension-frontmatter: 2.0.0 - unified: 11.0.5 - transitivePeerDependencies: - - supports-color - remark-gfm@4.0.1: dependencies: '@types/mdast': 4.0.4 @@ -33859,15 +33404,6 @@ snapshots: mdast-util-to-markdown: 2.1.2 unified: 11.0.5 - remark@15.0.1: - dependencies: - '@types/mdast': 4.0.4 - remark-parse: 11.0.0 - remark-stringify: 11.0.0 - unified: 11.0.5 - transitivePeerDependencies: - - supports-color - remove-accents@0.5.0: {} remove-trailing-separator@1.1.0: {} @@ -34243,11 +33779,6 @@ snapshots: search-insights@2.17.3: {} - section-matter@1.0.0: - dependencies: - extend-shallow: 2.0.1 - kind-of: 6.0.3 - secure-json-parse@4.1.0: {} select-hose@2.0.0: {} @@ -34457,17 +33988,6 @@ snapshots: shell-quote@1.8.3: {} - shiki@3.23.0: - dependencies: - '@shikijs/core': 3.23.0 - '@shikijs/engine-javascript': 3.23.0 - '@shikijs/engine-oniguruma': 3.23.0 - '@shikijs/langs': 3.23.0 - '@shikijs/themes': 3.23.0 - '@shikijs/types': 3.23.0 - '@shikijs/vscode-textmate': 10.0.2 - '@types/hast': 3.0.4 - shiki@4.0.2: dependencies: '@shikijs/core': 4.0.2 @@ -34869,8 +34389,6 @@ snapshots: dependencies: ansi-regex: 6.2.0 - strip-bom-string@1.0.0: {} - strip-bom@3.0.0: {} strip-final-newline@3.0.0: {} @@ -35017,8 +34535,6 @@ snapshots: system-architecture@0.1.0: {} - tabbable@6.4.0: {} - tagged-tag@1.0.0: {} tailwindcss@3.4.14(ts-node@10.9.2(@swc/core@1.15.18)(@types/node@24.12.2)(typescript@6.0.2)): @@ -35274,8 +34790,6 @@ snapshots: toidentifier@1.0.1: {} - tokenx@1.3.0: {} - toml@3.0.0: {} totalist@3.0.1: {} @@ -35532,8 +35046,6 @@ snapshots: ua-parser-js@0.7.41: {} - uc.micro@2.1.0: {} - ufo@1.6.1: {} ufo@1.6.3: {} @@ -36486,74 +35998,6 @@ snapshots: optionalDependencies: vite: 7.3.3(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3) - vitepress-plugin-llms@1.12.0: - dependencies: - gray-matter: 4.0.3 - markdown-it: 14.1.0 - markdown-title: 1.0.2 - mdast-util-from-markdown: 2.0.3 - millify: 6.1.0 - minimatch: 10.2.4 - path-to-regexp: 6.3.0 - picocolors: 1.1.1 - pretty-bytes: 7.1.0 - remark: 15.0.1 - remark-frontmatter: 5.0.0 - tokenx: 1.3.0 - unist-util-remove: 4.0.0 - unist-util-visit: 5.1.0 - transitivePeerDependencies: - - supports-color - - vitepress@2.0.0-alpha.16(patch_hash=828e6d2347338f051e3210f9d54e3a79212e9afb26e6b8a746d7ad5f58e9385b)(@types/node@25.2.1)(axios@1.13.4)(fuse.js@7.1.0)(jiti@2.6.1)(jwt-decode@4.0.0)(less@4.4.2)(lightningcss@1.32.0)(oxc-minify@0.110.0)(postcss@8.5.14)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(typescript@6.0.2)(yaml@2.8.3): - dependencies: - '@docsearch/css': 4.6.0 - '@docsearch/js': 4.6.0 - '@docsearch/sidepanel-js': 4.6.0 - '@iconify-json/simple-icons': 1.2.69 - '@shikijs/core': 3.23.0 - '@shikijs/transformers': 3.23.0 - '@shikijs/types': 3.23.0 - '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 6.0.4(vite@7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))(vue@3.5.27(typescript@6.0.2)) - '@vue/devtools-api': 8.0.5 - '@vue/shared': 3.5.27 - '@vueuse/core': 14.2.1(vue@3.5.27(typescript@6.0.2)) - '@vueuse/integrations': 14.2.1(axios@1.13.4)(focus-trap@7.8.0)(fuse.js@7.1.0)(jwt-decode@4.0.0)(vue@3.5.27(typescript@6.0.2)) - focus-trap: 7.8.0 - mark.js: 8.11.1 - minisearch: 7.2.0 - shiki: 3.23.0 - vite: 7.3.1(@types/node@25.2.1)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.32.0)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3) - vue: 3.5.27(typescript@6.0.2) - optionalDependencies: - oxc-minify: 0.110.0 - postcss: 8.5.14 - transitivePeerDependencies: - - '@types/node' - - async-validator - - axios - - change-case - - drauu - - fuse.js - - idb-keyval - - jiti - - jwt-decode - - less - - lightningcss - - nprogress - - qrcode - - sass - - sass-embedded - - sortablejs - - stylus - - sugarss - - terser - - tsx - - typescript - - universal-cookie - - yaml - vitest-environment-nuxt@2.0.0(@vue/test-utils@2.4.10(@vue/compiler-dom@3.5.34)(@vue/server-renderer@3.5.34(vue@3.5.27(typescript@6.0.2)))(vue@3.5.27(typescript@6.0.2)))(jsdom@29.0.1)(magicast@0.3.5)(typescript@6.0.2)(vite@8.0.8(@types/node@25.2.1)(esbuild@0.27.3)(jiti@2.6.1)(less@4.4.2)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))(vitest@4.1.0(@types/node@25.2.1)(jsdom@29.0.1)(msw@2.13.2(@types/node@25.2.1)(typescript@6.0.2))(vite@8.0.8(@types/node@25.2.1)(esbuild@0.27.3)(jiti@2.6.1)(less@4.4.2)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))): dependencies: '@nuxt/test-utils': 4.0.3(@vue/test-utils@2.4.10(@vue/compiler-dom@3.5.34)(@vue/server-renderer@3.5.34(vue@3.5.27(typescript@6.0.2)))(vue@3.5.27(typescript@6.0.2)))(jsdom@29.0.1)(magicast@0.3.5)(typescript@6.0.2)(vite@8.0.8(@types/node@25.2.1)(esbuild@0.27.3)(jiti@2.6.1)(less@4.4.2)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))(vitest@4.1.0(@types/node@25.2.1)(jsdom@29.0.1)(msw@2.13.2(@types/node@25.2.1)(typescript@6.0.2))(vite@8.0.8(@types/node@25.2.1)(esbuild@0.27.3)(jiti@2.6.1)(less@4.4.2)(sass@1.97.3)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.3))) @@ -36764,15 +36208,6 @@ snapshots: '@vue/language-core': 3.2.4 typescript: 6.0.2 - vue3-select-component@0.16.0(vue@3.5.25(typescript@6.0.2)): - dependencies: - '@floating-ui/vue': 1.1.10(vue@3.5.25(typescript@6.0.2)) - vue: 3.5.25(typescript@6.0.2) - optionalDependencies: - '@rollup/rollup-linux-x64-gnu': 4.57.1 - transitivePeerDependencies: - - '@vue/composition-api' - vue@3.5.13(typescript@6.0.2): dependencies: '@vue/compiler-dom': 3.5.13 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c883002b5f..3bee29db11 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,10 +1,6 @@ packages: - - docs - dev/** - examples/**/* - packages/**/* - web - '!examples/*/.output' - -patchedDependencies: - vitepress: patches/vitepress.patch diff --git a/scripts/update-contributors.sh b/scripts/update-contributors.sh index 4398139270..8969d14a7a 100644 --- a/scripts/update-contributors.sh +++ b/scripts/update-contributors.sh @@ -16,7 +16,7 @@ if [[ -n "${GITHUB_TOKEN:-}" ]]; then AUTH_HEADER=(-H "Authorization: token $GITHUB_TOKEN") fi -SINCE_FILE="./docs/.contributorssince" +# SINCE_FILE="./docs/.contributorssince" # disabled for now, we'd need to append to the list instead of write # if [[ -f "$SINCE_FILE" ]]; then @@ -105,7 +105,7 @@ if [ "$MAX_COMMIT_EPOCH" -gt 0 ]; then BUFFER_SECONDS=$((BUFFER_DAYS * 86400)) BUFFERED_EPOCH=$((MAX_COMMIT_EPOCH - BUFFER_SECONDS)) BUFFERED_DATE=$(date -u -r "$BUFFERED_EPOCH" "+%Y-%m-%dT%H:%M:%SZ") - echo "$BUFFERED_DATE" > "$SINCE_FILE" + # echo "$BUFFERED_DATE" > "$SINCE_FILE" echo "Updated SINCE to $BUFFERED_DATE" fi diff --git a/turbo.json b/turbo.json index b32a4c702e..c9caae4539 100644 --- a/turbo.json +++ b/turbo.json @@ -10,14 +10,7 @@ "tsconfig.json", "tsdown.config.ts" ], - "outputs": [ - ".next/**", - "!.next/cache/**", - ".output/**", - ".svelte-kit/**", - ".vitepress/dist/**", - "dist/**" - ] + "outputs": [".next/**", "!.next/cache/**", ".output/**", ".svelte-kit/**", "dist/**"] }, "dev": { "cache": false, diff --git a/web/package.json b/web/package.json index a556e55aeb..2ad358996f 100644 --- a/web/package.json +++ b/web/package.json @@ -2,7 +2,7 @@ "name": "web", "version": "0.0.1", "private": true, - "description": "Hey API documentation.", + "description": "Hey API website.", "type": "module", "scripts": { "astro": "astro", diff --git a/web/src/utils/github.ts b/web/src/utils/github.ts index 2ee93b267b..ca810d2d8d 100644 --- a/web/src/utils/github.ts +++ b/web/src/utils/github.ts @@ -103,7 +103,7 @@ export async function fetchSponsorGoal(): Promise { headers: { Authorization: `bearer ${token}`, 'Content-Type': 'application/json', - 'User-Agent': 'hey-api-docs', + 'User-Agent': 'hey-api-web', }, method: 'POST', }),