···7788Thank you for considering contributing to Hey API. In order to increase the likelihood of your changes being merged, first open an issue if one does not already exist. Once an issue exists, let us know you'd like to work on it. We will confirm whether we're looking to resolve the issue and provide you with guidance if required. This is to ensure our codebase remains in good state and all features contribute to Hey API's [objectives](/about).
991010-## Development Requirements
1010+## Prerequisites
11111212-- [git](https://git-scm.com/)
1313-- [node](https://nodejs.org/en) (version `18.0` or higher)
1414-- [pnpm](https://pnpm.io/) (version `8` or higher)
1212+You should have a working knowledge of [git](https://git-scm.com/), [node](https://nodejs.org/en), and [pnpm](https://pnpm.io/).
15131616-## Install Dependencies
1414+## Guidelines
17151818-We use pnpm as our package manager. You can setup and install all dependencies running the following command:
1616+Your [pull request](https://help.github.com/articles/using-pull-requests) must:
19172020-```sh
2121-pnpm install
2222-```
2323-2424-## Pull Request Guidelines
1818+- address a single issue or add a single item of functionality
1919+- contain a clean history of small, incremental, logically separate commits, with no merge commits
2020+- use clear commit messages
2121+- be possible to merge automatically
25222626-If you are unfamiliar with GitHub Pull Requests, please read the following documentation:
2727-https://help.github.com/articles/using-pull-requests
2828-2929-**Your Pull Request must:**
3030-3131-- Address a single issue or add a single item of functionality.
3232-- Contain a clean history of small, incremental, logically separate commits, with no merge commits.
3333-- Use clear commit messages.
3434-- Be possible to merge automatically.
3535-3636-## Submitting a Pull Request
3737-3838-1. Make your changes in a new git branch: `git checkout -b my-fix-branch main`
3939-1. Create your patch or feature
4040-1. Ensure the builds work by running: `pnpm build`
4141-1. Ensure the tests will pass by running: `pnpm test`
4242-1. Ensure the code is formatted by running: `pnpm lint:fix`
4343-1. Ensure that you create a changeset if required by running: `pnpm changeset`
4444-1. Commit your changes using a descriptive commit message
4545-4646-After your Pull Request is created, it will automatically be built and tested in GitHub actions. Once successful, it will be ready for review.
2323+<!--@include: ./sponsorship.md-->
···11---
22title: Clients
33-description: REST clients for your stack. Compatible with all our features.
33+description: REST clients for Hey API. Compatible with all our features.
44---
5566<script setup>
···13131414## Features
15151616-- seamless integration with `@hey-api/openapi-ts`
1616+- seamless integration with `@hey-api/openapi-ts` ecosystem
1717- type-safe response data and errors
1818- access to the original request and response
1919- granular request and response customization options
···2727- [Legacy](/openapi-ts/clients/legacy)
2828- [Next.js](https://nextjs.org/) <span class="soon">Soon</span>
29293030-If you'd like a standalone package for your client, let us know by [opening an issue](https://github.com/hey-api/openapi-ts/issues).
3030+If you'd like Hey API to support your client, let us know by [opening an issue](https://github.com/hey-api/openapi-ts/issues).
31313232<!--@include: ../examples.md-->
3333<!--@include: ../sponsorship.md-->
+3-3
docs/openapi-ts/clients/axios.md
···11---
22title: Axios client
33-description: Axios client for your stack. Compatible with all our features.
33+description: Axios client for Hey API. Compatible with all our features.
44---
5566<script setup>
···1313Axios 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).
1414:::
15151616-Plug and play Axios wrapper for `@hey-api/openapi-ts` generator.
1616+[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.
17171818<button class="buttonLink" @click="(event) => embedProject('hey-api-client-axios-example')(event)">
1919Live demo
···142142143143## Bundling
144144145145-Sometimes, you may not want to declare standalone clients as a dependency. This scenario is common if you're using Hey API to generate output that is repackaged and published for other consumers under your own brand. For such cases, our clients support bundling through the `client.bundle` configuration option.
145145+Sometimes, you may not want to declare client packages as a dependency. This scenario is common if you're using Hey API to generate output that is repackaged and published for other consumers under your own brand. For such cases, our clients support bundling through the `client.bundle` configuration option.
146146147147```js
148148export default {
+3-3
docs/openapi-ts/clients/fetch.md
···11---
22title: Fetch API client
33-description: Fetch API client for your stack. Compatible with all our features.
33+description: Fetch API client for Hey API. Compatible with all our features.
44---
5566<script setup>
···1313Fetch API 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).
1414:::
15151616-Plug and play Fetch API wrapper for `@hey-api/openapi-ts` generator.
1616+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.
17171818<button class="buttonLink" @click="(event) => embedProject('hey-api-client-fetch-example')(event)">
1919Live demo
···181181182182## Bundling
183183184184-Sometimes, you may not want to declare standalone clients as a dependency. This scenario is common if you're using Hey API to generate output that is repackaged and published for other consumers under your own brand. For such cases, our clients support bundling through the `client.bundle` configuration option.
184184+Sometimes, you may not want to declare client packages as a dependency. This scenario is common if you're using Hey API to generate output that is repackaged and published for other consumers under your own brand. For such cases, our clients support bundling through the `client.bundle` configuration option.
185185186186```js
187187export default {
+2-2
docs/openapi-ts/clients/legacy.md
···11---
22title: Legacy clients
33-description: Legacy client for your stack.
33+description: Legacy clients for Hey API.
44---
5566<script setup>
···991010# Legacy Clients
11111212-Before standalone client packages, clients were generated using `@hey-api/openapi-ts`. In fact, `@hey-api/openapi-ts` still supports generating legacy clients. You can generate them with the `client` config option.
1212+Before client packages, clients were generated using `@hey-api/openapi-ts`. In fact, `@hey-api/openapi-ts` still supports generating legacy clients. You can generate them with the `client` config option.
13131414::: code-group
1515
+6-1
docs/openapi-ts/get-started.md
···991010# Get Started
11111212-🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.
1212+::: warning
1313+This package is in initial 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).
1414+:::
1515+1616+[@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) is an OpenAPI to TypeScript codegen trusted more than 500k times each month to generate reliable API clients and SDKs.
13171418<button class="buttonLink" @click="(event) => embedProject('hey-api-example')(event)">
1519Live demo
···2226- supports both JSON and YAML input files
2327- generates TypeScript interfaces, REST clients, and JSON Schemas
2428- Fetch API, Axios, Angular, Node.js, and XHR clients available
2929+- plugin ecosystem to reduce third-party boilerplate
25302631## Quick Start
2732
+4
docs/openapi-ts/integrations.md
···5566# Integrations <span class="soon">Soon</span>
7788+::: warning
99+GitHub integration is not publicly available yet. We are gathering feedback from beta testers to ensure the final product meets our quality standards. To express your interest in joining the beta test, please open an issue on [GitHub](https://github.com/hey-api/upload-openapi-spec/issues).
1010+:::
1111+812Integrations allow you to automate your client generation workflow. Create dependency links between your clients and APIs, and watch the magic unfold. While we prefer to use `@hey-api/openapi-ts` for generating clients, you can use any codegen.
9131014## Upload OpenAPI Spec
+3-3
docs/openapi-ts/migrating.md
···5566# Migrating
7788-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 an issue with migration, please [open an issue](https://github.com/hey-api/openapi-ts/issues).
88+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).
991010## @next
1111···123123124124### Removed internal `client` export
125125126126-Previously, standalone clients would create a default client which you'd then import and configure.
126126+Previously, client packages would create a default client which you'd then import and configure.
127127128128```js
129129import { client, createClient } from '@hey-api/client-fetch';
···137137138138This client instance was used internally by services unless overridden. Apart from running `createClient()` twice, people were confused about the meaning of `global` configuration option.
139139140140-Starting with v0.52.0, standalone clients 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.
140140+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.
141141142142```js
143143import { client } from 'client/services.gen';
+1-1
docs/openapi-ts/output.md
···250250251251## Core
252252253253-Client core files are located in the `core` folder. This folder will include different files depending on which client you're using. With standalone packages, this folder isn't generated by default. If you want to bundle standalone clients into your output, read the [Bundling](/openapi-ts/clients#bundling) section.
253253+Client core files are located in the `core` folder. This folder will include different files depending on which client you're using. With client packages, this folder isn't generated by default. If you want to bundle client packages into your output, read the [Bundling](/openapi-ts/clients#bundling) section.
254254255255For legacy clients, the [`OpenAPI`](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/templates/core/OpenAPI.hbs#L68-L84) configuration object will be most likely of interest. You can change its properties to set authorization tokens, base URL, and more.
256256
+9-2
docs/openapi-ts/tanstack-query.md
···11---
22title: TanStack Query
33-description: Generate query keys and functions. Use them with our REST clients or bring your own.
33+description: TanStack Query plugin for Hey API. Compatible with all our features.
44---
5566<script setup>
···1313TanStack Query 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).
1414:::
15151616-[TanStack Query](https://tanstack.com/query) is one of the most popular state management solutions. Hey API can generate query keys and functions for you, so you can focus on building your product. Everything is compatible with our REST clients, but you can bring your own too.
1616+[TanStack Query](https://tanstack.com/query) is a powerful asynchronous state management solution for TypeScript/JavaScript, React, Solid, Vue, Svelte, and Angular.
17171818<button class="buttonLink" @click="(event) => embedProject('hey-api-client-fetch-plugin-tanstack-react-query-example')(event)">
1919Live demo
2020</button>
2121+2222+## Features
2323+2424+- seamless integration with `@hey-api/openapi-ts` ecosystem
2525+- create query keys following the best practices
2626+- type-safe query options, infinite query options, and mutation options
2727+- minimal learning curve thanks to extending the underlying technology
21282229## Installation
2330
+12
docs/openapi-ts/zod.md
···11+---
22+title: Zod
33+description: Zod plugin for Hey API. Compatible with all our features.
44+---
55+66+# Zod
77+88+::: warning
99+Zod plugin is in development. You can follow the updates and provide feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues/876).
1010+:::
1111+1212+[Zod](https://zod.dev/) is a TypeScript-first schema validation library with static type inference.
+2-4
packages/client-axios/README.md
···11<div align="center">
22 <img width="150" height="150" src="https://heyapi.dev/logo.png" alt="Logo">
33 <h1 align="center"><b>Axios Client</b></h1>
44- <p align="center">🚀 Type-safe Axios client for your Hey API types.</p>
44+ <p align="center">🚀 Axios client for `@hey-api/openapi-ts` codegen.</p>
55</div>
66-77-Plug and play Axios wrapper for `@hey-api/openapi-ts` generator.
8697[Live demo](https://stackblitz.com/edit/hey-api-client-axios-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fservices.gen.ts,src%2Fclient%2Ftypes.gen.ts,src%2FApp.tsx)
108119## Features
12101313-- seamless integration with `@hey-api/openapi-ts`
1111+- seamless integration with `@hey-api/openapi-ts` ecosystem
1412- type-safe response data and errors
1513- access to the original request and response
1614- granular request and response customization options
···11<div align="center">
22 <img width="150" height="150" src="https://heyapi.dev/logo.png" alt="Logo">
33 <h1 align="center"><b>Fetch API Client</b></h1>
44- <p align="center">🚀 Type-safe Fetch API client for your Hey API types.</p>
44+ <p align="center">🚀 Fetch API client for `@hey-api/openapi-ts` codegen.</p>
55</div>
66-77-Plug and play Fetch API wrapper for `@hey-api/openapi-ts` generator.
8697[Live demo](https://stackblitz.com/edit/hey-api-client-fetch-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fservices.gen.ts,src%2Fclient%2Ftypes.gen.ts,src%2FApp.tsx)
108119## Features
12101313-- seamless integration with `@hey-api/openapi-ts`
1111+- seamless integration with `@hey-api/openapi-ts` ecosystem
1412- type-safe response data and errors
1513- access to the original request and response
1614- granular request and response customization options
+1-1
packages/client-fetch/package.json
···11{
22 "name": "@hey-api/client-fetch",
33 "version": "0.4.2",
44- "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types",
44+ "description": "🚀 Fetch API client for `@hey-api/openapi-ts` codegen.",
55 "homepage": "https://heyapi.dev/",
66 "repository": {
77 "type": "git",
+1
packages/openapi-ts/README.md
···1313- supports both JSON and YAML input files
1414- generates TypeScript interfaces, REST clients, and JSON Schemas
1515- Fetch API, Axios, Angular, Node.js, and XHR clients available
1616+- plugin ecosystem to reduce third-party boilerplate
16171718## Documentation
1819
+4-4
packages/openapi-ts/src/generate/client.ts
···2424export const clientOptionsTypeName = () => 'Options';
25252626/**
2727- * (optional) Creates a `client.ts` file containing the same exports as a
2828- * standalone client package. Creates a `client` directory containing the modules
2929- * from standalone client. These files are generated only when `client.bundle`
3030- * is set to true.
2727+ * (optional) Creates a `client.ts` file containing the same exports as the
2828+ * client package. Creates a `client` directory containing the modules from
2929+ * the client package. These files are generated only when `client.bundle` is
3030+ * set to true.
3131 */
3232export const generateClient = async (
3333 outputPath: string,
+3-3
packages/openapi-ts/src/types/config.ts
···2929 | false
3030 | {
3131 /**
3232- * Bundle the client module? Set this to true if you're using a standalone
3333- * client package and don't want to declare it as a separate dependency.
3434- * When true, the client module will be generated from the standalone
3232+ * Bundle the client module? Set this to true if you're using a client
3333+ * package and don't want to declare it as a separate dependency.
3434+ * When true, the client module will be generated from the client
3535 * package and bundled with the rest of the generated output. This is
3636 * useful if you're repackaging the output, publishing it to other users,
3737 * and you don't want them to install any dependencies.
+1-1
packages/openapi-ts/src/utils/type.ts
···158158 ? escapeName(unescapeName(transformTypeKeyName(property.name)))
159159 : // special test for 1XX status codes. We need a more robust system
160160 // for escaping values depending on context in which they're printed,
161161- // but since this works for standalone client, it's not worth it right now
161161+ // but since this works for client packages, it's not worth it right now
162162 /^\dXX$/.test(property.name)
163163 ? escapeName(property.name)
164164 : property.name;