···11+---
22+'@hey-api/openapi-ts': patch
33+---
44+55+fix(parser): add parameters, requestBodies, and responses to supported input.patch fields
+20-76
docs/openapi-ts/configuration.md
···474474};
475475```
476476477477-## Patch Schemas
478478-479479-If you need to modify schemas in your OpenAPI specification before code generation, you can use `input.patch.schemas` to apply custom transformations to specific schemas.
477477+## Patch
480478481481-You can provide patch functions for individual schemas by their names. Each function receives the schema object and can modify it directly.
479479+There are times when you need to modify your input before it's processed further. A common use case is fixing an invalid specification or adding a missing field. You can apply custom patches with `input.patch`.
482480483483-::: code-group
481481+You can patch individual schemas by their name. All patches work with raw input data and are applied before we generate any code.
484482485485-```js [date-time to timestamp]
483483+```js
486484export default {
487485 input: {
488486 patch: {
489487 schemas: {
490490- UserResponseDto: (schema) => {
491491- // Convert date-time format to timestamp
492492- if (schema.properties?.updatedAt) {
493493- delete schema.properties.updatedAt.format;
494494- schema.properties.updatedAt.type = 'number';
495495- }
488488+ Foo: (schema) => {
489489+ // convert date-time format to timestamp
490490+ delete schema.properties.updatedAt.format;
491491+ schema.properties.updatedAt.type = 'number';
496492 },
497497- },
498498- },
499499- path: 'https://get.heyapi.dev/hey-api/backend',
500500- },
501501- output: 'src/client',
502502- plugins: ['@hey-api/client-fetch'],
503503-};
504504-```
505505-506506-```js [add properties]
507507-export default {
508508- input: {
509509- patch: {
510510- schemas: {
511511- ProductModel: (schema) => {
512512- // Add metadata property
513513- schema.properties.metadata = {
514514- type: 'object',
493493+ Bar: (schema) => {
494494+ // add missing property
495495+ schema.properties.meta = {
515496 additionalProperties: true,
497497+ type: 'object',
516498 };
517517- schema.required = ['id'];
499499+ schema.required = ['meta'];
518500 },
519519- },
520520- },
521521- path: 'https://get.heyapi.dev/hey-api/backend',
522522- },
523523- output: 'src/client',
524524- plugins: ['@hey-api/client-fetch'],
525525-};
526526-```
527527-528528-```js [remove properties]
529529-export default {
530530- input: {
531531- patch: {
532532- schemas: {
533533- ApiResponseDto: (schema) => {
534534- // Remove internal fields
501501+ Baz: (schema) => {
502502+ // remove property
535503 delete schema.properties.internalField;
536504 },
537505 },
···543511};
544512```
545513546546-```ts [typescript]
547547-import { defineConfig, type OpenApiSchemaObject } from '@hey-api/openapi-ts';
548548-549549-export default defineConfig({
550550- input: {
551551- patch: {
552552- schemas: {
553553- ApiResponseDto: (schema: OpenApiSchemaObject.V3_1_X) => {
554554- if (typeof schema.properties?.updatedAt === 'object') {
555555- delete schema.properties.updatedAt.format;
556556- schema.properties.updatedAt.type = 'number';
557557- }
558558- },
559559- },
560560- },
561561- path: 'https://get.heyapi.dev/hey-api/backend',
562562- },
563563- output: 'src/client',
564564- plugins: ['@hey-api/client-fetch'],
565565-});
566566-```
567567-568568-:::
569569-570570-Patch functions work with both OpenAPI v3.x schemas (in `components.schemas`) and Swagger v2.0 schemas (in `definitions`).
571571-572514## Watch Mode
573515574516::: warning
575517Watch mode currently supports only remote files via URL.
576518:::
577519578578-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.
520520+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.
579521580522::: code-group
581523582524```js [config]
583525export default {
584584- input: 'https://get.heyapi.dev/hey-api/backend',
526526+ input: {
527527+ path: 'https://get.heyapi.dev/hey-api/backend',
528528+ watch: true, // [!code ++]
529529+ },
585530 output: 'src/client',
586531 plugins: ['@hey-api/client-fetch'],
587587- watch: true, // [!code ++]
588532};
589533```
590534
···66import { getSpec } from './getSpec';
77import type { IR } from './ir/types';
88import { parseLegacy, parseOpenApiSpec } from './openApi';
99-import { patchSchemas } from './patchSchemas';
99+import { patchOpenApiSpec } from './openApi/shared/utils/patch';
1010import { processOutput } from './processOutput';
1111import type { Client } from './types/client';
1212import type { Config } from './types/config';
···213213 });
214214 Performance.end('spec');
215215216216- if (config.input.patch) {
217217- Performance.start('patch');
218218- patchSchemas({ data, patch: config.input.patch });
219219- Performance.end('patch');
220220- }
221221-222216 // throw on first run if there's an error to preserve user experience
223217 // if in watch mode, subsequent errors won't throw to gracefully handle
224218 // cases where server might be reloading
···232226 let context: IR.Context | undefined;
233227234228 if (data) {
229229+ Performance.start('input.patch');
230230+ patchOpenApiSpec({ patchOptions: config.input.patch, spec: data });
231231+ Performance.end('input.patch');
232232+235233 Performance.start('parser');
236234 if (
237235 config.experimentalParser &&
+6
packages/openapi-ts/src/openApi/2.0.x/index.ts
···11export { parseV2_0_X } from './parser';
22export type { OpenApiV2_0_X } from './types/spec';
33+44+import type { SchemaObject } from './types/spec';
55+66+export interface OpenApiV2_0_XTypes {
77+ SchemaObject: SchemaObject;
88+}
+16
packages/openapi-ts/src/openApi/3.0.x/index.ts
···11export { parseV3_0_X } from './parser';
22export type { OpenApiV3_0_X } from './types/spec';
33+44+import type {
55+ ParameterObject,
66+ ReferenceObject,
77+ RequestBodyObject,
88+ ResponseObject,
99+ SchemaObject,
1010+} from './types/spec';
1111+1212+export interface OpenApiV3_0_XTypes {
1313+ ParameterObject: ParameterObject;
1414+ ReferenceObject: ReferenceObject;
1515+ RequestBodyObject: RequestBodyObject;
1616+ ResponseObject: ResponseObject;
1717+ SchemaObject: SchemaObject;
1818+}
+16
packages/openapi-ts/src/openApi/3.1.x/index.ts
···11export { parseV3_1_X } from './parser';
22export type { OpenApiV3_1_X } from './types/spec';
33+44+import type {
55+ ParameterObject,
66+ ReferenceObject,
77+ RequestBodyObject,
88+ ResponseObject,
99+ SchemaObject,
1010+} from './types/spec';
1111+1212+export interface OpenApiV3_1_XTypes {
1313+ ParameterObject: ParameterObject;
1414+ ReferenceObject: ReferenceObject;
1515+ RequestBodyObject: RequestBodyObject;
1616+ ResponseObject: ResponseObject;
1717+ SchemaObject: SchemaObject;
1818+}
···11import type { OpenApiV2Schema, OpenApiV3Schema } from '../../../openApi';
22-import type { SchemaObject as OpenApiV2_0_XSchemaObject } from '../../../openApi/2.0.x/types/spec';
33-import type {
44- ReferenceObject as OpenApiV3_0_XReferenceObject,
55- SchemaObject as OpenApiV3_0_XSchemaObject,
66-} from '../../../openApi/3.0.x/types/spec';
77-import type { SchemaObject as OpenApiV3_1_XSchemaObject } from '../../../openApi/3.1.x/types/spec';
22+import type { OpenApiV2_0_XTypes } from '../../../openApi/2.0.x';
33+import type { OpenApiV3_0_XTypes } from '../../../openApi/3.0.x';
44+import type { OpenApiV3_1_XTypes } from '../../../openApi/3.1.x';
85import type { Plugin } from '../../types';
96107export interface Config extends Plugin.Name<'@hey-api/schemas'> {
···2926 schema:
3027 | OpenApiV2Schema
3128 | OpenApiV3Schema
3232- | OpenApiV2_0_XSchemaObject
3333- | OpenApiV3_0_XReferenceObject
3434- | OpenApiV3_0_XSchemaObject
3535- | OpenApiV3_1_XSchemaObject,
2929+ | OpenApiV2_0_XTypes['SchemaObject']
3030+ | OpenApiV3_0_XTypes['ReferenceObject']
3131+ | OpenApiV3_0_XTypes['SchemaObject']
3232+ | OpenApiV3_1_XTypes['SchemaObject'],
3633 ) => string);
3734 /**
3835 * Name of the generated file.
+1-304
packages/openapi-ts/src/types/config.d.ts
···11-import type { OpenApiSchemaObject } from '../openApi/types';
21import type { ClientPlugins, UserPlugins } from '../plugins';
22+import type { Input, Watch } from './input';
33import type { ArrayOfObjectsToObjectMap, ExtractArrayOfObjects } from './utils';
4455export type Formatters = 'biome' | 'prettier';
···1212 | 'preserve'
1313 | 'snake_case'
1414 | 'SCREAMING_SNAKE_CASE';
1515-1616-interface Watch {
1717- /**
1818- * Regenerate the client when the input file changes?
1919- *
2020- * @default false
2121- */
2222- enabled?: boolean;
2323- /**
2424- * How often should we attempt to detect the input file change? (in ms)
2525- *
2626- * @default 1000
2727- */
2828- interval?: number;
2929- /**
3030- * How long will we wait before the request times out?
3131- *
3232- * @default 60_000
3333- */
3434- timeout?: number;
3535-}
3636-3737-interface Input {
3838- /**
3939- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
4040- *
4141- * Projects are private by default, you will need to be authenticated
4242- * to download OpenAPI specifications. We recommend using project API
4343- * keys in CI workflows and personal API keys for local development.
4444- *
4545- * API key isn't required for public projects. You can also omit this
4646- * parameter and provide an environment variable `HEY_API_TOKEN`.
4747- */
4848- api_key?: string;
4949- /**
5050- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
5151- *
5252- * You can fetch the last build from branch by providing the branch
5353- * name.
5454- */
5555- branch?: string;
5656- /**
5757- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
5858- *
5959- * You can fetch an exact specification by providing a commit sha.
6060- * This will always return the same file.
6161- */
6262- commit_sha?: string;
6363- /**
6464- * You pass any valid Fetch API options to the request for fetching your
6565- * specification. This is useful if your file is behind auth for example.
6666- */
6767- fetch?: RequestInit;
6868- /**
6969- * Filters can be used to select a subset of your input before it's processed
7070- * by plugins.
7171- */
7272- filters?: {
7373- /**
7474- * Include deprecated resources in the output?
7575- *
7676- * @default true
7777- */
7878- deprecated?: boolean;
7979- operations?: {
8080- /**
8181- * Prevent operations matching the `exclude` filters from being processed.
8282- *
8383- * In case of conflicts, `exclude` takes precedence over `include`.
8484- *
8585- * @example ['GET /api/v1/foo']
8686- */
8787- exclude?: ReadonlyArray<string>;
8888- /**
8989- * Process only operations matching the `include` filters.
9090- *
9191- * In case of conflicts, `exclude` takes precedence over `include`.
9292- *
9393- * @example ['GET /api/v1/foo']
9494- */
9595- include?: ReadonlyArray<string>;
9696- };
9797- /**
9898- * Keep reusable components without any references in the output? By
9999- * default, we exclude orphaned resources.
100100- *
101101- * @default false
102102- */
103103- orphans?: boolean;
104104- parameters?: {
105105- /**
106106- * Prevent parameters matching the `exclude` filters from being processed.
107107- *
108108- * In case of conflicts, `exclude` takes precedence over `include`.
109109- *
110110- * @example ['QueryParam']
111111- */
112112- exclude?: ReadonlyArray<string>;
113113- /**
114114- * Process only parameters matching the `include` filters.
115115- *
116116- * In case of conflicts, `exclude` takes precedence over `include`.
117117- *
118118- * @example ['QueryParam']
119119- */
120120- include?: ReadonlyArray<string>;
121121- };
122122- /**
123123- * Should we preserve the key order when overwriting your input? This
124124- * option is disabled by default to improve performance.
125125- *
126126- * @default false
127127- */
128128- preserveOrder?: boolean;
129129- requestBodies?: {
130130- /**
131131- * Prevent request bodies matching the `exclude` filters from being processed.
132132- *
133133- * In case of conflicts, `exclude` takes precedence over `include`.
134134- *
135135- * @example ['Foo']
136136- */
137137- exclude?: ReadonlyArray<string>;
138138- /**
139139- * Process only request bodies matching the `include` filters.
140140- *
141141- * In case of conflicts, `exclude` takes precedence over `include`.
142142- *
143143- * @example ['Foo']
144144- */
145145- include?: ReadonlyArray<string>;
146146- };
147147- responses?: {
148148- /**
149149- * Prevent responses matching the `exclude` filters from being processed.
150150- *
151151- * In case of conflicts, `exclude` takes precedence over `include`.
152152- *
153153- * @example ['Foo']
154154- */
155155- exclude?: ReadonlyArray<string>;
156156- /**
157157- * Process only responses matching the `include` filters.
158158- *
159159- * In case of conflicts, `exclude` takes precedence over `include`.
160160- *
161161- * @example ['Foo']
162162- */
163163- include?: ReadonlyArray<string>;
164164- };
165165- schemas?: {
166166- /**
167167- * Prevent schemas matching the `exclude` filters from being processed.
168168- *
169169- * In case of conflicts, `exclude` takes precedence over `include`.
170170- *
171171- * @example ['Foo']
172172- */
173173- exclude?: ReadonlyArray<string>;
174174- /**
175175- * Process only schemas matching the `include` filters.
176176- *
177177- * In case of conflicts, `exclude` takes precedence over `include`.
178178- *
179179- * @example ['Foo']
180180- */
181181- include?: ReadonlyArray<string>;
182182- };
183183- tags?: {
184184- /**
185185- * Prevent tags matching the `exclude` filters from being processed.
186186- *
187187- * In case of conflicts, `exclude` takes precedence over `include`.
188188- *
189189- * @example ['foo']
190190- */
191191- exclude?: ReadonlyArray<string>;
192192- /**
193193- * Process only tags matching the `include` filters.
194194- *
195195- * In case of conflicts, `exclude` takes precedence over `include`.
196196- *
197197- * @example ['foo']
198198- */
199199- include?: ReadonlyArray<string>;
200200- };
201201- };
202202- /**
203203- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
204204- *
205205- * Organization created in Hey API platform.
206206- */
207207- organization?: string;
208208- /**
209209- * Pagination configuration
210210- */
211211- pagination?: {
212212- /**
213213- * Array of keywords to be considered as pagination field names.
214214- * These will be used to detect pagination fields in schemas and parameters.
215215- *
216216- * @default ['after', 'before', 'cursor', 'offset', 'page', 'start']
217217- */
218218- keywords?: ReadonlyArray<string>;
219219- };
220220- patch?: {
221221- /**
222222- * Apply custom transformations to schemas after parsing the OpenAPI specification.
223223- * This allows you to modify, fix, or enhance schema definitions before code generation.
224224- *
225225- * Each function receives the schema object and can modify it in place. Common use cases
226226- * include fixing incorrect data types, removing unwanted properties, adding missing
227227- * fields, or standardizing date/time formats.
228228- *
229229- * Works with both OpenAPI v2 (Swagger) and v3.x specifications, automatically
230230- * detecting the correct schema location (`definitions` for v2, `components.schemas` for v3).
231231- *
232232- * @example
233233- * ```js
234234- * patch: {
235235- * schemas: {
236236- * // Fix date-time format issues
237237- * 'UserResponseDto': (schema) => {
238238- * if (schema.properties?.updatedAt) {
239239- * delete schema.properties.updatedAt.format;
240240- * schema.properties.updatedAt.type = 'number';
241241- * }
242242- * },
243243- * // Add missing required fields
244244- * 'ProductModel': (schema) => {
245245- * schema.required = ['id', 'name'];
246246- * schema.properties.metadata = {
247247- * type: 'object',
248248- * additionalProperties: true
249249- * };
250250- * },
251251- * // Remove internal fields
252252- * 'PublicApiModel': (schema) => {
253253- * delete schema.properties.internalId;
254254- * delete schema.properties.secretKey;
255255- * }
256256- * }
257257- * }
258258- * ```
259259- */
260260- schemas?: Record<
261261- string,
262262- (
263263- schema:
264264- | OpenApiSchemaObject.V2_0_X
265265- | OpenApiSchemaObject.V3_0_X
266266- | OpenApiSchemaObject.V3_1_X,
267267- ) => void
268268- >;
269269- };
270270- /**
271271- * Path to the OpenAPI specification. This can be either local or remote path.
272272- * Both JSON and YAML file formats are supported. You can also pass the parsed
273273- * object directly if you're fetching the file yourself.
274274- */
275275- path?:
276276- | 'https://get.heyapi.dev/<organization>/<project>'
277277- | (string & {})
278278- | Record<string, unknown>;
279279- /**
280280- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
281281- *
282282- * Project created in Hey API platform.
283283- */
284284- project?: string;
285285- /**
286286- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
287287- *
288288- * If you're tagging your specifications with custom tags, you can use
289289- * them to filter the results. When you provide multiple tags, only
290290- * the first match will be returned.
291291- */
292292- tags?: ReadonlyArray<string>;
293293- /**
294294- * **This is an experimental feature.**
295295- *
296296- * Validate the input before generating output? This is an experimental,
297297- * lightweight feature and support will be added on an ad hoc basis.
298298- *
299299- * @default false
300300- */
301301- validate_EXPERIMENTAL?: boolean;
302302- /**
303303- * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
304304- *
305305- * Every OpenAPI document contains a required version field. You can
306306- * use this value to fetch the last uploaded specification matching
307307- * the value.
308308- */
309309- version?: string;
310310- /**
311311- * Regenerate the client when the input file changes? You can alternatively
312312- * pass a numeric value for the interval in ms.
313313- *
314314- * @default false
315315- */
316316- watch?: boolean | number | Watch;
317317-}
3181531916export interface UserConfig {
32017 /**
+326
packages/openapi-ts/src/types/input.d.ts
···11+import type {
22+ OpenApiParameterObject,
33+ OpenApiRequestBodyObject,
44+ OpenApiResponseObject,
55+ OpenApiSchemaObject,
66+} from '../openApi/types';
77+88+export interface Input {
99+ /**
1010+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
1111+ *
1212+ * Projects are private by default, you will need to be authenticated
1313+ * to download OpenAPI specifications. We recommend using project API
1414+ * keys in CI workflows and personal API keys for local development.
1515+ *
1616+ * API key isn't required for public projects. You can also omit this
1717+ * parameter and provide an environment variable `HEY_API_TOKEN`.
1818+ */
1919+ api_key?: string;
2020+ /**
2121+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
2222+ *
2323+ * You can fetch the last build from branch by providing the branch
2424+ * name.
2525+ */
2626+ branch?: string;
2727+ /**
2828+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
2929+ *
3030+ * You can fetch an exact specification by providing a commit sha.
3131+ * This will always return the same file.
3232+ */
3333+ commit_sha?: string;
3434+ /**
3535+ * You pass any valid Fetch API options to the request for fetching your
3636+ * specification. This is useful if your file is behind auth for example.
3737+ */
3838+ fetch?: RequestInit;
3939+ /**
4040+ * Filters can be used to select a subset of your input before it's processed
4141+ * by plugins.
4242+ */
4343+ filters?: Filters;
4444+ /**
4545+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
4646+ *
4747+ * Organization created in Hey API platform.
4848+ */
4949+ organization?: string;
5050+ /**
5151+ * Pagination configuration.
5252+ */
5353+ pagination?: {
5454+ /**
5555+ * Array of keywords to be considered as pagination field names.
5656+ * These will be used to detect pagination fields in schemas and parameters.
5757+ *
5858+ * @default ['after', 'before', 'cursor', 'offset', 'page', 'start']
5959+ */
6060+ keywords?: ReadonlyArray<string>;
6161+ };
6262+ /**
6363+ * Custom input transformations to execute before parsing. This allows you
6464+ * to modify, fix, or enhance input definitions before code generation.
6565+ */
6666+ patch?: Patch;
6767+ /**
6868+ * Path to the OpenAPI specification. This can be either local or remote path.
6969+ * Both JSON and YAML file formats are supported. You can also pass the parsed
7070+ * object directly if you're fetching the file yourself.
7171+ */
7272+ path?:
7373+ | 'https://get.heyapi.dev/<organization>/<project>'
7474+ | (string & {})
7575+ | Record<string, unknown>;
7676+ /**
7777+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
7878+ *
7979+ * Project created in Hey API platform.
8080+ */
8181+ project?: string;
8282+ /**
8383+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
8484+ *
8585+ * If you're tagging your specifications with custom tags, you can use
8686+ * them to filter the results. When you provide multiple tags, only
8787+ * the first match will be returned.
8888+ */
8989+ tags?: ReadonlyArray<string>;
9090+ /**
9191+ * **This is an experimental feature.**
9292+ *
9393+ * Validate the input before generating output? This is an experimental,
9494+ * lightweight feature and support will be added on an ad hoc basis.
9595+ *
9696+ * @default false
9797+ */
9898+ validate_EXPERIMENTAL?: boolean;
9999+ /**
100100+ * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
101101+ *
102102+ * Every OpenAPI document contains a required version field. You can
103103+ * use this value to fetch the last uploaded specification matching
104104+ * the value.
105105+ */
106106+ version?: string;
107107+ /**
108108+ * Regenerate the client when the input file changes? You can alternatively
109109+ * pass a numeric value for the interval in ms.
110110+ *
111111+ * @default false
112112+ */
113113+ watch?: boolean | number | Watch;
114114+}
115115+116116+export interface Filters {
117117+ /**
118118+ * Include deprecated resources in the output?
119119+ *
120120+ * @default true
121121+ */
122122+ deprecated?: boolean;
123123+ operations?: {
124124+ /**
125125+ * Prevent operations matching the `exclude` filters from being processed.
126126+ *
127127+ * In case of conflicts, `exclude` takes precedence over `include`.
128128+ *
129129+ * @example ['GET /api/v1/foo']
130130+ */
131131+ exclude?: ReadonlyArray<string>;
132132+ /**
133133+ * Process only operations matching the `include` filters.
134134+ *
135135+ * In case of conflicts, `exclude` takes precedence over `include`.
136136+ *
137137+ * @example ['GET /api/v1/foo']
138138+ */
139139+ include?: ReadonlyArray<string>;
140140+ };
141141+ /**
142142+ * Keep reusable components without any references in the output? By
143143+ * default, we exclude orphaned resources.
144144+ *
145145+ * @default false
146146+ */
147147+ orphans?: boolean;
148148+ parameters?: {
149149+ /**
150150+ * Prevent parameters matching the `exclude` filters from being processed.
151151+ *
152152+ * In case of conflicts, `exclude` takes precedence over `include`.
153153+ *
154154+ * @example ['QueryParam']
155155+ */
156156+ exclude?: ReadonlyArray<string>;
157157+ /**
158158+ * Process only parameters matching the `include` filters.
159159+ *
160160+ * In case of conflicts, `exclude` takes precedence over `include`.
161161+ *
162162+ * @example ['QueryParam']
163163+ */
164164+ include?: ReadonlyArray<string>;
165165+ };
166166+ /**
167167+ * Should we preserve the key order when overwriting your input? This
168168+ * option is disabled by default to improve performance.
169169+ *
170170+ * @default false
171171+ */
172172+ preserveOrder?: boolean;
173173+ requestBodies?: {
174174+ /**
175175+ * Prevent request bodies matching the `exclude` filters from being processed.
176176+ *
177177+ * In case of conflicts, `exclude` takes precedence over `include`.
178178+ *
179179+ * @example ['Foo']
180180+ */
181181+ exclude?: ReadonlyArray<string>;
182182+ /**
183183+ * Process only request bodies matching the `include` filters.
184184+ *
185185+ * In case of conflicts, `exclude` takes precedence over `include`.
186186+ *
187187+ * @example ['Foo']
188188+ */
189189+ include?: ReadonlyArray<string>;
190190+ };
191191+ responses?: {
192192+ /**
193193+ * Prevent responses matching the `exclude` filters from being processed.
194194+ *
195195+ * In case of conflicts, `exclude` takes precedence over `include`.
196196+ *
197197+ * @example ['Foo']
198198+ */
199199+ exclude?: ReadonlyArray<string>;
200200+ /**
201201+ * Process only responses matching the `include` filters.
202202+ *
203203+ * In case of conflicts, `exclude` takes precedence over `include`.
204204+ *
205205+ * @example ['Foo']
206206+ */
207207+ include?: ReadonlyArray<string>;
208208+ };
209209+ schemas?: {
210210+ /**
211211+ * Prevent schemas matching the `exclude` filters from being processed.
212212+ *
213213+ * In case of conflicts, `exclude` takes precedence over `include`.
214214+ *
215215+ * @example ['Foo']
216216+ */
217217+ exclude?: ReadonlyArray<string>;
218218+ /**
219219+ * Process only schemas matching the `include` filters.
220220+ *
221221+ * In case of conflicts, `exclude` takes precedence over `include`.
222222+ *
223223+ * @example ['Foo']
224224+ */
225225+ include?: ReadonlyArray<string>;
226226+ };
227227+ tags?: {
228228+ /**
229229+ * Prevent tags matching the `exclude` filters from being processed.
230230+ *
231231+ * In case of conflicts, `exclude` takes precedence over `include`.
232232+ *
233233+ * @example ['foo']
234234+ */
235235+ exclude?: ReadonlyArray<string>;
236236+ /**
237237+ * Process only tags matching the `include` filters.
238238+ *
239239+ * In case of conflicts, `exclude` takes precedence over `include`.
240240+ *
241241+ * @example ['foo']
242242+ */
243243+ include?: ReadonlyArray<string>;
244244+ };
245245+}
246246+247247+export interface Patch {
248248+ parameters?: Record<
249249+ string,
250250+ (
251251+ parameter: OpenApiParameterObject.V3_0_X | OpenApiParameterObject.V3_1_X,
252252+ ) => void
253253+ >;
254254+ requestBodies?: Record<
255255+ string,
256256+ (
257257+ requestBody:
258258+ | OpenApiRequestBodyObject.V3_0_X
259259+ | OpenApiRequestBodyObject.V3_1_X,
260260+ ) => void
261261+ >;
262262+ responses?: Record<
263263+ string,
264264+ (
265265+ response: OpenApiResponseObject.V3_0_X | OpenApiResponseObject.V3_1_X,
266266+ ) => void
267267+ >;
268268+ /**
269269+ * Each function receives the schema object to be modified in place. Common
270270+ * use cases include fixing incorrect data types, removing unwanted
271271+ * properties, adding missing fields, or standardizing date/time formats.
272272+ *
273273+ * @example
274274+ * ```js
275275+ * schemas: {
276276+ * Foo: (schema) => {
277277+ * // convert date-time format to timestamp
278278+ * delete schema.properties.updatedAt.format;
279279+ * schema.properties.updatedAt.type = 'number';
280280+ * },
281281+ * Bar: (schema) => {
282282+ * // add missing property
283283+ * schema.properties.metadata = {
284284+ * additionalProperties: true,
285285+ * type: 'object',
286286+ * };
287287+ * schema.required = ['metadata'];
288288+ * },
289289+ * Baz: (schema) => {
290290+ * // remove property
291291+ * delete schema.properties.internalField;
292292+ * }
293293+ * }
294294+ * ```
295295+ */
296296+ schemas?: Record<
297297+ string,
298298+ (
299299+ schema:
300300+ | OpenApiSchemaObject.V2_0_X
301301+ | OpenApiSchemaObject.V3_0_X
302302+ | OpenApiSchemaObject.V3_1_X,
303303+ ) => void
304304+ >;
305305+}
306306+307307+export interface Watch {
308308+ /**
309309+ * Regenerate the client when the input file changes?
310310+ *
311311+ * @default false
312312+ */
313313+ enabled?: boolean;
314314+ /**
315315+ * How often should we attempt to detect the input file change? (in ms)
316316+ *
317317+ * @default 1000
318318+ */
319319+ interval?: number;
320320+ /**
321321+ * How long will we wait before the request times out?
322322+ *
323323+ * @default 60_000
324324+ */
325325+ timeout?: number;
326326+}