···11import type { MaybePromise } from '~/types/utils';
2233+import type { FeatureToggle } from '../../shared';
44+35// TODO: json-schema-ref-parser needs to expose source extension so
46// we can default to it
57type SourceExtension = 'json';
···1618 */
1719 callback?: (source: string) => MaybePromise<void>;
1820 /**
1919- * Whether the source should be generated at all.
2020- *
2121- * When `false`, no source file is created or processed.
2121+ * Whether this feature is enabled.
2222 *
2323 * @default true
2424 */
···6060 serialize?: (input: Record<string, any>) => MaybePromise<string>;
6161}
62626363-export interface SourceConfig {
6363+export type SourceConfig = FeatureToggle & {
6464 /**
6565 * Callback invoked with the serialized source string.
6666 *
6767 * Runs after the `serialize` function.
6868 */
6969 callback?: (source: string) => MaybePromise<void>;
7070- /**
7171- * Whether the source should be generated at all.
7272- */
7373- enabled: boolean;
7470 /**
7571 * File extension for the source file.
7672 */
···8783 * Function to serialize the input object into a string.
8884 */
8985 serialize: (input: Record<string, any>) => MaybePromise<string>;
9090-}
8686+};
+4-11
packages/openapi-ts/src/config/output/types.d.ts
···77import type { MaybeArray, MaybeFunc } from '~/types/utils';
88import type { Casing, NameTransformer } from '~/utils/naming';
991010+import type { NamingOptions } from '../shared';
1011import type { SourceConfig, UserSourceConfig } from './source/types';
11121213export type Formatters = 'biome' | 'prettier';
···4748 | NameTransformer
4849 | {
4950 /**
5050- * The casing convention to use for generated file names.
5151+ * Casing convention for generated names.
5152 *
5253 * @default 'preserve'
5354 */
5455 case?: Casing;
5556 /**
5656- * Custom naming pattern for generated file names.
5757+ * Naming pattern for generated names.
5758 *
5859 * @default '{{name}}'
5960 */
···166167 * @param name The original file name.
167168 * @returns The transformed file name.
168169 */
169169- fileName: {
170170- /**
171171- * The casing convention to use for generated file names.
172172- */
173173- case: Casing;
174174- /**
175175- * Custom naming pattern for generated file names.
176176- */
177177- name: NameTransformer;
170170+ fileName: NamingOptions & {
178171 /**
179172 * Suffix to append to file names (before the extension). For example,
180173 * with a suffix of `.gen`, `example.ts` becomes `example.gen.ts`.
+26
packages/openapi-ts/src/config/shared.d.ts
···11+import type { Casing, NameTransformer } from '~/utils/naming';
22+33+export type FeatureToggle = {
44+ /**
55+ * Whether this feature is enabled.
66+ */
77+ enabled: boolean;
88+};
99+1010+export type IndexExportOption = {
1111+ /**
1212+ * Whether exports should be re-exported in the index file.
1313+ */
1414+ exportFromIndex: boolean;
1515+};
1616+1717+export type NamingOptions = {
1818+ /**
1919+ * Casing convention for generated names.
2020+ */
2121+ case: Casing;
2222+ /**
2323+ * Naming pattern for generated names.
2424+ */
2525+ name: NameTransformer;
2626+};
···11+import type { IndexExportOption } from '~/config/shared';
12import type { OperationsStrategy } from '~/openApi/shared/locations';
23import type { DefinePlugin, Plugin } from '~/plugins';
34···1314export type UserConfig = Plugin.Name<'@angular/common'> &
1415 Plugin.Hooks & {
1516 /**
1616- * Should the exports from the generated files be re-exported in the index
1717- * barrel file?
1717+ * Whether exports should be re-exported in the index file.
1818 *
1919 * @default false
2020 */
···3434 };
35353636export type Config = Plugin.Name<'@angular/common'> &
3737- Plugin.Hooks & {
3838- /**
3939- * Should the exports from the generated files be re-exported in the index
4040- * barrel file?
4141- *
4242- * @default false
4343- */
4444- exportFromIndex: boolean;
3737+ Plugin.Hooks &
3838+ IndexExportOption & {
4539 /**
4640 * Options for generating HTTP Request instances.
4741 */
···4242 */
4343 bundle?: boolean;
4444 /**
4545- * Should the exports from the generated files be re-exported in the index
4646- * barrel file?
4545+ * Whether exports should be re-exported in the index file.
4746 *
4847 * @default false
4948 */
···66export type UserConfig = Plugin.Name<'@hey-api/schemas'> &
77 Plugin.Hooks & {
88 /**
99- * Should the exports from the generated files be re-exported in the index
1010- * barrel file?
99+ * Whether exports should be re-exported in the index file.
1110 *
1211 * @default false
1312 */
···11+import type { IndexExportOption } from '~/config/shared';
12import type { OperationsStrategy } from '~/openApi/shared/locations';
23import type { DefinePlugin, Plugin } from '~/plugins';
34import type { PluginClientNames, PluginValidatorNames } from '~/plugins/types';
···3940 */
4041 examples?: boolean | UserExamplesConfig;
4142 /**
4242- * Should the exports from the generated files be re-exported in the index
4343- * barrel file?
4343+ * Whether exports should be re-exported in the index file.
4444 *
4545 * @default true
4646 */
···199199 };
200200201201export type Config = Plugin.Name<'@hey-api/sdk'> &
202202- Plugin.Hooks & {
202202+ Plugin.Hooks &
203203+ IndexExportOption & {
203204 /**
204205 * Should the generated functions contain auth mechanisms? You may want to
205206 * disable this option if you're handling auth yourself or defining it
···224225 * Configuration for generating SDK code examples.
225226 */
226227 examples: ExamplesConfig;
227227- /**
228228- * Should the exports from the generated files be re-exported in the index
229229- * barrel file?
230230- *
231231- * @default true
232232- */
233233- exportFromIndex: boolean;
234228 /**
235229 * Define the structure of generated SDK operations.
236230 */
···11import type ts from 'typescript';
2233+import type { IndexExportOption } from '~/config/shared';
34import type { IR } from '~/ir/types';
45import type { DefinePlugin, Plugin } from '~/plugins';
56···3031 */
3132 dates?: boolean;
3233 /**
3333- * Should the exports from the generated files be re-exported in the index
3434- * barrel file?
3434+ * Whether exports should be re-exported in the index file.
3535 *
3636 * @default false
3737 */
···4747 };
48484949export type Config = Plugin.Name<'@hey-api/transformers'> &
5050- Plugin.Hooks & {
5050+ Plugin.Hooks &
5151+ IndexExportOption & {
5152 /**
5253 * Convert long integers into BigInt values?
5354 *
···6061 * @default true
6162 */
6263 dates: boolean;
6363- /**
6464- * Should the exports from the generated files be re-exported in the index
6565- * barrel file?
6666- *
6767- * @default false
6868- */
6969- exportFromIndex: boolean;
7064 /**
7165 * Custom transforms to apply to the generated code.
7266 */
···33export type UserConfig = Plugin.Name<'fastify'> &
44 Plugin.Hooks & {
55 /**
66- * Should the exports from the generated files be re-exported in the index
77- * barrel file?
66+ * Whether exports should be re-exported in the index file.
87 *
98 * @default false
109 */
+133-259
packages/openapi-ts/src/plugins/swr/types.d.ts
···11+import type {
22+ FeatureToggle,
33+ IndexExportOption,
44+ NamingOptions,
55+} from '~/config/shared';
16import type { IR } from '~/ir/types';
27import type { DefinePlugin, Plugin } from '~/plugins';
38import type { Casing, NameTransformer } from '~/utils/naming';
···510export type UserConfig = Plugin.Name<'swr'> &
611 Plugin.Hooks & {
712 /**
88- * The casing convention to use for generated names.
1313+ * Casing convention for generated names.
914 *
1015 * @default 'camelCase'
1116 */
···2227 */
2328 comments?: boolean;
2429 /**
2525- * Should the exports from the generated files be re-exported in the index
2626- * barrel file?
3030+ * Whether exports should be re-exported in the index file.
2731 *
2832 * @default false
2933 */
···4549 | NameTransformer
4650 | {
4751 /**
4848- * The casing convention to use for generated names.
5252+ * Casing convention for generated names.
4953 *
5054 * @default 'camelCase'
5155 */
5256 case?: Casing;
5357 /**
5454- * Whether to generate infinite query key helpers.
5858+ * Whether this feature is enabled.
5559 *
5660 * @default true
5761 */
5862 enabled?: boolean;
5963 /**
6060- * Custom naming pattern for generated infinite query key names. The name variable is
6161- * obtained from the SDK function name.
6464+ * Naming pattern for generated names.
6265 *
6366 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions infiniteQueryOptions}
6467 *
···9093 | NameTransformer
9194 | {
9295 /**
9393- * The casing convention to use for generated names.
9696+ * Casing convention for generated names.
9497 *
9598 * @default 'camelCase'
9699 */
97100 case?: Casing;
98101 /**
9999- * Whether to generate infinite query options helpers.
102102+ * Whether this feature is enabled.
100103 *
101104 * @default true
102105 */
···125128 */
126129 meta?: (operation: IR.OperationObject) => Record<string, unknown>;
127130 /**
128128- * Custom naming pattern for generated infinite query options names. The name variable is
129129- * obtained from the SDK function name.
131131+ * Naming pattern for generated names.
130132 *
131133 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions infiniteQueryOptions}
132134 *
···151153 | NameTransformer
152154 | {
153155 /**
154154- * The casing convention to use for generated names.
156156+ * Casing convention for generated names.
155157 *
156158 * @default 'camelCase'
157159 */
158160 case?: Casing;
159161 /**
160160- * Whether to generate mutation options helpers.
162162+ * Whether this feature is enabled.
161163 *
162164 * @default true
163165 */
···186188 */
187189 meta?: (operation: IR.OperationObject) => Record<string, unknown>;
188190 /**
189189- * Custom naming pattern for generated mutation options names. The name variable is
190190- * obtained from the SDK function name.
191191+ * Naming pattern for generated names.
191192 *
192193 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useMutation useMutation}
193194 *
···212213 | NameTransformer
213214 | {
214215 /**
215215- * The casing convention to use for generated names.
216216+ * Casing convention for generated names.
216217 *
217218 * @default 'camelCase'
218219 */
219220 case?: Casing;
220221 /**
221221- * Whether to generate query keys.
222222+ * Whether this feature is enabled.
222223 *
223224 * @default true
224225 */
225226 enabled?: boolean;
226227 /**
227227- * Custom naming pattern for generated query key names. The name variable is
228228- * obtained from the SDK function name.
228228+ * Naming pattern for generated names.
229229 *
230230 * See {@link https://tanstack.com/query/v5/docs/framework/react/guides/query-keys Query Keys}
231231 *
···257257 | NameTransformer
258258 | {
259259 /**
260260- * The casing convention to use for generated names.
260260+ * Casing convention for generated names.
261261 *
262262 * @default 'camelCase'
263263 */
264264 case?: Casing;
265265 /**
266266- * Whether to generate query options helpers.
266266+ * Whether this feature is enabled.
267267 *
268268 * @default true
269269 */
···298298 */
299299 meta?: (operation: IR.OperationObject) => Record<string, unknown>;
300300 /**
301301- * Custom naming pattern for generated query options names. The name variable is
302302- * obtained from the SDK function name.
301301+ * Naming pattern for generated names.
303302 *
304303 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/queryOptions queryOptions}
305304 *
···324323 | NameTransformer
325324 | {
326325 /**
327327- * The casing convention to use for generated names.
326326+ * Casing convention for generated names.
328327 *
329328 * @default 'camelCase'
330329 */
331330 case?: Casing;
332331 /**
333333- * Whether to generate `useSwr()` function helpers.
332332+ * Whether this feature is enabled.
334333 *
335334 * @default true
336335 */
337336 enabled?: boolean;
338337 /**
339339- * Custom naming pattern for generated `useSwr()` function names. The name variable is
340340- * obtained from the SDK function name.
338338+ * Naming pattern for generated names.
341339 *
342340 * See {@link https://swr.vercel.app/docs/api API}
343341 *
···348346 };
349347350348export type Config = Plugin.Name<'swr'> &
351351- Plugin.Hooks & {
349349+ Plugin.Hooks &
350350+ IndexExportOption & {
352351 /**
353353- * The casing convention to use for generated names.
354354- *
355355- * @default 'camelCase'
352352+ * Casing convention for generated names.
356353 */
357354 case: Casing;
358355 /**
···362359 */
363360 comments: boolean;
364361 /**
365365- * Should the exports from the generated files be re-exported in the index barrel file?
366366- *
367367- * @default false
368368- */
369369- exportFromIndex: boolean;
370370- /**
371362 * Resolved configuration for generated infinite query key helpers.
372363 *
373364 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions infiniteQueryOptions}
374365 */
375375- infiniteQueryKeys: {
376376- /**
377377- * The casing convention to use for generated names.
378378- *
379379- * @default 'camelCase'
380380- */
381381- case: Casing;
382382- /**
383383- * Whether to generate infinite query key helpers.
384384- *
385385- * @default true
386386- */
387387- enabled: boolean;
388388- /**
389389- * Custom naming pattern for generated infinite query key names. The name variable is obtained from the SDK function name.
390390- *
391391- * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions infiniteQueryOptions}
392392- *
393393- * @default '{{name}}InfiniteQueryKey'
394394- */
395395- name: NameTransformer;
396396- /**
397397- * Whether to include operation tags in infinite query keys.
398398- * This will make query keys larger but provides better cache invalidation capabilities.
399399- *
400400- * @default false
401401- */
402402- tags: boolean;
403403- };
366366+ infiniteQueryKeys: NamingOptions &
367367+ FeatureToggle & {
368368+ /**
369369+ * Whether to include operation tags in infinite query keys.
370370+ * This will make query keys larger but provides better cache invalidation capabilities.
371371+ *
372372+ * @default false
373373+ */
374374+ tags: boolean;
375375+ };
404376 /**
405377 * Resolved configuration for generated infinite query options helpers.
406378 *
407379 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions infiniteQueryOptions}
408380 */
409409- infiniteQueryOptions: {
410410- /**
411411- * The casing convention to use for generated names.
412412- *
413413- * @default 'camelCase'
414414- */
415415- case: Casing;
416416- /**
417417- * Whether to generate infinite query options helpers.
418418- *
419419- * @default true
420420- */
421421- enabled: boolean;
422422- /**
423423- * Custom function to generate metadata for the operation.
424424- * Can return any valid meta object that will be included in the generated infinite query options.
425425- *
426426- * @param operation - The operation object containing all available metadata
427427- * @returns A meta object with any properties you want to include
428428- *
429429- * @example
430430- * ```ts
431431- * meta: (operation) => ({
432432- * customField: operation.id,
433433- * isDeprecated: operation.deprecated,
434434- * tags: operation.tags,
435435- * customObject: {
436436- * method: operation.method,
437437- * path: operation.path
438438- * }
439439- * })
440440- * ```
441441- *
442442- * @default undefined
443443- */
444444- meta: (operation: IR.OperationObject) => Record<string, unknown>;
445445- /**
446446- * Custom naming pattern for generated infinite query options names. The name variable is obtained from the SDK function name.
447447- *
448448- * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions infiniteQueryOptions}
449449- *
450450- * @default '{{name}}InfiniteOptions'
451451- */
452452- name: NameTransformer;
453453- };
381381+ infiniteQueryOptions: NamingOptions &
382382+ FeatureToggle & {
383383+ /**
384384+ * Custom function to generate metadata for the operation.
385385+ * Can return any valid meta object that will be included in the generated infinite query options.
386386+ *
387387+ * @param operation - The operation object containing all available metadata
388388+ * @returns A meta object with any properties you want to include
389389+ *
390390+ * @example
391391+ * ```ts
392392+ * meta: (operation) => ({
393393+ * customField: operation.id,
394394+ * isDeprecated: operation.deprecated,
395395+ * tags: operation.tags,
396396+ * customObject: {
397397+ * method: operation.method,
398398+ * path: operation.path
399399+ * }
400400+ * })
401401+ * ```
402402+ *
403403+ * @default undefined
404404+ */
405405+ meta: (operation: IR.OperationObject) => Record<string, unknown>;
406406+ };
454407 /**
455408 * Resolved configuration for generated mutation options helpers.
456409 *
457410 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useMutation useMutation}
458411 */
459459- mutationOptions: {
460460- /**
461461- * The casing convention to use for generated names.
462462- *
463463- * @default 'camelCase'
464464- */
465465- case: Casing;
466466- /**
467467- * Whether to generate mutation options helpers.
468468- *
469469- * @default true
470470- */
471471- enabled: boolean;
472472- /**
473473- * Custom function to generate metadata for the operation.
474474- * Can return any valid meta object that will be included in the generated mutation options.
475475- *
476476- * @param operation - The operation object containing all available metadata
477477- * @returns A meta object with any properties you want to include
478478- *
479479- * @example
480480- * ```ts
481481- * meta: (operation) => ({
482482- * customField: operation.id,
483483- * isDeprecated: operation.deprecated,
484484- * tags: operation.tags,
485485- * customObject: {
486486- * method: operation.method,
487487- * path: operation.path
488488- * }
489489- * })
490490- * ```
491491- *
492492- * @default undefined
493493- */
494494- meta: (operation: IR.OperationObject) => Record<string, unknown>;
495495- /**
496496- * Custom naming pattern for generated mutation options names. The name variable is obtained from the SDK function name.
497497- *
498498- * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useMutation useMutation}
499499- *
500500- * @default '{{name}}Mutation'
501501- */
502502- name: NameTransformer;
503503- };
412412+ mutationOptions: NamingOptions &
413413+ FeatureToggle & {
414414+ /**
415415+ * Custom function to generate metadata for the operation.
416416+ * Can return any valid meta object that will be included in the generated mutation options.
417417+ *
418418+ * @param operation - The operation object containing all available metadata
419419+ * @returns A meta object with any properties you want to include
420420+ *
421421+ * @example
422422+ * ```ts
423423+ * meta: (operation) => ({
424424+ * customField: operation.id,
425425+ * isDeprecated: operation.deprecated,
426426+ * tags: operation.tags,
427427+ * customObject: {
428428+ * method: operation.method,
429429+ * path: operation.path
430430+ * }
431431+ * })
432432+ * ```
433433+ *
434434+ * @default undefined
435435+ */
436436+ meta: (operation: IR.OperationObject) => Record<string, unknown>;
437437+ };
504438 /**
505439 * Resolved configuration for generated query keys.
506440 *
507441 * See {@link https://tanstack.com/query/v5/docs/framework/react/guides/query-keys Query Keys}
508442 */
509509- queryKeys: {
510510- /**
511511- * The casing convention to use for generated names.
512512- *
513513- * @default 'camelCase'
514514- */
515515- case: Casing;
516516- /**
517517- * Whether to generate query keys.
518518- *
519519- * @default true
520520- */
521521- enabled: boolean;
522522- /**
523523- * Custom naming pattern for generated query key names. The name variable is obtained from the SDK function name.
524524- *
525525- * See {@link https://tanstack.com/query/v5/docs/framework/react/guides/query-keys Query Keys}
526526- *
527527- * @default '{{name}}QueryKey'
528528- */
529529- name: NameTransformer;
530530- /**
531531- * Whether to include operation tags in query keys.
532532- * This will make query keys larger but provides better cache invalidation capabilities.
533533- *
534534- * @default false
535535- */
536536- tags: boolean;
537537- };
443443+ queryKeys: NamingOptions &
444444+ FeatureToggle & {
445445+ /**
446446+ * Whether to include operation tags in query keys.
447447+ * This will make query keys larger but provides better cache invalidation capabilities.
448448+ *
449449+ * @default false
450450+ */
451451+ tags: boolean;
452452+ };
538453 /**
539454 * Resolved configuration for generated query options helpers.
540455 *
541456 * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/queryOptions queryOptions}
542457 */
543543- queryOptions: {
544544- /**
545545- * The casing convention to use for generated names.
546546- *
547547- * @default 'camelCase'
548548- */
549549- case: Casing;
550550- /**
551551- * Whether to generate query options helpers.
552552- *
553553- * @default true
554554- */
555555- enabled: boolean;
556556- /**
557557- * Whether to export generated symbols.
558558- *
559559- * @default true
560560- */
561561- exported: boolean;
562562- /**
563563- * Custom function to generate metadata for the operation.
564564- * Can return any valid meta object that will be included in the generated query options.
565565- *
566566- * @param operation - The operation object containing all available metadata
567567- * @returns A meta object with any properties you want to include
568568- *
569569- * @example
570570- * ```ts
571571- * meta: (operation) => ({
572572- * customField: operation.id,
573573- * isDeprecated: operation.deprecated,
574574- * tags: operation.tags,
575575- * customObject: {
576576- * method: operation.method,
577577- * path: operation.path
578578- * }
579579- * })
580580- * ```
581581- *
582582- * @default undefined
583583- */
584584- meta: (operation: IR.OperationObject) => Record<string, unknown>;
585585- /**
586586- * Custom naming pattern for generated query options names. The name variable is obtained from the SDK function name.
587587- *
588588- * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/queryOptions queryOptions}
589589- *
590590- * @default '{{name}}Options'
591591- */
592592- name: NameTransformer;
593593- };
458458+ queryOptions: NamingOptions &
459459+ FeatureToggle & {
460460+ /**
461461+ * Whether to export generated symbols.
462462+ *
463463+ * @default true
464464+ */
465465+ exported: boolean;
466466+ /**
467467+ * Custom function to generate metadata for the operation.
468468+ * Can return any valid meta object that will be included in the generated query options.
469469+ *
470470+ * @param operation - The operation object containing all available metadata
471471+ * @returns A meta object with any properties you want to include
472472+ *
473473+ * @example
474474+ * ```ts
475475+ * meta: (operation) => ({
476476+ * customField: operation.id,
477477+ * isDeprecated: operation.deprecated,
478478+ * tags: operation.tags,
479479+ * customObject: {
480480+ * method: operation.method,
481481+ * path: operation.path
482482+ * }
483483+ * })
484484+ * ```
485485+ *
486486+ * @default undefined
487487+ */
488488+ meta: (operation: IR.OperationObject) => Record<string, unknown>;
489489+ };
594490 /**
595491 * Configuration for generated `useSwr()` function helpers.
596492 *
597493 * See {@link https://swr.vercel.app/docs/api API}
598494 */
599599- useSwr: {
600600- /**
601601- * The casing convention to use for generated names.
602602- *
603603- * @default 'camelCase'
604604- */
605605- case: Casing;
606606- /**
607607- * Whether to generate `useSwr()` function helpers.
608608- *
609609- * @default true
610610- */
611611- enabled: boolean;
612612- /**
613613- * Custom naming pattern for generated `useSwr()` function names. The name variable is
614614- * obtained from the SDK function name.
615615- *
616616- * See {@link https://swr.vercel.app/docs/api API}
617617- *
618618- * @default 'use{{name}}'
619619- */
620620- name: NameTransformer;
621621- };
495495+ useSwr: NamingOptions & FeatureToggle;
622496 };
623497624498export type SwrPlugin = DefinePlugin<UserConfig, Config>;
+7-5
packages/openapi-ts/src/plugins/types.d.ts
···1212 | '@hey-api/client-nuxt'
1313 | '@hey-api/client-ofetch';
14141515+export type PluginMockNames = '@faker-js/faker';
1616+1517export type PluginValidatorNames = 'arktype' | 'valibot' | 'zod';
16181719export type PluginNames =
1820 | PluginClientNames
2121+ | PluginMockNames
2222+ | PluginValidatorNames
1923 | '@angular/common'
2024 | '@hey-api/schemas'
2125 | '@hey-api/sdk'
···2832 | '@tanstack/svelte-query'
2933 | '@tanstack/vue-query'
3034 | 'fastify'
3131- | 'swr'
3232- | PluginValidatorNames;
3535+ | 'swr';
33363437export type AnyPluginName = PluginNames | (string & {});
35383636-type PluginTag = 'client' | 'sdk' | 'transformer' | 'validator';
3939+type PluginTag = 'client' | 'mocker' | 'sdk' | 'transformer' | 'validator';
37403841export type PluginContext = {
3942 package: Package;
···51545255type BaseConfig = {
5356 /**
5454- * Should the exports from the plugin's file be re-exported in the index
5555- * barrel file?
5757+ * Whether exports should be re-exported in the index file.
5658 */
5759 exportFromIndex?: boolean;
5860 name: AnyPluginName;
···11-import type { Refs, Symbol } from '@hey-api/codegen-core';
22-33-import type { IR } from '~/ir/types';
44-import type { DefinePlugin, Plugin, SchemaWithType } from '~/plugins';
51import type {
66- MaybeBigInt,
77- ShouldCoerceToBigInt,
88-} from '~/plugins/shared/utils/coerce';
99-import type { GetIntegerLimit } from '~/plugins/shared/utils/formats';
1010-import type { $, DollarTsDsl } from '~/ts-dsl';
22+ FeatureToggle,
33+ IndexExportOption,
44+ NamingOptions,
55+} from '~/config/shared';
66+import type { DefinePlugin, Plugin } from '~/plugins';
117import type { Casing, NameTransformer } from '~/utils/naming';
128139import type { IApi } from './api';
1414-import type { Pipe, PipeResult, PipesUtils } from './shared/pipes';
1515-import type { Ast, PluginState } from './shared/types';
1010+import type { Resolvers } from './resolvers';
16111712export type UserConfig = Plugin.Name<'valibot'> &
1813 Plugin.Hooks &
1914 Resolvers & {
2015 /**
2121- * The casing convention to use for generated names.
1616+ * Casing convention for generated names.
2217 *
2318 * @default 'camelCase'
2419 */
···4540 | NameTransformer
4641 | {
4742 /**
4848- * The casing convention to use for generated names.
4343+ * Casing convention for generated names.
4944 *
5045 * @default 'camelCase'
5146 */
5247 case?: Casing;
5348 /**
5454- * Whether to generate Valibot schemas for reusable definitions.
4949+ * Whether this feature is enabled.
5550 *
5651 * @default true
5752 */
5853 enabled?: boolean;
5954 /**
6060- * Custom naming pattern for generated schema names. The name variable
6161- * is obtained from the schema name.
5555+ * Naming pattern for generated names.
6256 *
6357 * @default 'v{{name}}'
6458 */
6559 name?: NameTransformer;
6660 };
6761 /**
6868- * Should the exports from the generated files be re-exported in the index
6969- * barrel file?
6262+ * Whether exports should be re-exported in the index file.
7063 *
7164 * @default false
7265 */
···9588 | NameTransformer
9689 | {
9790 /**
9898- * The casing convention to use for generated names.
9191+ * Casing convention for generated names.
9992 *
10093 * @default 'camelCase'
10194 */
10295 case?: Casing;
10396 /**
104104- * Whether to generate Valibot schemas for request definitions.
9797+ * Whether this feature is enabled.
10598 *
10699 * @default true
107100 */
108101 enabled?: boolean;
109102 /**
110110- * Custom naming pattern for generated schema names. The name variable
111111- * is obtained from the operation name.
103103+ * Naming pattern for generated names.
112104 *
113105 * @default 'v{{name}}Data'
114106 */
···130122 | NameTransformer
131123 | {
132124 /**
133133- * The casing convention to use for generated names.
125125+ * Casing convention for generated names.
134126 *
135127 * @default 'camelCase'
136128 */
137129 case?: Casing;
138130 /**
139139- * Whether to generate Valibot schemas for response definitions.
131131+ * Whether this feature is enabled.
140132 *
141133 * @default true
142134 */
143135 enabled?: boolean;
144136 /**
145145- * Custom naming pattern for generated schema names. The name variable
146146- * is obtained from the operation name.
137137+ * Naming pattern for generated names.
147138 *
148139 * @default 'v{{name}}Response'
149140 */
···166157 | NameTransformer
167158 | {
168159 /**
169169- * The casing convention to use for generated names.
160160+ * Casing convention for generated names.
170161 *
171162 * @default 'camelCase'
172163 */
173164 case?: Casing;
174165 /**
175175- * Whether to generate Valibot schemas for webhook definitions.
166166+ * Whether this feature is enabled.
176167 *
177168 * @default true
178169 */
179170 enabled?: boolean;
180171 /**
181181- * Custom naming pattern for generated schema names. The name variable
182182- * is obtained from the webhook key.
172172+ * Naming pattern for generated names.
183173 *
184174 * @default 'v{{name}}WebhookRequest'
185175 */
···189179190180export type Config = Plugin.Name<'valibot'> &
191181 Plugin.Hooks &
192192- Resolvers & {
182182+ Resolvers &
183183+ IndexExportOption & {
193184 /**
194194- * The casing convention to use for generated names.
195195- *
196196- * @default 'camelCase'
185185+ * Casing convention for generated names.
197186 */
198187 case: Casing;
199188 /**
···208197 * Controls generation of shared Valibot schemas that can be referenced
209198 * across requests and responses.
210199 */
211211- definitions: {
212212- /**
213213- * The casing convention to use for generated names.
214214- *
215215- * @default 'camelCase'
216216- */
217217- case: Casing;
218218- /**
219219- * Whether to generate Valibot schemas for reusable definitions.
220220- *
221221- * @default true
222222- */
223223- enabled: boolean;
224224- /**
225225- * Custom naming pattern for generated schema names. The name variable is
226226- * obtained from the schema name.
227227- *
228228- * @default 'v{{name}}'
229229- */
230230- name: NameTransformer;
231231- };
232232- /**
233233- * Should the exports from the generated files be re-exported in the index
234234- * barrel file?
235235- *
236236- * @default false
237237- */
238238- exportFromIndex: boolean;
200200+ definitions: NamingOptions & FeatureToggle;
239201 /**
240202 * Enable Valibot metadata support? It's often useful to associate a schema
241203 * with some additional metadata for documentation, code generation, AI
···250212 * Controls generation of Valibot schemas for request bodies, query
251213 * parameters, path parameters, and headers.
252214 */
253253- requests: {
254254- /**
255255- * The casing convention to use for generated names.
256256- *
257257- * @default 'camelCase'
258258- */
259259- case: Casing;
260260- /**
261261- * Whether to generate Valibot schemas for request definitions.
262262- *
263263- * @default true
264264- */
265265- enabled: boolean;
266266- /**
267267- * Custom naming pattern for generated schema names. The name variable is
268268- * obtained from the operation name.
269269- *
270270- * @default 'v{{name}}Data'
271271- */
272272- name: NameTransformer;
273273- };
215215+ requests: NamingOptions & FeatureToggle;
274216 /**
275217 * Configuration for response-specific Valibot schemas.
276218 *
277219 * Controls generation of Valibot schemas for response bodies, error
278220 * responses, and status codes.
279221 */
280280- responses: {
281281- /**
282282- * The casing convention to use for generated names.
283283- *
284284- * @default 'camelCase'
285285- */
286286- case: Casing;
287287- /**
288288- * Whether to generate Valibot schemas for response definitions.
289289- *
290290- * @default true
291291- */
292292- enabled: boolean;
293293- /**
294294- * Custom naming pattern for generated schema names. The name variable is
295295- * obtained from the operation name.
296296- *
297297- * @default 'v{{name}}Response'
298298- */
299299- name: NameTransformer;
300300- };
222222+ responses: NamingOptions & FeatureToggle;
301223 /**
302224 * Configuration for webhook-specific Valibot schemas.
303225 *
304226 * Controls generation of Valibot schemas for webhook payloads.
305227 */
306306- webhooks: {
307307- /**
308308- * The casing convention to use for generated names.
309309- *
310310- * @default 'camelCase'
311311- */
312312- case: Casing;
313313- /**
314314- * Whether to generate Valibot schemas for webhook definitions.
315315- *
316316- * @default true
317317- */
318318- enabled: boolean;
319319- /**
320320- * Custom naming pattern for generated schema names. The name variable
321321- * is obtained from the webhook key.
322322- *
323323- * @default 'v{{name}}WebhookRequest'
324324- */
325325- name: NameTransformer;
326326- };
327327- };
328328-329329-interface BaseResolverContext extends DollarTsDsl {
330330- /**
331331- * Functions for working with pipes.
332332- */
333333- pipes: PipesUtils & {
334334- /**
335335- * The current pipe.
336336- *
337337- * In Valibot, this represents a list of call expressions ("pipes")
338338- * being assembled to form a schema definition.
339339- *
340340- * Each pipe can be extended, modified, or replaced to customize
341341- * the resulting schema.
342342- */
343343- current: Pipes;
344344- };
345345- /**
346346- * The plugin instance.
347347- */
348348- plugin: ValibotPlugin['Instance'];
349349- /**
350350- * Provides access to commonly used symbols within the plugin.
351351- */
352352- symbols: {
353353- v: Symbol;
354354- };
355355-}
356356-357357-export interface NumberResolverContext extends BaseResolverContext {
358358- /**
359359- * Nodes used to build different parts of the number schema.
360360- */
361361- nodes: {
362362- base: (ctx: NumberResolverContext) => PipeResult;
363363- const: (ctx: NumberResolverContext) => PipeResult | undefined;
364364- max: (ctx: NumberResolverContext) => PipeResult | undefined;
365365- min: (ctx: NumberResolverContext) => PipeResult | undefined;
366366- };
367367- schema: SchemaWithType<'integer' | 'number'>;
368368- /**
369369- * Utility functions for number schema processing.
370370- */
371371- utils: {
372372- getIntegerLimit: GetIntegerLimit;
373373- maybeBigInt: MaybeBigInt;
374374- shouldCoerceToBigInt: ShouldCoerceToBigInt;
375375- };
376376-}
377377-378378-export interface ObjectResolverContext extends BaseResolverContext {
379379- /**
380380- * Nodes used to build different parts of the object schema.
381381- */
382382- nodes: {
383383- /**
384384- * If `additionalProperties` is `false` or `{ type: 'never' }`, returns `null`
385385- * to indicate no additional properties are allowed.
386386- */
387387- additionalProperties: (
388388- ctx: ObjectResolverContext,
389389- ) => Pipe | null | undefined;
390390- base: (ctx: ObjectResolverContext) => PipeResult;
391391- shape: (ctx: ObjectResolverContext) => ReturnType<typeof $.object>;
392392- };
393393- schema: SchemaWithType<'object'>;
394394- /**
395395- * Utility functions for object schema processing.
396396- */
397397- utils: {
398398- ast: Partial<Omit<Ast, 'typeName'>>;
399399- state: Refs<PluginState>;
400400- };
401401-}
402402-403403-export interface StringResolverContext extends BaseResolverContext {
404404- /**
405405- * Nodes used to build different parts of the string schema.
406406- */
407407- nodes: {
408408- base: (ctx: StringResolverContext) => PipeResult;
409409- const: (ctx: StringResolverContext) => PipeResult | undefined;
410410- format: (ctx: StringResolverContext) => PipeResult | undefined;
411411- length: (ctx: StringResolverContext) => PipeResult | undefined;
412412- maxLength: (ctx: StringResolverContext) => PipeResult | undefined;
413413- minLength: (ctx: StringResolverContext) => PipeResult | undefined;
414414- pattern: (ctx: StringResolverContext) => PipeResult | undefined;
415415- };
416416- schema: SchemaWithType<'string'>;
417417-}
418418-419419-export interface ValidatorResolverContext extends BaseResolverContext {
420420- operation: IR.Operation;
421421- /**
422422- * Provides access to commonly used symbols within the plugin.
423423- */
424424- symbols: BaseResolverContext['symbols'] & {
425425- schema: Symbol;
228228+ webhooks: NamingOptions & FeatureToggle;
426229 };
427427-}
428428-429429-type ValidatorResolver = (
430430- ctx: ValidatorResolverContext,
431431-) => PipeResult | null | undefined;
432432-433433-type Resolvers = Plugin.Resolvers<{
434434- /**
435435- * Resolver for number schemas.
436436- *
437437- * Allows customization of how number types are rendered.
438438- *
439439- * Returning `undefined` will execute the default resolver logic.
440440- */
441441- number?: (ctx: NumberResolverContext) => PipeResult | undefined;
442442- /**
443443- * Resolver for object schemas.
444444- *
445445- * Allows customization of how object types are rendered.
446446- *
447447- * Returning `undefined` will execute the default resolver logic.
448448- */
449449- object?: (ctx: ObjectResolverContext) => PipeResult | undefined;
450450- /**
451451- * Resolver for string schemas.
452452- *
453453- * Allows customization of how string types are rendered.
454454- *
455455- * Returning `undefined` will execute the default resolver logic.
456456- */
457457- string?: (ctx: StringResolverContext) => PipeResult | undefined;
458458- /**
459459- * Resolvers for request and response validators.
460460- *
461461- * Allow customization of validator function bodies.
462462- *
463463- * Example path: `~resolvers.validator.request` or `~resolvers.validator.response`
464464- *
465465- * Returning `undefined` will execute the default resolver logic.
466466- */
467467- validator?:
468468- | ValidatorResolver
469469- | {
470470- /**
471471- * Controls how the request validator function body is generated.
472472- *
473473- * Returning `undefined` will execute the default resolver logic.
474474- */
475475- request?: ValidatorResolver;
476476- /**
477477- * Controls how the response validator function body is generated.
478478- *
479479- * Returning `undefined` will execute the default resolver logic.
480480- */
481481- response?: ValidatorResolver;
482482- };
483483-}>;
484230485231export type ValibotPlugin = DefinePlugin<UserConfig, Config, IApi>;
+1-1
packages/openapi-ts/src/plugins/valibot/v1/api.ts
···11import { $ } from '~/ts-dsl';
2233+import type { ValidatorResolverContext } from '../resolvers';
34import { pipes } from '../shared/pipes';
45import type { ValidatorArgs } from '../shared/types';
55-import type { ValidatorResolverContext } from '../types';
66import { identifiers } from './constants';
7788const validatorResolver = (
···66import { getIntegerLimit } from '~/plugins/shared/utils/formats';
77import { $ } from '~/ts-dsl';
8899+import type { NumberResolverContext } from '../../resolvers';
910import type { Pipe, PipeResult, Pipes } from '../../shared/pipes';
1011import { pipes } from '../../shared/pipes';
1112import type { IrSchemaToAstOptions } from '../../shared/types';
1212-import type { NumberResolverContext } from '../../types';
1313import { identifiers } from '../constants';
14141515function baseNode(ctx: NumberResolverContext): PipeResult {
···33import type { SchemaWithType } from '~/plugins';
44import { $ } from '~/ts-dsl';
5566+import type { ObjectResolverContext } from '../../resolvers';
67import type { Pipe, PipeResult } from '../../shared/pipes';
78import { pipes } from '../../shared/pipes';
89import type { Ast, IrSchemaToAstOptions } from '../../shared/types';
99-import type { ObjectResolverContext } from '../../types';
1010import { identifiers } from '../constants';
1111import { irSchemaToAst } from '../plugin';
1212
···11import type { SchemaWithType } from '~/plugins';
22import { $ } from '~/ts-dsl';
3344+import type { StringResolverContext } from '../../resolvers';
45import type { Pipe, PipeResult, Pipes } from '../../shared/pipes';
56import { pipes } from '../../shared/pipes';
67import type { IrSchemaToAstOptions } from '../../shared/types';
77-import type { StringResolverContext } from '../../types';
88import { identifiers } from '../constants';
991010function baseNode(ctx: StringResolverContext): PipeResult {
+1-1
packages/openapi-ts/src/plugins/zod/mini/api.ts
···11import { $ } from '~/ts-dsl';
2233import { identifiers } from '../constants';
44+import type { ValidatorResolverContext } from '../resolvers';
45import type { ValidatorArgs } from '../shared/types';
55-import type { ValidatorResolverContext } from '../types';
6677const validatorResolver = (
88 ctx: ValidatorResolverContext,
···44import { $ } from '~/ts-dsl';
5566import { identifiers } from '../../constants';
77+import type { ObjectResolverContext } from '../../resolvers';
78import type { Chain } from '../../shared/chain';
89import type { Ast, IrSchemaToAstOptions } from '../../shared/types';
99-import type { ObjectResolverContext } from '../../types';
1010import { irSchemaToAst } from '../plugin';
11111212function additionalPropertiesNode(
···22import { $ } from '~/ts-dsl';
3344import { identifiers } from '../../constants';
55+import type { StringResolverContext } from '../../resolvers';
56import type { Chain } from '../../shared/chain';
67import type { Ast, IrSchemaToAstOptions } from '../../shared/types';
77-import type { StringResolverContext } from '../../types';
8899function baseNode(ctx: StringResolverContext): Chain {
1010 const { z } = ctx.symbols;
···11+import type { Refs, Symbol } from '@hey-api/codegen-core';
22+import type ts from 'typescript';
33+44+import type { IR } from '~/ir/types';
55+import type { Plugin, SchemaWithType } from '~/plugins';
66+import type {
77+ MaybeBigInt,
88+ ShouldCoerceToBigInt,
99+} from '~/plugins/shared/utils/coerce';
1010+import type { GetIntegerLimit } from '~/plugins/shared/utils/formats';
1111+import type { $, DollarTsDsl, TsDsl } from '~/ts-dsl';
1212+import type { MaybeArray } from '~/types/utils';
1313+1414+import type { Chain } from '../shared/chain';
1515+import type { Ast, PluginState } from '../shared/types';
1616+import type { ZodPlugin } from '../types';
1717+1818+export type Resolvers = Plugin.Resolvers<{
1919+ /**
2020+ * Resolver for number schemas.
2121+ *
2222+ * Allows customization of how number types are rendered.
2323+ *
2424+ * Returning `undefined` will execute the default resolver logic.
2525+ */
2626+ number?: (ctx: NumberResolverContext) => Chain | undefined;
2727+ /**
2828+ * Resolver for object schemas.
2929+ *
3030+ * Allows customization of how object types are rendered.
3131+ *
3232+ * Returning `undefined` will execute the default resolver logic.
3333+ */
3434+ object?: (ctx: ObjectResolverContext) => Chain | undefined;
3535+ /**
3636+ * Resolver for string schemas.
3737+ *
3838+ * Allows customization of how string types are rendered.
3939+ *
4040+ * Returning `undefined` will execute the default resolver logic.
4141+ */
4242+ string?: (ctx: StringResolverContext) => Chain | undefined;
4343+ /**
4444+ * Resolvers for request and response validators.
4545+ *
4646+ * Allow customization of validator function bodies.
4747+ *
4848+ * Example path: `~resolvers.validator.request` or `~resolvers.validator.response`
4949+ *
5050+ * Returning `undefined` will execute the default resolver logic.
5151+ */
5252+ validator?:
5353+ | ValidatorResolver
5454+ | {
5555+ /**
5656+ * Controls how the request validator function body is generated.
5757+ *
5858+ * Returning `undefined` will execute the default resolver logic.
5959+ */
6060+ request?: ValidatorResolver;
6161+ /**
6262+ * Controls how the response validator function body is generated.
6363+ *
6464+ * Returning `undefined` will execute the default resolver logic.
6565+ */
6666+ response?: ValidatorResolver;
6767+ };
6868+}>;
6969+7070+type ValidatorResolver = (
7171+ ctx: ValidatorResolverContext,
7272+) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
7373+7474+interface BaseContext extends DollarTsDsl {
7575+ /**
7676+ * Functions for working with chains.
7777+ */
7878+ chain: {
7979+ /**
8080+ * The current chain.
8181+ *
8282+ * In Zod, this represents a chain of call expressions ("chains")
8383+ * being assembled to form a schema definition.
8484+ *
8585+ * Each chain can be extended, modified, or replaced to customize
8686+ * the resulting schema.
8787+ */
8888+ current: Chain;
8989+ };
9090+ /**
9191+ * The plugin instance.
9292+ */
9393+ plugin: ZodPlugin['Instance'];
9494+ /**
9595+ * Provides access to commonly used symbols within the plugin.
9696+ */
9797+ symbols: {
9898+ z: Symbol;
9999+ };
100100+}
101101+102102+export interface NumberResolverContext extends BaseContext {
103103+ /**
104104+ * Nodes used to build different parts of the number schema.
105105+ */
106106+ nodes: {
107107+ base: (ctx: NumberResolverContext) => Chain;
108108+ const: (ctx: NumberResolverContext) => Chain | undefined;
109109+ max: (ctx: NumberResolverContext) => Chain | undefined;
110110+ min: (ctx: NumberResolverContext) => Chain | undefined;
111111+ };
112112+ schema: SchemaWithType<'integer' | 'number'>;
113113+ /**
114114+ * Utility functions for number schema processing.
115115+ */
116116+ utils: {
117117+ ast: Partial<Omit<Ast, 'typeName'>>;
118118+ getIntegerLimit: GetIntegerLimit;
119119+ maybeBigInt: MaybeBigInt;
120120+ shouldCoerceToBigInt: ShouldCoerceToBigInt;
121121+ state: Refs<PluginState>;
122122+ };
123123+}
124124+125125+export interface ObjectResolverContext extends BaseContext {
126126+ /**
127127+ * Nodes used to build different parts of the object schema.
128128+ */
129129+ nodes: {
130130+ /**
131131+ * If `additionalProperties` is `false` or `{ type: 'never' }`, returns `null`
132132+ * to indicate no additional properties are allowed.
133133+ */
134134+ additionalProperties: (
135135+ ctx: ObjectResolverContext,
136136+ ) => Chain | null | undefined;
137137+ base: (ctx: ObjectResolverContext) => Chain;
138138+ shape: (ctx: ObjectResolverContext) => ReturnType<typeof $.object>;
139139+ };
140140+ schema: SchemaWithType<'object'>;
141141+ /**
142142+ * Utility functions for object schema processing.
143143+ */
144144+ utils: {
145145+ ast: Partial<Omit<Ast, 'typeName'>>;
146146+ state: Refs<PluginState>;
147147+ };
148148+}
149149+150150+export interface StringResolverContext extends BaseContext {
151151+ /**
152152+ * Nodes used to build different parts of the string schema.
153153+ */
154154+ nodes: {
155155+ base: (ctx: StringResolverContext) => Chain;
156156+ const: (ctx: StringResolverContext) => Chain | undefined;
157157+ format: (ctx: StringResolverContext) => Chain | undefined;
158158+ length: (ctx: StringResolverContext) => Chain | undefined;
159159+ maxLength: (ctx: StringResolverContext) => Chain | undefined;
160160+ minLength: (ctx: StringResolverContext) => Chain | undefined;
161161+ pattern: (ctx: StringResolverContext) => Chain | undefined;
162162+ };
163163+ schema: SchemaWithType<'string'>;
164164+}
165165+166166+export interface ValidatorResolverContext extends BaseContext {
167167+ operation: IR.Operation;
168168+ /**
169169+ * Provides access to commonly used symbols within the plugin.
170170+ */
171171+ symbols: BaseContext['symbols'] & {
172172+ schema: Symbol;
173173+ };
174174+}
+71-413
packages/openapi-ts/src/plugins/zod/types.d.ts
···11-import type { Refs, Symbol } from '@hey-api/codegen-core';
22-import type ts from 'typescript';
33-44-import type { IR } from '~/ir/types';
55-import type { DefinePlugin, Plugin, SchemaWithType } from '~/plugins';
61import type {
77- MaybeBigInt,
88- ShouldCoerceToBigInt,
99-} from '~/plugins/shared/utils/coerce';
1010-import type { GetIntegerLimit } from '~/plugins/shared/utils/formats';
1111-import type { $, DollarTsDsl, TsDsl } from '~/ts-dsl';
1212-import type { MaybeArray } from '~/types/utils';
22+ FeatureToggle,
33+ IndexExportOption,
44+ NamingOptions,
55+} from '~/config/shared';
66+import type { DefinePlugin, Plugin } from '~/plugins';
137import type { Casing, NameTransformer } from '~/utils/naming';
148159import type { IApi } from './api';
1616-import type { Chain } from './shared/chain';
1717-import type { Ast, PluginState } from './shared/types';
1010+import type { Resolvers } from './resolvers';
18111912export type UserConfig = Plugin.Name<'zod'> &
2013 Plugin.Hooks &
2114 Resolvers & {
2215 /**
2323- * The casing convention to use for generated names.
1616+ * Casing convention for generated names.
2417 *
2518 * @default 'camelCase'
2619 */
···8679 | NameTransformer
8780 | {
8881 /**
8989- * The casing convention to use for generated names.
8282+ * Casing convention for generated names.
9083 *
9184 * @default 'camelCase'
9285 */
9386 case?: Casing;
9487 /**
9595- * Whether to generate Zod schemas for reusable definitions.
8888+ * Whether this feature is enabled.
9689 *
9790 * @default true
9891 */
9992 enabled?: boolean;
10093 /**
101101- * Custom naming pattern for generated schema names. The name variable
102102- * is obtained from the schema name.
9494+ * Naming pattern for generated names.
10395 *
10496 * @default 'z{{name}}'
10597 */
···125117 | NameTransformer
126118 | {
127119 /**
128128- * The casing convention to use for generated type names.
120120+ * Casing convention for generated names.
129121 *
130122 * @default 'PascalCase'
131123 */
132124 case?: Casing;
133125 /**
134134- * Whether to generate TypeScript types from Zod schemas.
126126+ * Whether this feature is enabled.
135127 *
136128 * @default true
137129 */
138130 enabled?: boolean;
139131 /**
140140- * Custom naming pattern for generated type names. The name variable is
141141- * obtained from the Zod schema name.
132132+ * Naming pattern for generated names.
142133 *
143134 * @default '{{name}}ZodType'
144135 */
···147138 };
148139 };
149140 /**
150150- * Should the exports from the generated files be re-exported in the index
151151- * barrel file?
141141+ * Whether exports should be re-exported in the index file.
152142 *
153143 * @default false
154144 */
···179169 | NameTransformer
180170 | {
181171 /**
182182- * The casing convention to use for generated names.
172172+ * Casing convention for generated names.
183173 *
184174 * @default 'camelCase'
185175 */
186176 case?: Casing;
187177 /**
188188- * Whether to generate Zod schemas for request definitions.
178178+ * Whether this feature is enabled.
189179 *
190180 * @default true
191181 */
192182 enabled?: boolean;
193183 /**
194194- * Custom naming pattern for generated schema names. The name variable
195195- * is obtained from the operation name.
184184+ * Naming pattern for generated names.
196185 *
197186 * @default 'z{{name}}Data'
198187 */
···218207 | NameTransformer
219208 | {
220209 /**
221221- * The casing convention to use for generated type names.
210210+ * Casing convention for generated names.
222211 *
223212 * @default 'PascalCase'
224213 */
225214 case?: Casing;
226215 /**
227227- * Whether to generate TypeScript types from Zod schemas.
216216+ * Whether this feature is enabled.
228217 *
229218 * @default true
230219 */
231220 enabled?: boolean;
232221 /**
233233- * Custom naming pattern for generated type names. The name variable is
234234- * obtained from the Zod schema name.
222222+ * Naming pattern for generated names.
235223 *
236224 * @default '{{name}}DataZodType'
237225 */
···257245 | NameTransformer
258246 | {
259247 /**
260260- * The casing convention to use for generated names.
248248+ * Casing convention for generated names.
261249 *
262250 * @default 'camelCase'
263251 */
264252 case?: Casing;
265253 /**
266266- * Whether to generate Zod schemas for response definitions.
254254+ * Whether this feature is enabled.
267255 *
268256 * @default true
269257 */
270258 enabled?: boolean;
271259 /**
272272- * Custom naming pattern for generated schema names. The name variable
273273- * is obtained from the operation name.
260260+ * Naming pattern for generated names.
274261 *
275262 * @default 'z{{name}}Response'
276263 */
···296283 | NameTransformer
297284 | {
298285 /**
299299- * The casing convention to use for generated type names.
286286+ * Casing convention for generated names.
300287 *
301288 * @default 'PascalCase'
302289 */
303290 case?: Casing;
304291 /**
305305- * Whether to generate TypeScript types from Zod schemas.
292292+ * Whether this feature is enabled.
306293 *
307294 * @default true
308295 */
309296 enabled?: boolean;
310297 /**
311311- * Custom naming pattern for generated type names. The name variable is
312312- * obtained from the Zod schema name.
298298+ * Naming pattern for generated names.
313299 *
314300 * @default '{{name}}ResponseZodType'
315301 */
···338324 | NameTransformer
339325 | {
340326 /**
341341- * The casing convention to use for generated type names.
327327+ * Casing convention for generated names.
342328 *
343329 * @default 'PascalCase'
344330 */
345331 case?: Casing;
346332 /**
347347- * Whether to generate TypeScript types from Zod schemas.
333333+ * Whether this feature is enabled.
348334 *
349335 * @default true
350336 */
···368354 | NameTransformer
369355 | {
370356 /**
371371- * The casing convention to use for generated names.
357357+ * Casing convention for generated names.
372358 *
373359 * @default 'camelCase'
374360 */
375361 case?: Casing;
376362 /**
377377- * Whether to generate Zod schemas for webhook definitions.
363363+ * Whether this feature is enabled.
378364 *
379365 * @default true
380366 */
381367 enabled?: boolean;
382368 /**
383383- * Custom naming pattern for generated schema names. The name variable
384384- * is obtained from the webhook key.
369369+ * Naming pattern for generated names.
385370 *
386371 * @default 'z{{name}}WebhookRequest'
387372 */
···407392 | NameTransformer
408393 | {
409394 /**
410410- * The casing convention to use for generated type names.
395395+ * Casing convention for generated names.
411396 *
412397 * @default 'PascalCase'
413398 */
414399 case?: Casing;
415400 /**
416416- * Whether to generate TypeScript types from Zod schemas.
401401+ * Whether this feature is enabled.
417402 *
418403 * @default true
419404 */
420405 enabled?: boolean;
421406 /**
422422- * Custom naming pattern for generated type names. The name variable is
423423- * obtained from the Zod schema name.
407407+ * Naming pattern for generated names.
424408 *
425409 * @default '{{name}}WebhookRequestZodType'
426410 */
···432416433417export type Config = Plugin.Name<'zod'> &
434418 Plugin.Hooks &
435435- Resolvers & {
419419+ Resolvers &
420420+ IndexExportOption & {
436421 /**
437437- * The casing convention to use for generated names.
438438- *
439439- * @default 'camelCase'
422422+ * Casing convention for generated names.
440423 */
441424 case: Casing;
442425 /**
···488471 * Controls generation of shared Zod schemas that can be referenced across
489472 * requests and responses.
490473 */
491491- definitions: {
492492- /**
493493- * The casing convention to use for generated names.
494494- *
495495- * @default 'camelCase'
496496- */
497497- case: Casing;
498498- /**
499499- * Whether to generate Zod schemas for reusable definitions.
500500- *
501501- * @default true
502502- */
503503- enabled: boolean;
504504- /**
505505- * Custom naming pattern for generated schema names. The name variable is
506506- * obtained from the schema name.
507507- *
508508- * @default 'z{{name}}'
509509- */
510510- name: NameTransformer;
511511- /**
512512- * Configuration for TypeScript type generation from Zod schemas.
513513- *
514514- * Controls generation of TypeScript types based on the generated Zod schemas.
515515- */
516516- types: {
474474+ definitions: NamingOptions &
475475+ FeatureToggle & {
517476 /**
518518- * Configuration for `infer` types.
477477+ * Configuration for TypeScript type generation from Zod schemas.
478478+ *
479479+ * Controls generation of TypeScript types based on the generated Zod schemas.
519480 */
520520- infer: {
521521- /**
522522- * The casing convention to use for generated type names.
523523- *
524524- * @default 'PascalCase'
525525- */
526526- case: Casing;
481481+ types: {
527482 /**
528528- * Whether to generate TypeScript types from Zod schemas.
529529- *
530530- * @default true
483483+ * Configuration for `infer` types.
531484 */
532532- enabled: boolean;
533533- /**
534534- * Custom naming pattern for generated type names. The name variable is
535535- * obtained from the Zod schema name.
536536- *
537537- * @default '{{name}}ZodType'
538538- */
539539- name: NameTransformer;
485485+ infer: NamingOptions & FeatureToggle;
540486 };
541487 };
542542- };
543543- /**
544544- * Should the exports from the generated files be re-exported in the index
545545- * barrel file?
546546- *
547547- * @default false
548548- */
549549- exportFromIndex: boolean;
550488 /**
551489 * Enable Zod metadata support? It's often useful to associate a schema with
552490 * some additional metadata for documentation, code generation, AI
···561499 * Controls generation of Zod schemas for request bodies, query parameters, path
562500 * parameters, and headers.
563501 */
564564- requests: {
565565- /**
566566- * The casing convention to use for generated names.
567567- *
568568- * @default 'camelCase'
569569- */
570570- case: Casing;
571571- /**
572572- * Whether to generate Zod schemas for request definitions.
573573- *
574574- * @default true
575575- */
576576- enabled: boolean;
577577- /**
578578- * Custom naming pattern for generated schema names. The name variable is
579579- * obtained from the operation name.
580580- *
581581- * @default 'z{{name}}Data'
582582- */
583583- name: NameTransformer;
584584- /**
585585- * Configuration for TypeScript type generation from Zod schemas.
586586- *
587587- * Controls generation of TypeScript types based on the generated Zod schemas.
588588- */
589589- types: {
502502+ requests: NamingOptions &
503503+ FeatureToggle & {
590504 /**
591591- * Configuration for `infer` types.
505505+ * Configuration for TypeScript type generation from Zod schemas.
506506+ *
507507+ * Controls generation of TypeScript types based on the generated Zod schemas.
592508 */
593593- infer: {
594594- /**
595595- * The casing convention to use for generated type names.
596596- *
597597- * @default 'PascalCase'
598598- */
599599- case: Casing;
600600- /**
601601- * Whether to generate TypeScript types from Zod schemas.
602602- *
603603- * @default true
604604- */
605605- enabled: boolean;
509509+ types: {
606510 /**
607607- * Custom naming pattern for generated type names. The name variable is
608608- * obtained from the Zod schema name.
609609- *
610610- * @default '{{name}}DataZodType'
511511+ * Configuration for `infer` types.
611512 */
612612- name: NameTransformer;
513513+ infer: NamingOptions & FeatureToggle;
613514 };
614515 };
615615- };
616516 /**
617517 * Configuration for response-specific Zod schemas.
618518 *
619519 * Controls generation of Zod schemas for response bodies, error responses,
620520 * and status codes.
621521 */
622622- responses: {
623623- /**
624624- * The casing convention to use for generated names.
625625- *
626626- * @default 'camelCase'
627627- */
628628- case: Casing;
629629- /**
630630- * Whether to generate Zod schemas for response definitions.
631631- *
632632- * @default true
633633- */
634634- enabled: boolean;
635635- /**
636636- * Custom naming pattern for generated schema names. The name variable is
637637- * obtained from the operation name.
638638- *
639639- * @default 'z{{name}}Response'
640640- */
641641- name: NameTransformer;
642642- /**
643643- * Configuration for TypeScript type generation from Zod schemas.
644644- *
645645- * Controls generation of TypeScript types based on the generated Zod schemas.
646646- */
647647- types: {
522522+ responses: NamingOptions &
523523+ FeatureToggle & {
648524 /**
649649- * Configuration for `infer` types.
525525+ * Configuration for TypeScript type generation from Zod schemas.
526526+ *
527527+ * Controls generation of TypeScript types based on the generated Zod schemas.
650528 */
651651- infer: {
652652- /**
653653- * The casing convention to use for generated type names.
654654- *
655655- * @default 'PascalCase'
656656- */
657657- case: Casing;
658658- /**
659659- * Whether to generate TypeScript types from Zod schemas.
660660- *
661661- * @default true
662662- */
663663- enabled: boolean;
529529+ types: {
664530 /**
665665- * Custom naming pattern for generated type names. The name variable is
666666- * obtained from the Zod schema name.
667667- *
668668- * @default '{{name}}ResponseZodType'
531531+ * Configuration for `infer` types.
669532 */
670670- name: NameTransformer;
533533+ infer: NamingOptions & FeatureToggle;
671534 };
672535 };
673673- };
674536 /**
675537 * Configuration for TypeScript type generation from Zod schemas.
676538 *
···680542 /**
681543 * Configuration for `infer` types.
682544 */
683683- infer: {
545545+ infer: FeatureToggle & {
684546 /**
685685- * The casing convention to use for generated type names.
686686- *
687687- * @default 'PascalCase'
547547+ * Casing convention for generated names.
688548 */
689549 case: Casing;
690690- /**
691691- * Whether to generate TypeScript types from Zod schemas.
692692- *
693693- * @default true
694694- */
695695- enabled: boolean;
696550 };
697551 };
698552 /**
···700554 *
701555 * Controls generation of Zod schemas for webhook payloads.
702556 */
703703- webhooks: {
704704- /**
705705- * The casing convention to use for generated names.
706706- *
707707- * @default 'camelCase'
708708- */
709709- case: Casing;
710710- /**
711711- * Whether to generate Zod schemas for webhook definitions.
712712- *
713713- * @default true
714714- */
715715- enabled: boolean;
716716- /**
717717- * Custom naming pattern for generated schema names. The name variable is
718718- * is obtained from the webhook key.
719719- *
720720- * @default 'z{{name}}WebhookRequest'
721721- */
722722- name: NameTransformer;
723723- /**
724724- * Configuration for TypeScript type generation from Zod schemas.
725725- *
726726- * Controls generation of TypeScript types based on the generated Zod schemas.
727727- */
728728- types: {
557557+ webhooks: NamingOptions &
558558+ FeatureToggle & {
729559 /**
730730- * Configuration for `infer` types.
560560+ * Configuration for TypeScript type generation from Zod schemas.
561561+ *
562562+ * Controls generation of TypeScript types based on the generated Zod schemas.
731563 */
732732- infer: {
733733- /**
734734- * The casing convention to use for generated type names.
735735- *
736736- * @default 'PascalCase'
737737- */
738738- case: Casing;
739739- /**
740740- * Whether to generate TypeScript types from Zod schemas.
741741- *
742742- * @default true
743743- */
744744- enabled: boolean;
564564+ types: {
745565 /**
746746- * Custom naming pattern for generated type names. The name variable is
747747- * obtained from the Zod schema name.
748748- *
749749- * @default '{{name}}WebhookRequestZodType'
566566+ * Configuration for `infer` types.
750567 */
751751- name: NameTransformer;
568568+ infer: NamingOptions & FeatureToggle;
752569 };
753570 };
754754- };
755571 };
756756-757757-interface BaseResolverContext extends DollarTsDsl {
758758- /**
759759- * Functions for working with chains.
760760- */
761761- chain: {
762762- /**
763763- * The current chain.
764764- *
765765- * In Zod, this represents a chain of call expressions ("chains")
766766- * being assembled to form a schema definition.
767767- *
768768- * Each chain can be extended, modified, or replaced to customize
769769- * the resulting schema.
770770- */
771771- current: Chain;
772772- };
773773- /**
774774- * The plugin instance.
775775- */
776776- plugin: ZodPlugin['Instance'];
777777- /**
778778- * Provides access to commonly used symbols within the plugin.
779779- */
780780- symbols: {
781781- z: Symbol;
782782- };
783783-}
784784-785785-export interface NumberResolverContext extends BaseResolverContext {
786786- /**
787787- * Nodes used to build different parts of the number schema.
788788- */
789789- nodes: {
790790- base: (ctx: NumberResolverContext) => Chain;
791791- const: (ctx: NumberResolverContext) => Chain | undefined;
792792- max: (ctx: NumberResolverContext) => Chain | undefined;
793793- min: (ctx: NumberResolverContext) => Chain | undefined;
794794- };
795795- schema: SchemaWithType<'integer' | 'number'>;
796796- /**
797797- * Utility functions for number schema processing.
798798- */
799799- utils: {
800800- ast: Partial<Omit<Ast, 'typeName'>>;
801801- getIntegerLimit: GetIntegerLimit;
802802- maybeBigInt: MaybeBigInt;
803803- shouldCoerceToBigInt: ShouldCoerceToBigInt;
804804- state: Refs<PluginState>;
805805- };
806806-}
807807-808808-export interface ObjectResolverContext extends BaseResolverContext {
809809- /**
810810- * Nodes used to build different parts of the object schema.
811811- */
812812- nodes: {
813813- /**
814814- * If `additionalProperties` is `false` or `{ type: 'never' }`, returns `null`
815815- * to indicate no additional properties are allowed.
816816- */
817817- additionalProperties: (
818818- ctx: ObjectResolverContext,
819819- ) => Chain | null | undefined;
820820- base: (ctx: ObjectResolverContext) => Chain;
821821- shape: (ctx: ObjectResolverContext) => ReturnType<typeof $.object>;
822822- };
823823- schema: SchemaWithType<'object'>;
824824- /**
825825- * Utility functions for object schema processing.
826826- */
827827- utils: {
828828- ast: Partial<Omit<Ast, 'typeName'>>;
829829- state: Refs<PluginState>;
830830- };
831831-}
832832-833833-export interface StringResolverContext extends BaseResolverContext {
834834- /**
835835- * Nodes used to build different parts of the string schema.
836836- */
837837- nodes: {
838838- base: (ctx: StringResolverContext) => Chain;
839839- const: (ctx: StringResolverContext) => Chain | undefined;
840840- format: (ctx: StringResolverContext) => Chain | undefined;
841841- length: (ctx: StringResolverContext) => Chain | undefined;
842842- maxLength: (ctx: StringResolverContext) => Chain | undefined;
843843- minLength: (ctx: StringResolverContext) => Chain | undefined;
844844- pattern: (ctx: StringResolverContext) => Chain | undefined;
845845- };
846846- schema: SchemaWithType<'string'>;
847847-}
848848-849849-export interface ValidatorResolverContext extends BaseResolverContext {
850850- operation: IR.Operation;
851851- /**
852852- * Provides access to commonly used symbols within the plugin.
853853- */
854854- symbols: BaseResolverContext['symbols'] & {
855855- schema: Symbol;
856856- };
857857-}
858858-859859-type ValidatorResolver = (
860860- ctx: ValidatorResolverContext,
861861-) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
862862-863863-type Resolvers = Plugin.Resolvers<{
864864- /**
865865- * Resolver for number schemas.
866866- *
867867- * Allows customization of how number types are rendered.
868868- *
869869- * Returning `undefined` will execute the default resolver logic.
870870- */
871871- number?: (ctx: NumberResolverContext) => Chain | undefined;
872872- /**
873873- * Resolver for object schemas.
874874- *
875875- * Allows customization of how object types are rendered.
876876- *
877877- * Returning `undefined` will execute the default resolver logic.
878878- */
879879- object?: (ctx: ObjectResolverContext) => Chain | undefined;
880880- /**
881881- * Resolver for string schemas.
882882- *
883883- * Allows customization of how string types are rendered.
884884- *
885885- * Returning `undefined` will execute the default resolver logic.
886886- */
887887- string?: (ctx: StringResolverContext) => Chain | undefined;
888888- /**
889889- * Resolvers for request and response validators.
890890- *
891891- * Allow customization of validator function bodies.
892892- *
893893- * Example path: `~resolvers.validator.request` or `~resolvers.validator.response`
894894- *
895895- * Returning `undefined` will execute the default resolver logic.
896896- */
897897- validator?:
898898- | ValidatorResolver
899899- | {
900900- /**
901901- * Controls how the request validator function body is generated.
902902- *
903903- * Returning `undefined` will execute the default resolver logic.
904904- */
905905- request?: ValidatorResolver;
906906- /**
907907- * Controls how the response validator function body is generated.
908908- *
909909- * Returning `undefined` will execute the default resolver logic.
910910- */
911911- response?: ValidatorResolver;
912912- };
913913-}>;
914572915573export type ZodPlugin = DefinePlugin<UserConfig, Config, IApi>;
+1-1
packages/openapi-ts/src/plugins/zod/v3/api.ts
···11import { $ } from '~/ts-dsl';
2233import { identifiers } from '../constants';
44+import type { ValidatorResolverContext } from '../resolvers';
45import type { ValidatorArgs } from '../shared/types';
55-import type { ValidatorResolverContext } from '../types';
6677const validatorResolver = (
88 ctx: ValidatorResolverContext,
···44import { $ } from '~/ts-dsl';
5566import { identifiers } from '../../constants';
77+import type { ObjectResolverContext } from '../../resolvers';
78import type { Chain } from '../../shared/chain';
89import type { Ast, IrSchemaToAstOptions } from '../../shared/types';
99-import type { ObjectResolverContext } from '../../types';
1010import { irSchemaToAst } from '../plugin';
11111212function additionalPropertiesNode(
···22import { $ } from '~/ts-dsl';
3344import { identifiers } from '../../constants';
55+import type { StringResolverContext } from '../../resolvers';
56import type { Chain } from '../../shared/chain';
67import type { IrSchemaToAstOptions } from '../../shared/types';
77-import type { StringResolverContext } from '../../types';
8899function baseNode(ctx: StringResolverContext): Chain {
1010 const { z } = ctx.symbols;
+1-1
packages/openapi-ts/src/plugins/zod/v4/api.ts
···11import { $ } from '~/ts-dsl';
2233import { identifiers } from '../constants';
44+import type { ValidatorResolverContext } from '../resolvers';
45import type { ValidatorArgs } from '../shared/types';
55-import type { ValidatorResolverContext } from '../types';
6677const validatorResolver = (
88 ctx: ValidatorResolverContext,
···44import { $ } from '~/ts-dsl';
5566import { identifiers } from '../../constants';
77+import type { ObjectResolverContext } from '../../resolvers';
78import type { Chain } from '../../shared/chain';
89import type { Ast, IrSchemaToAstOptions } from '../../shared/types';
99-import type { ObjectResolverContext } from '../../types';
1010import { irSchemaToAst } from '../plugin';
11111212function additionalPropertiesNode(
···22import { $ } from '~/ts-dsl';
3344import { identifiers } from '../../constants';
55+import type { StringResolverContext } from '../../resolvers';
56import type { Chain } from '../../shared/chain';
67import type { Ast, IrSchemaToAstOptions } from '../../shared/types';
77-import type { StringResolverContext } from '../../types';
8899function baseNode(ctx: StringResolverContext): Chain {
1010 const { z } = ctx.symbols;
+1-1
packages/openapi-ts/src/types/input.d.ts
···170170171171export type Watch = {
172172 /**
173173- * Regenerate the client when the input file changes?
173173+ * Whether this feature is enabled.
174174 *
175175 * @default false
176176 */
+19-70
packages/openapi-ts/src/types/parser.d.ts
···11+import type { FeatureToggle, NamingOptions } from '~/config/shared';
12import type {
23 OpenApiMetaObject,
34 OpenApiOperationObject,
···6869 | EnumsMode
6970 | {
7071 /**
7171- * The casing convention to use for generated names.
7272+ * Casing convention for generated names.
7273 *
7374 * @default 'PascalCase'
7475 */
7576 case?: Casing;
7677 /**
7777- * Whether to transform all enums.
7878+ * Whether this feature is enabled.
7879 *
7980 * @default true
8081 */
···121122 | boolean
122123 | {
123124 /**
124124- * Whether to split read-only and write-only schemas.
125125+ * Whether this feature is enabled.
125126 *
126127 * @default true
127128 */
···139140 | NameTransformer
140141 | {
141142 /**
142142- * The casing convention to use for generated names.
143143+ * Casing convention for generated names.
143144 *
144145 * @default 'preserve'
145146 */
···165166 | NameTransformer
166167 | {
167168 /**
168168- * The casing convention to use for generated names.
169169+ * Casing convention for generated names.
169170 *
170171 * @default 'preserve'
171172 */
···243244 * plugin, set `enums` to `root`. Likewise, if you don't want to export any
244245 * enum types, set `enums` to `inline`.
245246 */
246246- enums: {
247247- /**
248248- * The casing convention to use for generated names.
249249- *
250250- * @default 'PascalCase'
251251- */
252252- case: Casing;
253253- /**
254254- * Whether to transform all enums.
255255- *
256256- * @default true
257257- */
258258- enabled: boolean;
259259- /**
260260- * Controls whether enums are promoted to reusable root components
261261- * ('root') or kept inline within schemas ('inline').
262262- *
263263- * @default 'root'
264264- */
265265- mode: EnumsMode;
266266- /**
267267- * Customize the generated name of enums.
268268- *
269269- * @default '{{name}}Enum'
270270- */
271271- name: NameTransformer;
272272- };
247247+ enums: NamingOptions &
248248+ FeatureToggle & {
249249+ /**
250250+ * Controls whether enums are promoted to reusable root components
251251+ * ('root') or kept inline within schemas ('inline').
252252+ *
253253+ * @default 'root'
254254+ */
255255+ mode: EnumsMode;
256256+ };
273257 /**
274258 * By default, any object schema with a missing `required` keyword is
275259 * interpreted as "no properties are required." This is the correct
···292276 * would result in such scenarios. You can still disable this
293277 * behavior if you prefer.
294278 */
295295- readWrite: {
296296- /**
297297- * Whether to split read-only and write-only schemas.
298298- *
299299- * @default true
300300- */
301301- enabled: boolean;
279279+ readWrite: FeatureToggle & {
302280 /**
303281 * Configuration for generated request-specific schemas.
304282 */
305305- requests: {
306306- /**
307307- * The casing convention to use for generated names.
308308- *
309309- * @default 'preserve'
310310- */
311311- case: Casing;
312312- /**
313313- * Customize the generated name of schemas used in requests or
314314- * containing write-only fields.
315315- *
316316- * @default '{{name}}Writable'
317317- */
318318- name: NameTransformer;
319319- };
283283+ requests: NamingOptions;
320284 /**
321285 * Configuration for generated response-specific schemas.
322286 */
323323- responses: {
324324- /**
325325- * The casing convention to use for generated names.
326326- *
327327- * @default 'preserve'
328328- */
329329- case: Casing;
330330- /**
331331- * Customize the generated name of schemas used in responses or
332332- * containing read-only fields. We default to the original name
333333- * to avoid breaking output when a read-only field is added.
334334- *
335335- * @default '{{name}}'
336336- */
337337- name: NameTransformer;
338338- };
287287+ responses: NamingOptions;
339288 };
340289 };
341290 /**