@orval/core 8.18.0 → 8.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -31,7 +31,7 @@ interface NormalizedOptions {
31
31
  interface NormalizedOutputOptions {
32
32
  workspace?: string;
33
33
  target: string;
34
- schemas?: string | SchemaOptions;
34
+ schemas?: string | NormalizedSchemaOptions;
35
35
  operationSchemas?: string;
36
36
  namingConvention: NamingConvention;
37
37
  fileExtension: string;
@@ -61,6 +61,8 @@ interface NormalizedOutputOptions {
61
61
  optionsParamRequired: boolean;
62
62
  propertySortOrder: PropertySortOrder;
63
63
  factoryMethods?: NormalizedFactoryMethodsOptions;
64
+ tagsSplitDeduplication: boolean;
65
+ commonTypesFileName: string;
64
66
  }
65
67
  interface NormalizedParamsSerializerOptions {
66
68
  qs?: Record<string, unknown>;
@@ -168,6 +170,7 @@ interface NormalizedOverrideOutput {
168
170
  }
169
171
  interface NormalizedMutator {
170
172
  path: string;
173
+ resolvedPath?: string;
171
174
  name?: string;
172
175
  default: boolean;
173
176
  alias?: Record<string, string>;
@@ -185,7 +188,7 @@ interface NormalizedOperationOptions {
185
188
  query?: NormalizedQueryOptions;
186
189
  angular?: NormalizedAngularOptions;
187
190
  swr?: SwrOptions;
188
- zod?: NormalizedZodOptions;
191
+ zod?: NormalizedOperationZodOptions;
189
192
  effect?: NormalizedEffectOptions;
190
193
  operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
191
194
  fetch?: FetchOptions;
@@ -267,11 +270,20 @@ interface SchemaOptions {
267
270
  path: string;
268
271
  type?: SchemaGenerationType;
269
272
  importPath?: string;
273
+ /**
274
+ * When `true`, schemas are organized into per-tag subdirectories instead of
275
+ * a single flat directory. Schemas referenced by multiple tags remain at the
276
+ * root of the schema directory.
277
+ *
278
+ * @default false
279
+ */
280
+ splitByTags?: boolean;
270
281
  }
271
282
  interface NormalizedSchemaOptions {
272
283
  path: string;
273
284
  type: SchemaGenerationType;
274
285
  importPath?: string;
286
+ splitByTags: boolean;
275
287
  }
276
288
  interface OutputOptions {
277
289
  workspace?: string;
@@ -312,6 +324,8 @@ interface OutputOptions {
312
324
  optionsParamRequired?: boolean;
313
325
  propertySortOrder?: PropertySortOrder;
314
326
  factoryMethods?: FactoryMethodsOptions;
327
+ tagsSplitDeduplication?: boolean;
328
+ commonTypesFileName?: string;
315
329
  }
316
330
  interface InputFiltersOptions {
317
331
  mode?: 'include' | 'exclude';
@@ -433,10 +447,13 @@ type OverrideMockOptions = Partial<GlobalMockOptions> & {
433
447
  required?: boolean;
434
448
  nonNullable?: boolean;
435
449
  properties?: MockProperties;
450
+ schemas?: Record<string, {
451
+ properties: MockProperties;
452
+ }>;
436
453
  format?: Record<string, unknown>;
437
454
  fractionDigits?: number;
438
455
  };
439
- type MockOptions = Omit<OverrideMockOptions, 'properties'> & {
456
+ type MockOptions = Omit<OverrideMockOptions, 'properties' | 'schemas'> & {
440
457
  properties?: Record<string, unknown>;
441
458
  operations?: Record<string, {
442
459
  properties: Record<string, unknown>;
@@ -444,6 +461,9 @@ type MockOptions = Omit<OverrideMockOptions, 'properties'> & {
444
461
  tags?: Record<string, {
445
462
  properties: Record<string, unknown>;
446
463
  }>;
464
+ schemas?: Record<string, {
465
+ properties: Record<string, unknown>;
466
+ }>;
447
467
  };
448
468
  type MockPropertiesObject = Record<string, unknown>;
449
469
  type MockPropertiesObjectFn = (specs: OpenApiDocument) => MockPropertiesObject;
@@ -606,7 +626,20 @@ interface ZodDateTimeOptions {
606
626
  interface ZodTimeOptions {
607
627
  precision?: -1 | 0 | 1 | 2 | 3;
608
628
  }
609
- interface ZodOptions {
629
+ /**
630
+ * Target Zod major version for generated output.
631
+ *
632
+ * - `4` — always emit Zod 4-style output (`z.strictObject`, `z.looseObject`,
633
+ * `z.iso.datetime()`, `.meta()`, …) regardless of the installed `zod` version.
634
+ * - `3` — always emit Zod 3-compatible output (`.strict()`/`.passthrough()`,
635
+ * `z.string().datetime()`, …) regardless of the installed `zod` version.
636
+ * - `'auto'` — infer the target from the `zod` version resolved in the output
637
+ * project's `package.json`; when no `zod` package can be detected, fall back
638
+ * to Zod 4 output.
639
+ */
640
+ type ZodVersionOption = 3 | 4 | 'auto';
641
+ type ZodVariantOption = 'classic' | 'mini';
642
+ interface BaseZodOptions {
610
643
  strict?: {
611
644
  param?: boolean;
612
645
  query?: boolean;
@@ -647,10 +680,25 @@ interface ZodOptions {
647
680
  * location.
648
681
  */
649
682
  params?: Mutator;
683
+ useBrandedTypes?: boolean;
684
+ }
685
+ interface ZodOptions extends BaseZodOptions {
686
+ /**
687
+ * Select the generated Zod API style. `classic` imports from `zod`; `mini`
688
+ * imports from `zod/mini` and emits the functional/check-based Zod Mini API.
689
+ * Zod Mini requires a Zod 4 target.
690
+ */
691
+ variant?: ZodVariantOption;
692
+ /**
693
+ * Pin the Zod output target so generation is deterministic instead of
694
+ * inferred from the installed `zod` version. Defaults to `'auto'`, which
695
+ * infers from the detected package and otherwise falls back to Zod 4 output.
696
+ * See {@link ZodVersionOption}.
697
+ */
698
+ version?: ZodVersionOption;
650
699
  dateTimeOptions?: ZodDateTimeOptions;
651
700
  timeOptions?: ZodTimeOptions;
652
701
  generateEachHttpStatus?: boolean;
653
- useBrandedTypes?: boolean;
654
702
  /**
655
703
  * When true, emits one reusable Zod schema per `#/components/schemas/*` `$ref`
656
704
  * (with `namingConvention` applied to the name) and references it everywhere
@@ -666,6 +714,13 @@ interface ZodOptions {
666
714
  */
667
715
  generateMeta?: boolean;
668
716
  }
717
+ /**
718
+ * Per-operation/tag Zod overrides only include settings that are actually
719
+ * merged into the operation-specific generator path. Output-wide target and
720
+ * schema-layout settings belong on `override.zod`, not `override.operations.*`
721
+ * / `override.tags.*`.
722
+ */
723
+ type OperationZodOptions = BaseZodOptions;
669
724
  interface EffectOptions {
670
725
  strict?: ZodOptions['strict'];
671
726
  generate?: ZodOptions['generate'];
@@ -674,6 +729,8 @@ interface EffectOptions {
674
729
  }
675
730
  type ZodCoerceType = 'string' | 'number' | 'boolean' | 'bigint' | 'date' | 'array';
676
731
  interface NormalizedZodOptions {
732
+ variant: ZodVariantOption;
733
+ version: ZodVersionOption;
677
734
  strict: {
678
735
  param: boolean;
679
736
  query: boolean;
@@ -710,6 +767,7 @@ interface NormalizedZodOptions {
710
767
  dateTimeOptions: ZodDateTimeOptions;
711
768
  timeOptions: ZodTimeOptions;
712
769
  }
770
+ type NormalizedOperationZodOptions = Pick<NormalizedZodOptions, 'strict' | 'generate' | 'coerce' | 'preprocess' | 'params' | 'useBrandedTypes'>;
713
771
  interface NormalizedEffectOptions {
714
772
  strict: NormalizedZodOptions['strict'];
715
773
  generate: NormalizedZodOptions['generate'];
@@ -878,6 +936,15 @@ interface NormalizedFetchOptions {
878
936
  jsonReviver?: Mutator;
879
937
  runtimeValidation: boolean;
880
938
  useRuntimeFetcher: boolean;
939
+ /**
940
+ * Serialization format for array query parameters that do not have an explicit
941
+ * `explode` setting in the OpenAPI spec.
942
+ *
943
+ * - `repeat` — repeat the key for each value: `foo=1&foo=2`
944
+ * - `brackets` — append `[]` to the key: `foo[]=1&foo[]=2`
945
+ * - `comma` — join values with a comma: `foo=1,2`
946
+ */
947
+ arrayFormat?: 'repeat' | 'brackets' | 'comma';
881
948
  }
882
949
  interface FetchOptions {
883
950
  includeHttpResponseReturnType?: boolean;
@@ -885,6 +952,15 @@ interface FetchOptions {
885
952
  jsonReviver?: Mutator;
886
953
  runtimeValidation?: boolean;
887
954
  useRuntimeFetcher?: boolean;
955
+ /**
956
+ * Serialization format for array query parameters that do not have an explicit
957
+ * `explode` setting in the OpenAPI spec.
958
+ *
959
+ * - `repeat` — repeat the key for each value: `foo=1&foo=2`
960
+ * - `brackets` — append `[]` to the key: `foo[]=1&foo[]=2`
961
+ * - `comma` — join values with a comma: `foo=1,2`
962
+ */
963
+ arrayFormat?: 'repeat' | 'brackets' | 'comma';
888
964
  }
889
965
  type InputTransformerFn = (spec: OpenApiDocument) => OpenApiDocument | Promise<OpenApiDocument>;
890
966
  type InputTransformer = string | InputTransformerFn;
@@ -901,7 +977,7 @@ interface OperationOptions {
901
977
  query?: QueryOptions;
902
978
  angular?: AngularOptions;
903
979
  swr?: SwrOptions;
904
- zod?: ZodOptions;
980
+ zod?: OperationZodOptions;
905
981
  effect?: EffectOptions;
906
982
  operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
907
983
  fetch?: FetchOptions;
@@ -921,14 +997,15 @@ type HookCommand = string | HookFunction | HookOption | (string | HookFunction |
921
997
  type NormalizedHookCommand = HookCommand[];
922
998
  type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
923
999
  type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
924
- type Verbs = 'post' | 'put' | 'get' | 'patch' | 'delete' | 'head';
1000
+ type Verbs = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch';
925
1001
  declare const Verbs: {
926
- POST: Verbs;
927
- PUT: Verbs;
928
1002
  GET: Verbs;
929
- PATCH: Verbs;
1003
+ PUT: Verbs;
1004
+ POST: Verbs;
930
1005
  DELETE: Verbs;
1006
+ OPTIONS: Verbs;
931
1007
  HEAD: Verbs;
1008
+ PATCH: Verbs;
932
1009
  };
933
1010
  /**
934
1011
  * Canonical tag name used for the generated bucket that collects untagged operations.
@@ -954,6 +1031,14 @@ interface ContextSpec {
954
1031
  * entries or generic parameter placeholders. Populated by `buildDynamicScope`.
955
1032
  */
956
1033
  dynamicScope?: Partial<Record<string, DynamicScopeEntry>>;
1034
+ /**
1035
+ * Lazily-built index of every `$dynamicAnchor` declared in
1036
+ * `components.schemas`, used by the `resolveDynamicRef` fallback when an
1037
+ * anchor is absent from {@link dynamicScope}. Memoized on first miss so the
1038
+ * O(numSchemas) scan runs once per spec instead of once per `$dynamicRef`.
1039
+ * Populated by `getDynamicAnchorIndex` in `resolvers/ref.ts`.
1040
+ */
1041
+ dynamicAnchorIndex?: Map<string, DynamicAnchorIndexEntry>;
957
1042
  /**
958
1043
  * Tracks array-item mock factory names already emitted per output file scope.
959
1044
  * Populated by `@orval/mock` when `arrayItems: true` so shared `$ref` item
@@ -980,11 +1065,37 @@ interface ContextSpec {
980
1065
  * - `isParameter` — `true`, signals this is a generic type parameter
981
1066
  * - `name` — the `$dynamicAnchor` name used as the type parameter (e.g. `itemType`)
982
1067
  * - `schemaName` — same as `name` for parameters
1068
+ *
1069
+ * Inline entry (anonymous subschema overriding an anchor without a `$ref`):
1070
+ * - `inlineSchema` — the concrete schema object to resolve `$dynamicRef` against.
1071
+ * Takes precedence over the component lookup in `resolveDynamicRef`, so an
1072
+ * inline `$dynamicAnchor` (e.g. inside `allOf` / `items`) correctly shadows
1073
+ * the outer/global anchor. `schemaName` is the anchor name itself.
983
1074
  */
984
1075
  interface DynamicScopeEntry {
985
1076
  name: string;
986
1077
  schemaName: string;
987
1078
  isParameter?: boolean;
1079
+ inlineSchema?: OpenApiSchemaObject;
1080
+ }
1081
+ /**
1082
+ * Compact per-anchor result of the single `$dynamicAnchor` index scan.
1083
+ *
1084
+ * Reproduces the precedence in `resolveDynamicRef`'s fallback without storing
1085
+ * full match arrays:
1086
+ * - {@link exactName} — a schema whose key equals the anchor name. Always
1087
+ * wins when present (matches `matches.find(m => m === anchorName)`).
1088
+ * - {@link firstName} / {@link count} — non-exact matches. Only the first is
1089
+ * kept; `count` is capped at 2 because the resolution only distinguishes
1090
+ * "exactly one" from "ambiguous". Recording stops once `count >= 2`, which
1091
+ * is the safe form of "bail early when ambiguous" — a literal early-return
1092
+ * at `count === 2` would regress the exact-name rule when the exact schema
1093
+ * appears later in iteration order.
1094
+ */
1095
+ interface DynamicAnchorIndexEntry {
1096
+ exactName?: string;
1097
+ firstName?: string;
1098
+ count: number;
988
1099
  }
989
1100
  interface GlobalOptions {
990
1101
  watch?: boolean | string | string[];
@@ -1105,6 +1216,7 @@ interface GeneratorTarget {
1105
1216
  paramsSerializer?: GeneratorMutator[];
1106
1217
  paramsFilter?: GeneratorMutator[];
1107
1218
  fetchReviver?: GeneratorMutator[];
1219
+ sharedTypes?: SharedTypeDeclaration[];
1108
1220
  }
1109
1221
  interface GeneratorTargetFull {
1110
1222
  imports: GeneratorImport[];
@@ -1117,6 +1229,7 @@ interface GeneratorTargetFull {
1117
1229
  paramsSerializer?: GeneratorMutator[];
1118
1230
  paramsFilter?: GeneratorMutator[];
1119
1231
  fetchReviver?: GeneratorMutator[];
1232
+ sharedTypes?: SharedTypeDeclaration[];
1120
1233
  }
1121
1234
  interface GeneratorOperation {
1122
1235
  imports: GeneratorImport[];
@@ -1197,6 +1310,15 @@ interface ClientFileBuilder {
1197
1310
  content: string;
1198
1311
  }
1199
1312
  type ClientExtraFilesBuilder = (verbOptions: Record<string, GeneratorVerbOptions>, output: NormalizedOutputOptions, context: ContextSpec) => Promise<ClientFileBuilder[]>;
1313
+ interface SharedTypeDeclaration {
1314
+ name: string;
1315
+ exported: boolean;
1316
+ code: string;
1317
+ }
1318
+ type HeaderResult = {
1319
+ implementation: string;
1320
+ sharedTypes?: SharedTypeDeclaration[];
1321
+ };
1200
1322
  type ClientHeaderBuilder = (params: {
1201
1323
  title: string;
1202
1324
  isRequestOptions: boolean;
@@ -1210,7 +1332,7 @@ type ClientHeaderBuilder = (params: {
1210
1332
  tag?: string;
1211
1333
  isDefaultTagBucket?: boolean;
1212
1334
  clientImplementation: string;
1213
- }) => string;
1335
+ }) => string | HeaderResult;
1214
1336
  type ClientFooterBuilder = (params: {
1215
1337
  noFunction?: boolean | undefined;
1216
1338
  operationNames: string[];
@@ -1395,6 +1517,7 @@ interface WriteModeProps {
1395
1517
  header: string;
1396
1518
  needSchema: boolean;
1397
1519
  generateSchemasInline?: () => string;
1520
+ schemaTagMap?: Map<string, string>;
1398
1521
  }
1399
1522
  interface GeneratorApiOperations {
1400
1523
  verbOptions: Record<string, GeneratorVerbOptions>;
@@ -1404,6 +1527,7 @@ interface GeneratorApiOperations {
1404
1527
  interface GeneratorClientExtra {
1405
1528
  implementation: string;
1406
1529
  implementationMock: string;
1530
+ sharedTypes?: SharedTypeDeclaration[];
1407
1531
  }
1408
1532
  type GeneratorClientTitle = (data: {
1409
1533
  outputClient?: OutputClient | OutputClientFunc;
@@ -1650,7 +1774,6 @@ interface GenerateAxiosOptions {
1650
1774
  requestOptions?: object | boolean;
1651
1775
  hasSignal: boolean;
1652
1776
  hasSignalParam?: boolean;
1653
- isVue: boolean;
1654
1777
  isAngular: boolean;
1655
1778
  paramsSerializer?: GeneratorMutator;
1656
1779
  paramsSerializerOptions?: ParamsSerializerOptions;
@@ -1668,7 +1791,6 @@ declare function generateAxiosOptions({
1668
1791
  requestOptions,
1669
1792
  hasSignal,
1670
1793
  hasSignalParam,
1671
- isVue,
1672
1794
  isAngular,
1673
1795
  paramsSerializer,
1674
1796
  paramsSerializerOptions,
@@ -1690,7 +1812,6 @@ interface GenerateOptionsOptions {
1690
1812
  isExactOptionalPropertyTypes: boolean;
1691
1813
  hasSignal: boolean;
1692
1814
  hasSignalParam?: boolean;
1693
- isVue?: boolean;
1694
1815
  paramsSerializer?: GeneratorMutator;
1695
1816
  paramsSerializerOptions?: ParamsSerializerOptions;
1696
1817
  paramsFilter?: GeneratorMutator;
@@ -1711,13 +1832,12 @@ declare function generateOptions({
1711
1832
  isExactOptionalPropertyTypes,
1712
1833
  hasSignal,
1713
1834
  hasSignalParam,
1714
- isVue,
1715
1835
  paramsSerializer,
1716
1836
  paramsSerializerOptions,
1717
1837
  paramsFilter
1718
1838
  }: GenerateOptionsOptions): string;
1719
1839
  declare function generateBodyMutatorConfig(body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean): string;
1720
- declare function generateQueryParamsAxiosConfig(response: GetterResponse, isVue: boolean, isAngular: boolean, requiredNullableQueryParamKeys?: string[], queryParams?: GetterQueryParam, paramsFilter?: GeneratorMutator): string;
1840
+ declare function generateQueryParamsAxiosConfig(response: GetterResponse, isAngular: boolean, requiredNullableQueryParamKeys?: string[], queryParams?: GetterQueryParam, paramsFilter?: GeneratorMutator): string;
1721
1841
  interface GenerateMutatorConfigOptions {
1722
1842
  route: string;
1723
1843
  body: GetterBody;
@@ -1730,7 +1850,6 @@ interface GenerateMutatorConfigOptions {
1730
1850
  hasSignal: boolean;
1731
1851
  hasSignalParam?: boolean;
1732
1852
  isExactOptionalPropertyTypes: boolean;
1733
- isVue?: boolean;
1734
1853
  isAngular?: boolean;
1735
1854
  paramsFilter?: GeneratorMutator;
1736
1855
  }
@@ -1746,7 +1865,6 @@ declare function generateMutatorConfig({
1746
1865
  hasSignal,
1747
1866
  hasSignalParam,
1748
1867
  isExactOptionalPropertyTypes,
1749
- isVue,
1750
1868
  isAngular,
1751
1869
  paramsFilter
1752
1870
  }: GenerateMutatorConfigOptions): string;
@@ -2224,6 +2342,44 @@ declare function extractBoundAliasInfo(schema: OpenApiSchemaObject | OpenApiRefe
2224
2342
  * type entries for self-referential resolution, `$defs` bindings, and sibling anchors.
2225
2343
  */
2226
2344
  declare function buildDynamicScope(schemaName: string, schema: OpenApiSchemaObject, context: ContextSpec): Record<string, DynamicScopeEntry>;
2345
+ /**
2346
+ * Build dynamic scope entries for an **anonymous inline** subschema that declares
2347
+ * `$dynamicAnchor` without a `$ref` (e.g. inside `allOf`, `items`, nested props).
2348
+ *
2349
+ * Unlike {@link buildDynamicScope}, entries carry the concrete `inlineSchema` so
2350
+ * that a descendant `$dynamicRef` resolves to the inline override rather than the
2351
+ * outer/global component. Used when `dereference` enters a subschema without a
2352
+ * named component `$ref`.
2353
+ *
2354
+ * Scope of handling (deliberate, see #3492):
2355
+ * - Direct `$dynamicAnchor` on the subschema → inline entry.
2356
+ * - `$defs` `$dynamicAnchor` *without* a `$ref` → inline entry. Note this
2357
+ * differs from `buildDynamicScope`, which treats unbound `$defs` anchors as
2358
+ * generic parameters (`isParameter`); inline subschemas are concrete
2359
+ * instances, so the anchor resolves to the inline schema object itself.
2360
+ * - `$defs` `$dynamicAnchor` *with* a `$ref` → intentionally NOT collected
2361
+ * here. Such anchors rely on `resolveDynamicRef`'s global fallback (which
2362
+ * finds them when the `$ref` target declares the same anchor). Fully
2363
+ * resolving them would duplicate `buildDynamicScope`'s `$defs` logic.
2364
+ */
2365
+ declare function buildInlineDynamicScope(schema: OpenApiSchemaObject): Record<string, DynamicScopeEntry>;
2366
+ /**
2367
+ * Lazily build and memoize the `$dynamicAnchor` index on the context.
2368
+ *
2369
+ * Scans `components.schemas` once per spec and stores, per anchor name, the
2370
+ * compact match info required by the {@link resolveDynamicRef} fallback (see
2371
+ * {@link DynamicAnchorIndexEntry}). Subsequent fallback lookups are O(1)
2372
+ * instead of re-scanning every schema per `$dynamicRef`.
2373
+ *
2374
+ * Recording of non-exact matches stops once `count >= 2` — the fallback only
2375
+ * distinguishes "exactly one non-exact" from "ambiguous", so further non-exact
2376
+ * names are irrelevant. Iteration continues regardless because a later schema
2377
+ * whose key equals the anchor name is still the definitive (`exactName`)
2378
+ * winner. This is the safe form of "bail early when ambiguous": a literal
2379
+ * early-return at `count === 2` would regress the exact-name rule when the
2380
+ * exact schema appears later in iteration order.
2381
+ */
2382
+ declare function getDynamicAnchorIndex(context: ContextSpec): Map<string, DynamicAnchorIndexEntry>;
2227
2383
  /**
2228
2384
  * Resolve a `$dynamicRef` anchor to its concrete type using the current dynamic scope.
2229
2385
  * Returns `{ schema: {}, resolvedTypeName: 'unknown' }` when no scope override exists.
@@ -2757,6 +2913,51 @@ declare function jsStringLiteralEscape(input: string): string;
2757
2913
  */
2758
2914
  declare function dedupeUnionType(unionType: string): string;
2759
2915
  //#endregion
2916
+ //#region src/utils/tags.d.ts
2917
+ /**
2918
+ * Canonical bucket key for a single OpenAPI tag.
2919
+ *
2920
+ * In `tags` / `tags-split` mode operations are routed into files by their first
2921
+ * tag. This function is the **single source of truth** for turning a tag (or a
2922
+ * missing tag) into the key that identifies that file bucket. Every place that
2923
+ * groups operations by tag, derives a per-tag file/directory name, or checks
2924
+ * whether an operation belongs to a tag MUST go through here so that the
2925
+ * "build the key" side and the "look the key up" side can never disagree.
2926
+ *
2927
+ * The result is `kebab`-cased. `kebab` is idempotent
2928
+ * (`kebab(kebab(x)) === kebab(x)`), so it is always safe to call this on a value
2929
+ * that is already a canonical key. Other case functions (`camel`, `pascal`) are
2930
+ * NOT safe here: they do not round-trip through the bucket key for tags
2931
+ * containing acronyms or spaces (e.g. `"AB Widget"`), which is exactly the class
2932
+ * of bug this module exists to prevent.
2933
+ *
2934
+ * Missing or empty tags map to the implicit {@link DefaultTag} bucket.
2935
+ */
2936
+ declare function getTagKey(tag?: string): string;
2937
+ /**
2938
+ * Canonical bucket key for an operation, derived from its primary (first) tag.
2939
+ *
2940
+ * Untagged operations resolve to the {@link DefaultTag} bucket.
2941
+ */
2942
+ declare function getOperationTagKey(operation: {
2943
+ tags: string[];
2944
+ }): string;
2945
+ /**
2946
+ * Whether an operation belongs to the given tag bucket.
2947
+ *
2948
+ * Both sides are normalised through {@link getTagKey}, so the comparison is
2949
+ * correct regardless of how `tagKey` was spelled or cased by the caller. An
2950
+ * absent (`undefined`) `tagKey` matches every operation (the "no tag filter"
2951
+ * case); an empty/whitespace `tagKey` is normalised to the {@link DefaultTag}
2952
+ * bucket like any other tag.
2953
+ *
2954
+ * Prefer this over hand-rolling `operation.tags[0] === tagKey`: a raw tag
2955
+ * compared against a canonical key silently fails for multi-word/acronym tags.
2956
+ */
2957
+ declare function isOperationInTagBucket(operation: {
2958
+ tags: string[];
2959
+ }, tagKey?: string): boolean;
2960
+ //#endregion
2760
2961
  //#region src/utils/tsconfig.d.ts
2761
2962
  declare function isSyntheticDefaultImportsAllow(config?: Tsconfig): boolean;
2762
2963
  declare function getImportExtension(fileExtension: string, tsconfig?: Tsconfig): string;
@@ -2771,6 +2972,10 @@ declare function getImportExtension(fileExtension: string, tsconfig?: Tsconfig):
2771
2972
  */
2772
2973
  declare function writeGeneratedFile(filePath: string, content: string): Promise<void>;
2773
2974
  //#endregion
2975
+ //#region src/writers/schema-tag-mapper.d.ts
2976
+ declare const SHARED_DIR = ".";
2977
+ declare function buildSchemaTagMap(operations: ReadonlyArray<Pick<GeneratorOperation, 'imports' | 'tags'>>, schemas: GeneratorSchema[]): Map<string, string>;
2978
+ //#endregion
2774
2979
  //#region src/writers/schemas.d.ts
2775
2980
  /**
2776
2981
  * Split schemas into regular and operation types.
@@ -2830,6 +3035,35 @@ declare function writeSchemas({
2830
3035
  factoryOutputDirectory
2831
3036
  }: WriteSchemasOptions): Promise<void>;
2832
3037
  //#endregion
3038
+ //#region src/writers/schemas-tags-split.d.ts
3039
+ interface WriteSchemasTagsSplitOptions {
3040
+ schemaPath: string;
3041
+ schemas: GeneratorSchema[];
3042
+ target: string;
3043
+ namingConvention: NamingConvention;
3044
+ fileExtension: string;
3045
+ header: string;
3046
+ indexFiles: boolean;
3047
+ tsconfig?: Tsconfig;
3048
+ factoryOutputDirectory?: string;
3049
+ operations: ReadonlyArray<{
3050
+ imports: GeneratorImport[];
3051
+ tags: string[];
3052
+ }>;
3053
+ }
3054
+ declare function writeSchemasTagsSplit({
3055
+ schemaPath,
3056
+ schemas,
3057
+ target,
3058
+ namingConvention,
3059
+ fileExtension,
3060
+ header,
3061
+ indexFiles,
3062
+ tsconfig,
3063
+ factoryOutputDirectory,
3064
+ operations
3065
+ }: WriteSchemasTagsSplitOptions): Promise<void>;
3066
+ //#endregion
2833
3067
  //#region src/writers/single-mode.d.ts
2834
3068
  declare function writeSingleMode({
2835
3069
  builder,
@@ -2837,7 +3071,8 @@ declare function writeSingleMode({
2837
3071
  projectName,
2838
3072
  header,
2839
3073
  needSchema,
2840
- generateSchemasInline
3074
+ generateSchemasInline,
3075
+ schemaTagMap
2841
3076
  }: WriteModeProps): Promise<string[]>;
2842
3077
  //#endregion
2843
3078
  //#region src/writers/split-mode.d.ts
@@ -2847,7 +3082,8 @@ declare function writeSplitMode({
2847
3082
  projectName,
2848
3083
  header,
2849
3084
  needSchema,
2850
- generateSchemasInline
3085
+ generateSchemasInline,
3086
+ schemaTagMap
2851
3087
  }: WriteModeProps): Promise<string[]>;
2852
3088
  //#endregion
2853
3089
  //#region src/writers/split-tags-mode.d.ts
@@ -2857,7 +3093,8 @@ declare function writeSplitTagsMode({
2857
3093
  projectName,
2858
3094
  header,
2859
3095
  needSchema,
2860
- generateSchemasInline
3096
+ generateSchemasInline,
3097
+ schemaTagMap
2861
3098
  }: WriteModeProps): Promise<string[]>;
2862
3099
  //#endregion
2863
3100
  //#region src/writers/tags-mode.d.ts
@@ -2867,7 +3104,8 @@ declare function writeTagsMode({
2867
3104
  projectName,
2868
3105
  header,
2869
3106
  needSchema,
2870
- generateSchemasInline
3107
+ generateSchemasInline,
3108
+ schemaTagMap
2871
3109
  }: WriteModeProps): Promise<string[]>;
2872
3110
  //#endregion
2873
3111
  //#region src/writers/target.d.ts
@@ -2880,5 +3118,5 @@ declare function generateTargetForTags(builder: WriteSpecBuilder, options: Norma
2880
3118
  declare function getOrvalGeneratedTypes(): string;
2881
3119
  declare function getTypedResponse(): string;
2882
3120
  //#endregion
2883
- export { AngularHttpResourceOptions, AngularOptions, BODY_TYPE_NAME, BaseUrlFromConstant, BaseUrlFromSpec, BaseUrlRuntime, BoundAliasInfo, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFileBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMockBuilder, ClientMockGeneratorBuilder, ClientMockGeneratorImplementation, ClientTitleBuilder, CommonMockOptions, Config, ConfigExternal, ConfigFn, ContentTypeFilter, ContextSpec, DeepNonNullable, DefaultTag, DynamicScopeEntry, EffectOptions, EnumGeneration, ErrorWithTag, FactoryMethodsMode, FactoryMethodsOptions, FakerMockOptions, FetchOptions, FinalizeMockImplementationOptions, FormDataArrayHandling, FormDataContext, FormDataType, GenerateMockImports, GenerateVerbOptionsParams, GenerateVerbsOptionsParams, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMockOutput, GeneratorMockOutputFull, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalMockOptions, GlobalOptions, HonoHandlerStrategy, HonoOptions, Hook, HookCommand, HookFunction, HookOption, HooksOptions, ImportOpenApi, InputFiltersOptions, InputOptions, InputTransformerFn, InvalidateTarget, InvalidateTargetParam, JsDocOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, McpOptions, McpServerOptions, MockData, MockDataArray, MockDataArrayFn, MockDataObject, MockDataObjectFn, MockOptions, MockProperties, MockPropertiesObject, MockPropertiesObjectFn, MswMockOptions, MutationInvalidatesConfig, MutationInvalidatesRule, Mutator, MutatorObject, NAMED_COMPONENT_SECTIONS, NamingConvention, NormalizedAngularOptions, NormalizedConfig, NormalizedEffectOptions, NormalizedFactoryMethodsOptions, NormalizedFetchOptions, NormalizedFormDataType, NormalizedHonoOptions, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedJsDocOptions, NormalizedMcpOptions, NormalizedMcpServerOptions, NormalizedMocksConfig, NormalizedMutator, NormalizedOperationOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, NormalizedSchemaOptions, NormalizedZodOptions, OpenApiComponentsObject, OpenApiDocument, OpenApiDynamicReferenceObject, OpenApiEncodingObject, OpenApiExampleObject, OpenApiInfoObject, OpenApiMediaTypeObject, OpenApiOperationObject, OpenApiParameterObject, OpenApiPathItemObject, OpenApiPathsObject, OpenApiReferenceObject, OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiResponsesObject, OpenApiSchemaObject, OpenApiSchemaObjectType, OpenApiSchemasObject, OpenApiServerObject, OperationOptions, Options, OptionsExport, OptionsFn, OutputClient, OutputClientFunc, OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMocksConfig, OutputMocksOption, OutputMode, OutputOptions, OverrideInput, OverrideMockOptions, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, PreferredContentType, PropertySortOrder, QueryOptions, ReadonlyRequestBodiesMode, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ResponseTypeCategory, ScalarValue, SchemaGenerationType, SchemaOptionLike, SchemaOptions, SchemaType, StrictMockSchemaKind, SupportedFormatter, SwrOptions, TEMPLATE_TAG_REGEX, TsConfigModule, TsConfigModuleResolution, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, WriteSpecBuilder, ZodCoerceType, ZodDateTimeOptions, ZodOptions, ZodTimeOptions, addDependency, asyncReduce, buildAngularParamsFilterExpression, buildDynamicScope, camel, collectReferencedComponents, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, createTypeAliasIfNeeded, dedupeUnionType, dynamicAnchorToParamName, dynamicAnchorsToUniqueParamNames, dynamicImport, escape, escapeRegExp, extractBoundAliasInfo, filterByContentType, filteredVerbs, fixCrossDirectoryImports, fixRegularSchemaImports, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFactory, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbOptions, generateVerbsOptions, getAngularFilteredParamsCallExpression, getAngularFilteredParamsExpression, getAngularFilteredParamsHelperBody, getArray, getBaseUrlRuntimeImports, getBodiesByContentType, getBody, getCombinedEnumValue, getDefaultContentType, getDynamicAnchorName, getEnum, getEnumDescriptions, getEnumImplementation, getEnumNames, getEnumUnionFromSchema, getExtension, getFileInfo, getFormDataFieldFileType, getFullRoute, getImportExtension, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getPropertySafe, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getResponseTypeCategory, getRoute, getRouteAsArray, getScalar, getSchemasImportPath, getSuccessResponseType, getTypedResponse, getWarningCount, isBinaryContentType, isBinaryScalarSchema, isBoolean, isComponentRef, isDirectory, isDynamicReference, isFakerMock, isFunction, isModule, isMswMock, isNullish, isNumber, isNumeric, isObject, isReference, isSchema, isString, isStringLike, isSyntheticDefaultImportsAllow, isUrl, isVerb, isVerbose, jsDoc, jsStringEscape, jsStringLiteralEscape, kebab, keyValuePairsToJsDoc, log, logError, logVerbose, logWarning, makeRouteSafe, mergeDeep, mismatchArgsMessage, pascal, removeFilesAndEmptyFolders, resetWarnings, resolveDiscriminators, resolveDynamicRef, resolveExampleRefs, resolveInstalledVersion, resolveInstalledVersions, resolveObject, resolveRef, resolveValue, sanitize, setVerbose, snake, sortByPriority, splitSchemasByType, startMessage, stringify, toObjectString, path_d_exports as upath, upper, wrapRouteParameters, writeGeneratedFile, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
3121
+ export { AngularHttpResourceOptions, AngularOptions, BODY_TYPE_NAME, BaseUrlFromConstant, BaseUrlFromSpec, BaseUrlRuntime, BoundAliasInfo, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFileBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMockBuilder, ClientMockGeneratorBuilder, ClientMockGeneratorImplementation, ClientTitleBuilder, CommonMockOptions, Config, ConfigExternal, ConfigFn, ContentTypeFilter, ContextSpec, DeepNonNullable, DefaultTag, DynamicAnchorIndexEntry, DynamicScopeEntry, EffectOptions, EnumGeneration, ErrorWithTag, FactoryMethodsMode, FactoryMethodsOptions, FakerMockOptions, FetchOptions, FinalizeMockImplementationOptions, FormDataArrayHandling, FormDataContext, FormDataType, GenerateMockImports, GenerateVerbOptionsParams, GenerateVerbsOptionsParams, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMockOutput, GeneratorMockOutputFull, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalMockOptions, GlobalOptions, HeaderResult, HonoHandlerStrategy, HonoOptions, Hook, HookCommand, HookFunction, HookOption, HooksOptions, ImportOpenApi, InputFiltersOptions, InputOptions, InputTransformerFn, InvalidateTarget, InvalidateTargetParam, JsDocOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, McpOptions, McpServerOptions, MockData, MockDataArray, MockDataArrayFn, MockDataObject, MockDataObjectFn, MockOptions, MockProperties, MockPropertiesObject, MockPropertiesObjectFn, MswMockOptions, MutationInvalidatesConfig, MutationInvalidatesRule, Mutator, MutatorObject, NAMED_COMPONENT_SECTIONS, NamingConvention, NormalizedAngularOptions, NormalizedConfig, NormalizedEffectOptions, NormalizedFactoryMethodsOptions, NormalizedFetchOptions, NormalizedFormDataType, NormalizedHonoOptions, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedJsDocOptions, NormalizedMcpOptions, NormalizedMcpServerOptions, NormalizedMocksConfig, NormalizedMutator, NormalizedOperationOptions, NormalizedOperationZodOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, NormalizedSchemaOptions, NormalizedZodOptions, OpenApiComponentsObject, OpenApiDocument, OpenApiDynamicReferenceObject, OpenApiEncodingObject, OpenApiExampleObject, OpenApiInfoObject, OpenApiMediaTypeObject, OpenApiOperationObject, OpenApiParameterObject, OpenApiPathItemObject, OpenApiPathsObject, OpenApiReferenceObject, OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiResponsesObject, OpenApiSchemaObject, OpenApiSchemaObjectType, OpenApiSchemasObject, OpenApiServerObject, OperationOptions, OperationZodOptions, Options, OptionsExport, OptionsFn, OutputClient, OutputClientFunc, OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMocksConfig, OutputMocksOption, OutputMode, OutputOptions, OverrideInput, OverrideMockOptions, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, PreferredContentType, PropertySortOrder, QueryOptions, ReadonlyRequestBodiesMode, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ResponseTypeCategory, SHARED_DIR, ScalarValue, SchemaGenerationType, SchemaOptionLike, SchemaOptions, SchemaType, SharedTypeDeclaration, StrictMockSchemaKind, SupportedFormatter, SwrOptions, TEMPLATE_TAG_REGEX, TsConfigModule, TsConfigModuleResolution, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, WriteSpecBuilder, ZodCoerceType, ZodDateTimeOptions, ZodOptions, ZodTimeOptions, ZodVariantOption, ZodVersionOption, addDependency, asyncReduce, buildAngularParamsFilterExpression, buildDynamicScope, buildInlineDynamicScope, buildSchemaTagMap, camel, collectReferencedComponents, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, createTypeAliasIfNeeded, dedupeUnionType, dynamicAnchorToParamName, dynamicAnchorsToUniqueParamNames, dynamicImport, escape, escapeRegExp, extractBoundAliasInfo, filterByContentType, filteredVerbs, fixCrossDirectoryImports, fixRegularSchemaImports, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFactory, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbOptions, generateVerbsOptions, getAngularFilteredParamsCallExpression, getAngularFilteredParamsExpression, getAngularFilteredParamsHelperBody, getArray, getBaseUrlRuntimeImports, getBodiesByContentType, getBody, getCombinedEnumValue, getDefaultContentType, getDynamicAnchorIndex, getDynamicAnchorName, getEnum, getEnumDescriptions, getEnumImplementation, getEnumNames, getEnumUnionFromSchema, getExtension, getFileInfo, getFormDataFieldFileType, getFullRoute, getImportExtension, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOperationTagKey, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getPropertySafe, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getResponseTypeCategory, getRoute, getRouteAsArray, getScalar, getSchemasImportPath, getSuccessResponseType, getTagKey, getTypedResponse, getWarningCount, isBinaryContentType, isBinaryScalarSchema, isBoolean, isComponentRef, isDirectory, isDynamicReference, isFakerMock, isFunction, isModule, isMswMock, isNullish, isNumber, isNumeric, isObject, isOperationInTagBucket, isReference, isSchema, isString, isStringLike, isSyntheticDefaultImportsAllow, isUrl, isVerb, isVerbose, jsDoc, jsStringEscape, jsStringLiteralEscape, kebab, keyValuePairsToJsDoc, log, logError, logVerbose, logWarning, makeRouteSafe, mergeDeep, mismatchArgsMessage, pascal, removeFilesAndEmptyFolders, resetWarnings, resolveDiscriminators, resolveDynamicRef, resolveExampleRefs, resolveInstalledVersion, resolveInstalledVersions, resolveObject, resolveRef, resolveValue, sanitize, setVerbose, snake, sortByPriority, splitSchemasByType, startMessage, stringify, toObjectString, path_d_exports as upath, upper, wrapRouteParameters, writeGeneratedFile, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSchemasTagsSplit, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
2884
3122
  //# sourceMappingURL=index.d.mts.map