@orval/core 8.19.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
@@ -170,6 +170,7 @@ interface NormalizedOverrideOutput {
170
170
  }
171
171
  interface NormalizedMutator {
172
172
  path: string;
173
+ resolvedPath?: string;
173
174
  name?: string;
174
175
  default: boolean;
175
176
  alias?: Record<string, string>;
@@ -637,6 +638,7 @@ interface ZodTimeOptions {
637
638
  * to Zod 4 output.
638
639
  */
639
640
  type ZodVersionOption = 3 | 4 | 'auto';
641
+ type ZodVariantOption = 'classic' | 'mini';
640
642
  interface BaseZodOptions {
641
643
  strict?: {
642
644
  param?: boolean;
@@ -681,6 +683,12 @@ interface BaseZodOptions {
681
683
  useBrandedTypes?: boolean;
682
684
  }
683
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;
684
692
  /**
685
693
  * Pin the Zod output target so generation is deterministic instead of
686
694
  * inferred from the installed `zod` version. Defaults to `'auto'`, which
@@ -721,6 +729,7 @@ interface EffectOptions {
721
729
  }
722
730
  type ZodCoerceType = 'string' | 'number' | 'boolean' | 'bigint' | 'date' | 'array';
723
731
  interface NormalizedZodOptions {
732
+ variant: ZodVariantOption;
724
733
  version: ZodVersionOption;
725
734
  strict: {
726
735
  param: boolean;
@@ -988,14 +997,15 @@ type HookCommand = string | HookFunction | HookOption | (string | HookFunction |
988
997
  type NormalizedHookCommand = HookCommand[];
989
998
  type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
990
999
  type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
991
- type Verbs = 'post' | 'put' | 'get' | 'patch' | 'delete' | 'head';
1000
+ type Verbs = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch';
992
1001
  declare const Verbs: {
993
- POST: Verbs;
994
- PUT: Verbs;
995
1002
  GET: Verbs;
996
- PATCH: Verbs;
1003
+ PUT: Verbs;
1004
+ POST: Verbs;
997
1005
  DELETE: Verbs;
1006
+ OPTIONS: Verbs;
998
1007
  HEAD: Verbs;
1008
+ PATCH: Verbs;
999
1009
  };
1000
1010
  /**
1001
1011
  * Canonical tag name used for the generated bucket that collects untagged operations.
@@ -1021,6 +1031,14 @@ interface ContextSpec {
1021
1031
  * entries or generic parameter placeholders. Populated by `buildDynamicScope`.
1022
1032
  */
1023
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>;
1024
1042
  /**
1025
1043
  * Tracks array-item mock factory names already emitted per output file scope.
1026
1044
  * Populated by `@orval/mock` when `arrayItems: true` so shared `$ref` item
@@ -1060,6 +1078,25 @@ interface DynamicScopeEntry {
1060
1078
  isParameter?: boolean;
1061
1079
  inlineSchema?: OpenApiSchemaObject;
1062
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;
1099
+ }
1063
1100
  interface GlobalOptions {
1064
1101
  watch?: boolean | string | string[];
1065
1102
  verbose?: boolean;
@@ -2326,6 +2363,23 @@ declare function buildDynamicScope(schemaName: string, schema: OpenApiSchemaObje
2326
2363
  * resolving them would duplicate `buildDynamicScope`'s `$defs` logic.
2327
2364
  */
2328
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>;
2329
2383
  /**
2330
2384
  * Resolve a `$dynamicRef` anchor to its concrete type using the current dynamic scope.
2331
2385
  * Returns `{ schema: {}, resolvedTypeName: 'unknown' }` when no scope override exists.
@@ -3064,5 +3118,5 @@ declare function generateTargetForTags(builder: WriteSpecBuilder, options: Norma
3064
3118
  declare function getOrvalGeneratedTypes(): string;
3065
3119
  declare function getTypedResponse(): string;
3066
3120
  //#endregion
3067
- 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, 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, 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, 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 };
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 };
3068
3122
  //# sourceMappingURL=index.d.mts.map