@orval/mock 8.29.0 → 8.30.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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { EnumGeneration, OutputMockType, OutputMode, PropertySortOrder, camelPathParamName, compareNatural, compareVersions, escapeRegExp, generalJSTypesWithArray, generateDependencyImports, getKey, getOperationTagKey, getRefInfo, getRequiredKeys, isBoolean, isFunction, isMswMock, isNumber, isObject, isReference, isString, jsStringLiteralEscape, mergeDeep, pascal, resolveRef, stringify, toColonRoutePath } from "@orval/core";
1
+ import { EnumGeneration, OutputMockType, OutputMode, PropertySortOrder, camelPathParamName, compareNatural, compareVersions, escapeRegExp, generalJSTypesWithArray, generateDependencyImports, getKey, getOperationTagKey, getRefInfo, getRequiredKeys, isBoolean, isFunction, isMswMock, isNumber, isObject, isReference, isString, jsStringLiteralEscape, mergeDeep, pascal, resolveRef, safeNumericConstraint, stringify, toColonRoutePath } from "@orval/core";
2
2
  import { prop } from "remeda";
3
3
  //#region src/mock-types.ts
4
4
  function isStrictMock(mockOptions) {
@@ -911,18 +911,20 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
911
911
  case "number":
912
912
  case "integer": {
913
913
  const intFunction = context.output.override.useBigInt && (item.format === "int64" || item.format === "uint64") ? "bigInt" : "int";
914
- const numMin = typeof item.exclusiveMinimum === "number" ? item.exclusiveMinimum : item.minimum ?? safeMockOptions.numberMin;
915
- const numMax = typeof item.exclusiveMaximum === "number" ? item.exclusiveMaximum : item.maximum ?? safeMockOptions.numberMax;
914
+ const specMin = safeNumericConstraint(item.minimum, "minimum");
915
+ const specMax = safeNumericConstraint(item.maximum, "maximum");
916
+ const numMin = typeof item.exclusiveMinimum === "number" ? safeNumericConstraint(item.exclusiveMinimum, "exclusiveMinimum") : specMin ?? safeMockOptions.numberMin;
917
+ const numMax = typeof item.exclusiveMaximum === "number" ? safeNumericConstraint(item.exclusiveMaximum, "exclusiveMaximum") : specMax ?? safeMockOptions.numberMax;
916
918
  const intParts = [];
917
919
  if (numMin !== void 0) intParts.push(`min: ${numMin}`);
918
920
  if (numMax !== void 0) intParts.push(`max: ${numMax}`);
919
- if (isFakerV9 && item.multipleOf !== void 0) intParts.push(`multipleOf: ${item.multipleOf}`);
921
+ if (isFakerV9 && item.multipleOf !== void 0) intParts.push(`multipleOf: ${safeNumericConstraint(item.multipleOf, "multipleOf")}`);
920
922
  let value = getNullable(`faker.number.${intFunction}(${intParts.length > 0 ? `{${intParts.join(", ")}}` : ""})`, isNullable, nonNullableOption);
921
923
  if (type === "number") {
922
924
  const floatParts = [];
923
925
  if (numMin !== void 0) floatParts.push(`min: ${numMin}`);
924
926
  if (numMax !== void 0) floatParts.push(`max: ${numMax}`);
925
- if (isFakerV9 && item.multipleOf !== void 0) floatParts.push(`multipleOf: ${item.multipleOf}`);
927
+ if (isFakerV9 && item.multipleOf !== void 0) floatParts.push(`multipleOf: ${safeNumericConstraint(item.multipleOf, "multipleOf")}`);
926
928
  else if (safeMockOptions.fractionDigits !== void 0) floatParts.push(`fractionDigits: ${safeMockOptions.fractionDigits}`);
927
929
  value = getNullable(`faker.number.float(${floatParts.length > 0 ? `{${floatParts.join(", ")}}` : ""})`, isNullable, nonNullableOption);
928
930
  }
@@ -1027,8 +1029,8 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
1027
1029
  });
1028
1030
  if (extractedItemCall) mapValue = extractedItemCall;
1029
1031
  if (combine && !value.startsWith("faker") && !value.startsWith("{") && !value.startsWith("Array.from")) mapValue = `{${value}}`;
1030
- const arrSchemaMin = item.minItems;
1031
- const arrSchemaMax = item.maxItems;
1032
+ const arrSchemaMin = safeNumericConstraint(item.minItems, "minItems");
1033
+ const arrSchemaMax = safeNumericConstraint(item.maxItems, "maxItems");
1032
1034
  const arrGlobalMin = safeMockOptions.arrayMin;
1033
1035
  const arrGlobalMax = safeMockOptions.arrayMax;
1034
1036
  let arrMin;
@@ -1051,8 +1053,8 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
1051
1053
  };
1052
1054
  }
1053
1055
  case "string": {
1054
- const schemaMin = item.minLength;
1055
- const schemaMax = item.maxLength;
1056
+ const schemaMin = safeNumericConstraint(item.minLength, "minLength");
1057
+ const schemaMax = safeNumericConstraint(item.maxLength, "maxLength");
1056
1058
  const globalMin = safeMockOptions.stringMin;
1057
1059
  const globalMax = safeMockOptions.stringMax;
1058
1060
  let strMin;
@@ -1711,6 +1713,24 @@ function getMockOptionsDataOverride(operationTags, operationId, override) {
1711
1713
  }
1712
1714
  //#endregion
1713
1715
  //#region src/msw/index.ts
1716
+ /**
1717
+ * Resolves an OpenAPI response key to the numeric status the generated handler
1718
+ * emits.
1719
+ *
1720
+ * The key comes straight from the document and lands in an unquoted expression
1721
+ * position (`{ status: 200 }`), so there is no quote to escape and no way to
1722
+ * make a non-numeric value safe there — a key like
1723
+ * `2,x:(<expression>)` would splice live code into the handler. Parse it, and
1724
+ * refuse the document rather than emitting whatever it says.
1725
+ *
1726
+ * `default` maps to 200 and a `NXX` wildcard to `N00`, matching what the
1727
+ * handler previously emitted for those keys.
1728
+ */
1729
+ function assertSafeStatusCode(status) {
1730
+ const normalized = status === "default" ? "200" : /^\dXX$/.test(status) ? `${status[0]}00` : status;
1731
+ if (!/^\d{3}$/.test(normalized)) throw new Error(`orval: refusing to generate a mock handler for an OpenAPI response key that is not a status code (got "${status}"). This value would otherwise be emitted verbatim into generated source.`);
1732
+ return Number(normalized);
1733
+ }
1714
1734
  function getMSWDependencies(options) {
1715
1735
  const locale = options?.locale;
1716
1736
  const fakerDependency = {
@@ -1789,7 +1809,7 @@ function generateDefinition(name, route, getResponseMockFunctionNameBase, handle
1789
1809
  const binaryTypeRewriteRegex = new RegExp(String.raw`\b(?:${["Blob", ...binaryRefNames].map((n) => escapeRegExp(n)).join("|")})\b`, "g");
1790
1810
  const mockReturnType = isBinaryResponse ? returnType.replaceAll(binaryTypeRewriteRegex, "ArrayBuffer") : returnType;
1791
1811
  const isVoidUnionType = mockReturnType !== "void" && mockReturnType.split("|").some((part) => part.trim() === "void");
1792
- const noContentStatusCode = isVoidUnionType ? responses.find((r) => r.value === "void")?.key ?? "204" : void 0;
1812
+ const noContentStatusCode = isVoidUnionType ? assertSafeStatusCode(responses.find((r) => r.value === "void")?.key ?? "204") : void 0;
1793
1813
  const nonVoidMockReturnType = isVoidUnionType ? mockReturnType.split("|").filter((part) => part.trim() !== "void").join(" | ").trim() : mockReturnType;
1794
1814
  const hasJsonContentType = contentTypesByPreference.some((ct) => ct.includes("json") || ct.includes("+json"));
1795
1815
  const hasStringReturnType = isTypeExactlyString(mockReturnType) || isUnionContainingString(mockReturnType);
@@ -1824,7 +1844,7 @@ function generateDefinition(name, route, getResponseMockFunctionNameBase, handle
1824
1844
  const resolvedResponseExpr = `overrideResponse !== undefined
1825
1845
  ? (typeof overrideResponse === "function" ? await overrideResponse(${infoParam}) : overrideResponse)
1826
1846
  : ${getResponseMockFunctionName}()`;
1827
- const statusCode = status === "default" ? 200 : status.replace(/XX$/, "00");
1847
+ const statusCode = assertSafeStatusCode(status);
1828
1848
  const binaryContentType = (preferredContentTypeMatch && isBinaryLikeContentType(preferredContentTypeMatch) ? preferredContentTypeMatch : contentTypes.find((ct) => isBinaryLikeContentType(ct))) ?? "application/octet-stream";
1829
1849
  const firstTextCt = isExactlyStringReturnType && !!preferredContentTypeMatch && !isTextLikeContentType(preferredContentTypeMatch) && hasTextLikeContentType ? contentTypes.find((ct) => isTextLikeContentType(ct)) : contentTypesByPreference.find((ct) => isTextLikeContentType(ct));
1830
1850
  const textHelper = firstTextCt === "application/xml" || firstTextCt?.endsWith("+xml") ? "xml" : firstTextCt === "text/html" ? "html" : "text";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["getReferenceName","valWithRequired"],"sources":["../src/mock-types.ts","../src/faker/imports.ts","../src/delay.ts","../src/faker/getters/all-of-required.ts","../src/faker/compatible-v9.ts","../src/faker/constants.ts","../src/faker/getters/object.ts","../src/faker/getters/array-item-factory.ts","../src/faker/format-example-value.ts","../src/faker/getters/scalar.ts","../src/faker/resolvers/value.ts","../src/faker/getters/combine.ts","../src/faker/getters/route.ts","../src/msw/mocks.ts","../src/msw/index.ts","../src/faker/index.ts","../src/index.ts"],"sourcesContent":["import {\n escapeRegExp,\n type ContextSpec,\n type FinalizeMockImplementationOptions,\n type MockOptions,\n type OpenApiReferenceObject,\n type OpenApiSchemaObject,\n resolveRef,\n type ResReqTypesValue,\n type StrictMockSchemaKind,\n} from '@orval/core';\n\nexport type { StrictMockSchemaKind };\n\nexport function isStrictMock(\n mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>,\n): boolean {\n return Boolean(\n mockOptions && mockOptions.required && mockOptions.nonNullable,\n );\n}\n\nexport function getStrictMockTypeName(typeName: string): string {\n return `${typeName}Mock`;\n}\n\nexport function getStrictMockHelperTypeDeclarations(): string {\n return `export type KeysWithNull<O> = {\n [K in keyof O]-?: null extends O[K] ? K : never;\n}[keyof O];\n\nexport type MockWithNullableOverrides<\n T,\n O extends Partial<T>,\n M extends Record<keyof T, unknown>,\n> = Omit<M, Extract<KeysWithNull<O>, keyof T>> & {\n [K in Extract<KeysWithNull<O>, keyof T>]: M[K] | null;\n};`;\n}\n\nexport function isSchemaNullableAtRoot(schema?: OpenApiSchemaObject): boolean {\n if (!schema) {\n return false;\n }\n\n if (schema.nullable === true) {\n return true;\n }\n\n const type = schema.type;\n return Array.isArray(type) && type.includes('null');\n}\n\nexport function classifyStrictMockSchemaType(\n schema?: OpenApiSchemaObject,\n context?: ContextSpec,\n): StrictMockSchemaKind {\n if (!schema) {\n return 'object';\n }\n\n if (\n schema.format === 'binary' ||\n (schema.contentMediaType === 'application/octet-stream' &&\n !schema.contentEncoding)\n ) {\n return 'binary';\n }\n\n if (typeof schema.$ref === 'string') {\n if (context) {\n const { schema: resolved } = resolveRef(\n schema as OpenApiReferenceObject,\n context,\n );\n return classifyStrictMockSchemaType(\n resolved as OpenApiSchemaObject,\n context,\n );\n }\n\n return 'object';\n }\n\n if (\n schema.type === 'object' ||\n schema.properties ||\n isComposedObjectSchema(schema)\n ) {\n return 'object';\n }\n\n return 'alias';\n}\n\nfunction isComposedObjectSchema(schema: OpenApiSchemaObject): boolean {\n const branches = (schema.oneOf ?? schema.anyOf ?? schema.allOf) as\n | (OpenApiSchemaObject | OpenApiReferenceObject)[]\n | undefined;\n if (!branches?.length) {\n return false;\n }\n\n return branches.some((branch) => {\n const item = branch as OpenApiSchemaObject;\n if (\n typeof item.$ref === 'string' ||\n item.type === 'object' ||\n item.properties\n ) {\n return true;\n }\n\n return isComposedObjectSchema(item);\n });\n}\n\nexport function getStrictMockTypeDeclaration(\n typeName: string,\n kind: StrictMockSchemaKind = 'object',\n options?: { schemaNullableAtRoot?: boolean },\n): string {\n const mockTypeName = getStrictMockTypeName(typeName);\n\n if (kind === 'alias') {\n return `export type ${mockTypeName} = ${typeName};`;\n }\n\n if (kind === 'binary') {\n return `export type ${mockTypeName} = ArrayBuffer;`;\n }\n\n const mappedType = `{\\n [K in keyof Required<NonNullable<${typeName}>>]: NonNullable<Required<NonNullable<${typeName}>>[K]>;\\n}`;\n const objectMockType = options?.schemaNullableAtRoot\n ? `${mappedType} | null`\n : mappedType;\n\n return `export type ${mockTypeName} = ${objectMockType};`;\n}\n\nexport function getStrictMockTypeDeclarations(\n typeNames: Iterable<string>,\n kinds?: Readonly<Record<string, StrictMockSchemaKind>>,\n nullableAtRoot?: Readonly<Record<string, boolean>>,\n): string {\n const unique = [...new Set(typeNames)];\n if (unique.length === 0) {\n return '';\n }\n\n return unique\n .map((typeName) =>\n getStrictMockTypeDeclaration(typeName, kinds?.[typeName] ?? 'object', {\n schemaNullableAtRoot: nullableAtRoot?.[typeName],\n }),\n )\n .join('\\n\\n');\n}\n\nfunction strictMockResolvedImportMatches(\n typeName: string,\n resolvedImport: { name?: string; alias?: string } | undefined,\n importBareName?: string,\n): boolean {\n const resolvedName = resolvedImport?.name;\n if (!resolvedName) {\n return false;\n }\n\n if (typeName === resolvedName) {\n return true;\n }\n\n if (resolvedImport.alias && typeName === resolvedImport.alias) {\n return true;\n }\n\n return importBareName !== undefined && importBareName === resolvedName;\n}\n\nfunction resolveStrictMockSchemaForTypeName(\n typeName: string,\n originalSchema: OpenApiSchemaObject | undefined,\n context?: ContextSpec,\n importBareName?: string,\n): OpenApiSchemaObject | undefined {\n if (!originalSchema) {\n return undefined;\n }\n\n if (!context) {\n return originalSchema;\n }\n\n const branches = (originalSchema.oneOf ??\n originalSchema.anyOf ??\n originalSchema.allOf) as\n | (OpenApiSchemaObject | OpenApiReferenceObject)[]\n | undefined;\n\n if (branches?.length) {\n for (const branch of branches) {\n if (typeof branch.$ref !== 'string') {\n continue;\n }\n\n const resolved = resolveRef(branch as OpenApiReferenceObject, context);\n if (\n strictMockResolvedImportMatches(\n typeName,\n resolved.imports[0],\n importBareName,\n )\n ) {\n return resolved.schema as OpenApiSchemaObject;\n }\n }\n\n return undefined;\n }\n\n if (typeof originalSchema.$ref === 'string') {\n const resolved = resolveRef(\n originalSchema as OpenApiReferenceObject,\n context,\n );\n if (\n strictMockResolvedImportMatches(\n typeName,\n resolved.imports[0],\n importBareName,\n )\n ) {\n return resolved.schema as OpenApiSchemaObject;\n }\n\n return undefined;\n }\n\n return originalSchema;\n}\n\nexport function getMockFactoryReturnType(\n typeName: string,\n mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>,\n): string {\n return isStrictMock(mockOptions) ? getStrictMockTypeName(typeName) : typeName;\n}\n\nexport interface MockFactorySignatureParts {\n param: string;\n returnType: string;\n returnCast: string;\n}\n\nexport interface GetMockFactorySignaturePartsOptions {\n isOverridable?: boolean;\n overrideType?: string;\n}\n\nexport function getMockFactorySignatureParts(\n typeName: string,\n mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>,\n options: GetMockFactorySignaturePartsOptions = {},\n): MockFactorySignatureParts {\n const isOverridable = options.isOverridable ?? false;\n const overrideType = options.overrideType ?? `Partial<${typeName}>`;\n const mockTypeName = getStrictMockTypeName(typeName);\n\n if (!isOverridable) {\n return {\n param: '',\n returnType: getMockFactoryReturnType(typeName, mockOptions),\n returnCast: '',\n };\n }\n\n if (isStrictMock(mockOptions)) {\n return {\n param: `<O extends ${overrideType} = {}>(overrideResponse?: O)`,\n returnType: `MockWithNullableOverrides<${typeName}, O, ${mockTypeName}>`,\n returnCast: ` as MockWithNullableOverrides<${typeName}, O, ${mockTypeName}>`,\n };\n }\n\n return {\n param: `overrideResponse: ${overrideType} = {}`,\n returnType: typeName,\n returnCast: '',\n };\n}\n\nexport function getSimpleSchemaReturnType(\n returnType: string,\n schemaTypeNames: string[],\n): string | undefined {\n const trimmed = returnType.trim();\n return schemaTypeNames.includes(trimmed) ? trimmed : undefined;\n}\n\nexport function formatMockFactoryDeclaration(\n factoryName: string,\n param: string,\n returnType: string,\n body: string,\n returnCast: string,\n options?: { omitReturnType?: boolean; terminateStatement?: boolean },\n): string {\n const header = param\n ? param.startsWith('<')\n ? `export const ${factoryName} = ${param}`\n : `export const ${factoryName} = (${param})`\n : `export const ${factoryName} = ()`;\n\n const returnTypeAnnotation =\n options?.omitReturnType || !returnType ? '' : `: ${returnType}`;\n\n const statementTerminator =\n returnCast || options?.terminateStatement ? ';' : '';\n\n return `${header}${returnTypeAnnotation} => (${body})${returnCast}${statementTerminator}`;\n}\n\nexport function getSchemaTypeNamesFromResponses(\n responses: ResReqTypesValue[],\n): string[] {\n const names = new Set<string>();\n\n for (const response of responses) {\n for (const imp of response.imports) {\n if (imp.values || imp.schemaFactory) {\n continue;\n }\n\n const importName = imp.alias ?? imp.name;\n if (/^[A-Z]\\w*$/.test(importName)) {\n names.add(importName);\n }\n }\n\n const { value } = response;\n if (!value) {\n continue;\n }\n\n const baseType = value.endsWith('[]') ? value.slice(0, -2) : value;\n if (/^[A-Z]\\w*$/.test(baseType)) {\n names.add(baseType);\n }\n }\n\n return [...names];\n}\n\nexport function getStrictMockSchemaKindsFromResponses(\n responses: ResReqTypesValue[],\n context?: ContextSpec,\n): Record<string, StrictMockSchemaKind> {\n const kinds: Record<string, StrictMockSchemaKind> = {};\n\n for (const response of responses) {\n for (const imp of response.imports) {\n if (imp.values || imp.schemaFactory) {\n continue;\n }\n\n const importName = imp.alias ?? imp.name;\n if (!/^[A-Z]\\w*$/.test(importName)) {\n continue;\n }\n\n const schemaForImport = resolveStrictMockSchemaForTypeName(\n importName,\n response.originalSchema,\n context,\n imp.name,\n );\n if (!schemaForImport) {\n continue;\n }\n\n kinds[importName] = classifyStrictMockSchemaType(\n schemaForImport,\n context,\n );\n }\n\n const { value } = response;\n if (!value || !response.originalSchema) {\n continue;\n }\n\n const baseType = value.endsWith('[]') ? value.slice(0, -2) : value;\n if (!/^[A-Z]\\w*$/.test(baseType)) {\n continue;\n }\n\n const schema = response.originalSchema;\n if (value.endsWith('[]') && schema.type === 'array' && schema.items) {\n const items = schema.items as OpenApiSchemaObject;\n kinds[baseType] = classifyStrictMockSchemaType(items, context);\n continue;\n }\n\n const schemaForType =\n resolveStrictMockSchemaForTypeName(\n baseType,\n response.originalSchema,\n context,\n ) ?? response.originalSchema;\n kinds[baseType] = classifyStrictMockSchemaType(schemaForType, context);\n }\n\n return kinds;\n}\n\nexport function buildStrictMockTypeFileHeader(\n schemaTypeNames: Iterable<string>,\n kinds?: Readonly<Record<string, StrictMockSchemaKind>>,\n): string {\n const uniqueSchemaNames = [...new Set(schemaTypeNames)];\n const schemaBlock = getStrictMockTypeDeclarations(uniqueSchemaNames, kinds);\n\n return [getStrictMockHelperTypeDeclarations(), schemaBlock]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Prepends shared strict-mock helper types and each `{Schema}Mock` alias once at\n * the top of a mock file. Generators pass `strictSchemaTypeNames`; no scraping.\n *\n * Not idempotent — callers must invoke this exactly once per aggregated mock\n * file (writers and `writeFakerSchemaMocks`), not from import hooks.\n */\nexport function dedupeStrictMockTypeDeclarations(\n implementation: string,\n options: FinalizeMockImplementationOptions = {},\n): string {\n if (!isStrictMock(options.mockOptions)) {\n return implementation;\n }\n\n const schemaTypeNames = options.strictSchemaTypeNames\n ? [...new Set(options.strictSchemaTypeNames)]\n : [];\n if (schemaTypeNames.length === 0) {\n return implementation;\n }\n\n const header = buildStrictMockTypeFileHeader(\n schemaTypeNames,\n options.strictMockSchemaKinds,\n );\n\n return `${header}\\n\\n${implementation.trimStart()}`;\n}\n\nexport function applyStrictMockReturnType(\n returnType: string,\n schemaTypeNames: string[],\n): string {\n if (schemaTypeNames.length === 0) {\n return returnType;\n }\n\n let result = returnType;\n const sorted = [...schemaTypeNames].toSorted((a, b) => b.length - a.length);\n\n for (const name of sorted) {\n result = result.replaceAll(\n new RegExp(String.raw`\\b${escapeRegExp(name)}\\b`, 'g'),\n getStrictMockTypeName(name),\n );\n }\n\n return result;\n}\n\nconst STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDES =\n /MockWithNullableOverrides<([A-Z]\\w*),/g;\nconst STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDE_ALIAS =\n /MockWithNullableOverrides<[^,]+,\\s*[^,]+,\\s*([A-Z]\\w*Mock)>/g;\nconst STRICT_MOCK_SCHEMA_TYPE_FROM_MOCK_ALIAS_RETURN =\n /\\): ([A-Z]\\w*Mock)(?:\\[\\]|;)/g;\n\n/** Inverse of {@link getStrictMockTypeName}: `PetMock` → `Pet`, `WidgetMockMock` → `WidgetMock`. */\nfunction getSchemaTypeNameFromStrictMockAlias(alias: string): string {\n return alias.endsWith('Mock') ? alias.slice(0, -4) : alias;\n}\n\n/**\n * Collect schema type names referenced by strict mock factories in generated\n * implementation text (nested split factories, array item helpers, etc.).\n *\n * This reverse-parses emitted factory syntax and is therefore coupled to the\n * current `formatMockFactoryDeclaration` / `getMockFactorySignatureParts`\n * shape. The structurally robust alternative is to record each nested item's\n * schema name where split factories are generated (array-item / faker getters,\n * where the `$ref` name is known) and thread it into `strictMockSchemaTypeNames`.\n */\nexport function collectStrictMockSchemaTypeNamesFromImplementation(\n implementation: string,\n): string[] {\n const names = new Set<string>();\n\n for (const match of implementation.matchAll(\n STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDES,\n )) {\n names.add(match[1]);\n }\n\n for (const pattern of [\n STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDE_ALIAS,\n STRICT_MOCK_SCHEMA_TYPE_FROM_MOCK_ALIAS_RETURN,\n ]) {\n for (const match of implementation.matchAll(pattern)) {\n names.add(getSchemaTypeNameFromStrictMockAlias(match[1]));\n }\n }\n\n return [...names];\n}\n\nexport function mergeStrictMockSchemaTypeNames(\n ...groups: Array<Iterable<string> | undefined>\n): string[] | undefined {\n const names = new Set<string>();\n\n for (const group of groups) {\n if (!group) continue;\n for (const name of group) {\n names.add(name);\n }\n }\n\n return names.size > 0 ? [...names] : undefined;\n}\n\nexport function mergeStrictMockSchemaKinds(\n ...groups: Array<Readonly<Record<string, StrictMockSchemaKind>> | undefined>\n): Record<string, StrictMockSchemaKind> | undefined {\n const merged: Record<string, StrictMockSchemaKind> = {};\n\n for (const group of groups) {\n if (!group) continue;\n for (const [name, kind] of Object.entries(group)) {\n merged[name] ??= kind;\n }\n }\n\n return Object.keys(merged).length > 0 ? merged : undefined;\n}\n","import type { GeneratorImport } from '@orval/core';\n\n/**\n * Appends entries added to `source` since `sinceIndex`. Uses indexed push\n * instead of spread so large import batches (common with `schemas: true`\n * delegation on wide objects) do not overflow the call stack.\n */\nexport function appendImportsDelta(\n target: GeneratorImport[],\n source: GeneratorImport[],\n sinceIndex: number,\n): void {\n for (let i = sinceIndex; i < source.length; i++) {\n target.push(source[i]!);\n }\n}\n\n/**\n * Merge imports returned from mock resolution when the shared imports array\n * was not mutated in place. Enum mocks and nested object factories return\n * their imports separately; schema-factory delegation mutates `sharedImports`\n * directly and must not be merged again from `resolvedImports`.\n */\nexport function mergeReturnedMockImports(\n sharedImports: GeneratorImport[],\n sharedBefore: number,\n resolvedImports: GeneratorImport[],\n): void {\n if (sharedImports.length === sharedBefore) {\n appendImportsDelta(sharedImports, resolvedImports, 0);\n }\n}\n\n/** Recover type imports referenced by nested oneOf split mock helpers. */\nexport function collectSplitMockTypeImports(\n implementations: readonly string[],\n): GeneratorImport[] {\n const seen = new Set<string>();\n const imports: GeneratorImport[] = [];\n\n const addType = (name: string | undefined) => {\n if (!name || seen.has(name)) return;\n seen.add(name);\n imports.push({ name, values: false });\n };\n\n for (const impl of implementations) {\n for (const match of impl.matchAll(\n /export const get\\w+Mock = \\(\\s*overrideResponse: Partial<(\\w+)[^)]*\\):\\s*(\\w+)\\s*=>/g,\n )) {\n addType(match[1]);\n addType(match[2]);\n }\n\n for (const match of impl.matchAll(\n /export const get\\w+Mock[\\s\\S]*?MockWithNullableOverrides<(?:Extract<(\\w+),[^>]+>|(\\w+)),/g,\n )) {\n addType(match[1] ?? match[2]);\n }\n }\n\n return imports;\n}\n","import {\n type GlobalMockOptions,\n isBoolean,\n isFunction,\n isMswMock,\n isNumber,\n type MswMockOptions,\n type NormalizedOverrideOutput,\n} from '@orval/core';\n\nexport const getDelay = (\n override?: NormalizedOverrideOutput,\n options?: GlobalMockOptions,\n): MswMockOptions['delay'] => {\n // `delay` and `delayFunctionLazyExecute` are MSW-only. Narrow the\n // discriminated `GlobalMockOptions` union (and the partial override\n // counterpart) before reading them.\n const mswOptions = options && isMswMock(options) ? options : undefined;\n const overrideMock = override?.mock as Partial<MswMockOptions> | undefined;\n const overrideDelay = overrideMock?.delay ?? mswOptions?.delay;\n const delayFunctionLazyExecute =\n overrideMock?.delayFunctionLazyExecute ??\n mswOptions?.delayFunctionLazyExecute;\n if (isFunction(overrideDelay)) {\n return delayFunctionLazyExecute ? overrideDelay : overrideDelay();\n }\n if (isNumber(overrideDelay) || isBoolean(overrideDelay)) {\n return overrideDelay;\n }\n return false;\n};\n","import {\n type ContextSpec,\n getRefInfo,\n isReference,\n type OpenApiSchemaObject,\n} from '@orval/core';\nimport { prop } from 'remeda';\n\nimport type { MockSchema } from '../../types';\n\n// Resolve a `$ref` (following `$ref`-to-`$ref` alias chains, like the model\n// side's `derefComponentSchema`) to its target schema. `seen` holds the refs\n// on the current traversal path and breaks cycles; returns undefined for\n// unresolvable or already-visited refs.\nfunction derefAllOfMember(\n member: MockSchema,\n context: ContextSpec,\n seen: Set<string>,\n): Partial<OpenApiSchemaObject> | undefined {\n let current: unknown = member;\n\n while (current && typeof current === 'object' && isReference(current)) {\n const ref = current.$ref;\n if (typeof ref !== 'string' || seen.has(ref)) {\n return undefined;\n }\n seen.add(ref);\n const { refPaths } = getRefInfo(ref, context);\n current = Array.isArray(refPaths)\n ? prop(\n context.spec,\n // @ts-expect-error: refPaths are not guaranteed to be valid keys of the spec\n ...refPaths,\n )\n : undefined;\n }\n\n return current && typeof current === 'object'\n ? (current as Partial<OpenApiSchemaObject>)\n : undefined;\n}\n\n// `allOf` makes `required` the union across every member, including `$ref`'d\n// ones (resolved through alias chains and nested `allOf`, cycle-guarded by\n// `seen`) and constraint-only members (`{ required: [...] }` alone, #3750).\n//\n// Boundary filter: names collected from a nested composition count only when\n// that composition also declares the property. The generated types work the\n// same way (core getters/combine.ts, #3663), and collecting more than the\n// model requires would flip the #910 cyclic-reference guard from omission to\n// `key: null` on a property the type keeps optional. Direct members are\n// exempt: their `required` applies to the composition being emitted now.\n//\n// Returns the declared property names alongside `required` so callers one\n// level up can apply the same boundary filter.\nexport function collectAllOfRequiredWithDeclared(\n schemas: MockSchema[],\n context: ContextSpec,\n seen: Set<string>,\n): { required: string[]; declared: Set<string> } {\n const required: string[] = [];\n const declared = new Set<string>();\n\n for (const val of schemas) {\n // Branch-local copy: the cycle guard is scoped to the current traversal\n // path, not shared across sibling members. A target first visited inside\n // one member's nested chain (where the boundary filter may drop its\n // undeclared names) must still be visitable as a later DIRECT member,\n // whose `required` counts unfiltered. Termination is preserved because a\n // ref still cannot repeat within a single path. Same pattern as\n // `resolvesToObjectLike` in resolvers/value.ts.\n const memberSeen = new Set(seen);\n const schema = derefAllOfMember(val, context, memberSeen);\n if (!schema) {\n continue;\n }\n\n const properties = schema.properties as Record<string, unknown> | undefined;\n if (properties && typeof properties === 'object') {\n for (const key of Object.keys(properties)) {\n declared.add(key);\n }\n }\n\n if (Array.isArray(schema.required)) {\n required.push(...(schema.required as string[]));\n }\n\n if (Array.isArray(schema.allOf)) {\n const inner = collectAllOfRequiredWithDeclared(\n schema.allOf as MockSchema[],\n context,\n memberSeen,\n );\n required.push(\n ...inner.required.filter(\n (name) =>\n inner.declared.has(name) || (properties && name in properties),\n ),\n );\n for (const key of inner.declared) {\n declared.add(key);\n }\n }\n }\n\n return { required, declared };\n}\n\nexport function collectAllOfRequired(\n schemas: MockSchema[],\n context: ContextSpec,\n): string[] {\n return collectAllOfRequiredWithDeclared(schemas, context, new Set()).required;\n}\n","import { compareVersions, type PackageJson } from '@orval/core';\n\nconst getFakerPackageVersion = (packageJson: PackageJson) => {\n return (\n packageJson.resolvedVersions?.['@faker-js/faker'] ??\n packageJson.dependencies?.['@faker-js/faker'] ??\n packageJson.devDependencies?.['@faker-js/faker'] ??\n packageJson.peerDependencies?.['@faker-js/faker']\n );\n};\n\nexport const isFakerVersionV9 = (packageJson: PackageJson) => {\n const version = getFakerPackageVersion(packageJson);\n\n if (!version) {\n return false;\n }\n\n const withoutRc = version.split('-')[0];\n\n return compareVersions(withoutRc, '9.0.0');\n};\n","import type { OpenApiSchemaObject } from '@orval/core';\n\nexport const DEFAULT_FORMAT_MOCK: Record<\n Required<Extract<OpenApiSchemaObject, object>>['format'],\n string\n> = {\n bic: 'faker.finance.bic()',\n binary: 'new ArrayBuffer(faker.number.int({ min: 1, max: 64 }))',\n city: 'faker.location.city()',\n country: 'faker.location.country()',\n date: 'faker.date.past().toISOString().slice(0, 10)',\n 'date-time': \"faker.date.past().toISOString().slice(0, 19) + 'Z'\",\n email: 'faker.internet.email()',\n firstName: 'faker.person.firstName()',\n gender: 'faker.person.gender()',\n iban: 'faker.finance.iban()',\n ipv4: 'faker.internet.ipv4()',\n ipv6: 'faker.internet.ipv6()',\n jobTitle: 'faker.person.jobTitle()',\n lastName: 'faker.person.lastName()',\n password: 'faker.internet.password()',\n phoneNumber: 'faker.phone.number()',\n streetName: 'faker.location.street()',\n uri: 'faker.internet.url()',\n url: 'faker.internet.url()',\n userName: 'faker.internet.userName()',\n uuid: 'faker.string.uuid()',\n zipCode: 'faker.location.zipCode()',\n};\n\n// #980 replace CUID so tests are consistent\nexport const DEFAULT_OBJECT_KEY_MOCK = 'faker.string.alphanumeric(5)';\n","import {\n compareNatural,\n type ContextSpec,\n type GeneratorImport,\n getKey,\n getRefInfo,\n isReference,\n type MockOptions,\n type OpenApiReferenceObject,\n type OpenApiSchemaObject,\n PropertySortOrder,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { DEFAULT_OBJECT_KEY_MOCK } from '../constants';\nimport {\n resolveMockValue,\n getNullable,\n isNullableSchema,\n resolveRefTarget,\n} from '../resolvers/value';\nimport { mergeReturnedMockImports } from '../imports';\nimport { combineSchemasMock } from './combine';\n\nexport const overrideVarName = 'overrideResponse';\n\nfunction wrapRootNullableObjectValue(\n value: string,\n schemaItem: MockSchemaObject,\n mockOptions: MockOptions | undefined,\n combine?: GetMockObjectOptions['combine'],\n): { value: string; nullWrapped: boolean } {\n const nullableAtRoot =\n !combine && isNullableSchema(schemaItem) && !mockOptions?.nonNullable;\n\n return {\n value: nullableAtRoot ? getNullable(value, true) : value,\n nullWrapped: nullableAtRoot,\n };\n}\n\nfunction getReferenceName(\n ref: string | undefined,\n context: ContextSpec,\n): string {\n if (!ref) return '';\n\n return getRefInfo(ref, context).name;\n}\n\nfunction isNullableRefTarget(\n ref: string | undefined,\n context: ContextSpec,\n): boolean {\n return isNullableSchema(resolveRefTarget(ref, context));\n}\n\n// One-hop lookahead before re-expanding a recursive ref: when the target's\n// own required refs already sit on the path and cannot be nulled, the\n// re-expansion can only end in casts, so skip the wasted work.\nfunction reExpansionWouldCollapse(\n ref: string | undefined,\n context: ContextSpec,\n existingReferencedProperties: string[],\n nonNullable: boolean | undefined,\n): boolean {\n const target = resolveRefTarget(ref, context);\n const targetProperties = target?.properties as\n | Record<string, OpenApiReferenceObject | OpenApiSchemaObject>\n | undefined;\n const targetRequired = target?.required as string[] | undefined;\n if (!targetProperties || !Array.isArray(targetRequired)) return false;\n\n return Object.entries(targetProperties).some(([key, property]) => {\n if (!targetRequired.includes(key) || !isReference(property)) return false;\n if (\n !existingReferencedProperties.includes(\n getReferenceName(property.$ref, context),\n )\n ) {\n return false;\n }\n return nonNullable || !isNullableRefTarget(property.$ref, context);\n });\n}\n\ninterface GetMockObjectOptions {\n item: MockSchemaObject;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Tracks the current contiguous `allOf` composition to break cyclic\n // inheritance. See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}\n\nexport function getMockObject({\n item,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n allowOverride = false,\n}: GetMockObjectOptions): MockDefinition {\n if (isReference(item)) {\n return resolveMockValue({\n schema: {\n ...item,\n name: item.name,\n path: item.path ? `${item.path}.${item.name}` : item.name,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n }\n\n const schemaItem = item as MockSchemaObject & Record<string, unknown>;\n const itemAllOf = schemaItem.allOf as MockSchema[] | undefined;\n const itemOneOf = schemaItem.oneOf as MockSchema[] | undefined;\n const itemAnyOf = schemaItem.anyOf as MockSchema[] | undefined;\n const itemType = schemaItem.type as string | string[] | undefined;\n const itemProperties = schemaItem.properties as\n | Record<string, OpenApiReferenceObject | OpenApiSchemaObject>\n | undefined;\n const itemRequired = schemaItem.required as string[] | undefined;\n const itemAdditionalProperties = schemaItem.additionalProperties as\n | boolean\n | OpenApiReferenceObject\n | OpenApiSchemaObject\n | undefined;\n\n if (itemAllOf || itemOneOf || itemAnyOf) {\n const separator = itemAllOf ? 'allOf' : itemOneOf ? 'oneOf' : 'anyOf';\n return combineSchemasMock({\n item: schemaItem,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n }\n\n if (Array.isArray(itemType)) {\n const nonNullTypes = mockOptions?.nonNullable\n ? itemType.filter((type) => type !== 'null')\n : itemType;\n\n if (nonNullTypes.length === 0) {\n return { value: 'null', imports: [], name: schemaItem.name };\n }\n\n if (nonNullTypes.length === 1) {\n return getMockObject({\n item: {\n ...schemaItem,\n type: nonNullTypes[0],\n } as MockSchemaObject & Record<string, unknown>,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n }\n\n // Spread the base schema into each type entry so that object properties\n // (e.g. `properties`, `required`, `additionalProperties`) are preserved.\n // Without this, `{ type: \"object\", properties: {...} }` collapses to\n // `{ type: \"object\" }` and the mock generator returns `{}` instead of\n // building the actual object shape. Mirrors the fix in core getters/object.ts.\n const isPropertylessObject =\n !itemProperties &&\n (!itemRequired || itemRequired.length === 0) &&\n !itemAdditionalProperties;\n\n if (\n isPropertylessObject &&\n nonNullTypes.includes('object') &&\n nonNullTypes.includes('null') &&\n nonNullTypes.every((type) => type === 'object' || type === 'null')\n ) {\n if (mockOptions?.nonNullable) {\n return { value: '{}', imports: [], name: schemaItem.name };\n }\n\n return {\n value: 'faker.helpers.arrayElement([{}, null])',\n imports: [],\n name: schemaItem.name,\n };\n }\n\n const baseItem = schemaItem as Record<string, unknown>;\n return combineSchemasMock({\n item: {\n anyOf: nonNullTypes.map((type) => ({\n ...baseItem,\n type,\n })) as unknown as MockSchema[],\n name: schemaItem.name,\n },\n separator: 'anyOf',\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n }\n\n if (itemProperties) {\n let value =\n !combine || combine.separator === 'oneOf' || combine.separator === 'anyOf'\n ? '{'\n : '';\n const imports: GeneratorImport[] = [];\n const includedProperties: string[] = [];\n\n const entries = Object.entries(itemProperties);\n if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n entries.sort((a, b) => {\n return compareNatural(a[0], b[0]);\n });\n }\n const propertyScalars = entries\n .map(\n ([key, prop]: [\n string,\n OpenApiReferenceObject | OpenApiSchemaObject,\n ]) => {\n if (combine?.includedProperties.includes(key)) {\n return;\n }\n\n const isRequired =\n mockOptions?.required ??\n (Array.isArray(itemRequired) ? itemRequired : []).includes(key);\n\n const hasNullable = 'nullable' in prop && prop.nullable === true;\n\n const refName = isReference(prop)\n ? getReferenceName(prop.$ref, context)\n : '';\n const isRecursiveRef =\n !!refName && existingReferencedProperties.includes(refName);\n\n // Recursive $ref. Optional properties are dropped, nullable ones\n // keep null. The rest expands one more level, letting the deeper\n // array/union guards close the cycle with a typed stub. One\n // re-expansion per path, and none when it could only end in casts:\n // an all-required cycle has no finite value, and unbounded\n // re-expansion blows up on dense specs.\n if (isRecursiveRef) {\n if (!isRequired) {\n return;\n }\n const keyDefinition = getKey(key);\n if (\n !mockOptions?.nonNullable &&\n (hasNullable ||\n (isReference(prop) && isNullableRefTarget(prop.$ref, context)))\n ) {\n return `${keyDefinition}: null`;\n }\n const inReExpansion =\n new Set(existingReferencedProperties).size !==\n existingReferencedProperties.length;\n if (\n inReExpansion ||\n (isReference(prop) &&\n reExpansionWouldCollapse(\n prop.$ref,\n context,\n existingReferencedProperties,\n mockOptions?.nonNullable,\n ))\n ) {\n imports.push({ name: refName });\n return `${keyDefinition}: {} as unknown as ${refName}`;\n }\n }\n\n const importsBefore = imports.length;\n const resolvedValue = resolveMockValue({\n schema: {\n ...(prop as Record<string, unknown>),\n name: key,\n parentName: schemaItem.name,\n path: schemaItem.path ? `${schemaItem.path}.${key}` : `#.${key}`,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n // A property value is a fresh mock instance, not part of this\n // object's allOf composition — reset the chain.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs: [],\n splitMockImplementations,\n });\n\n mergeReturnedMockImports(\n imports,\n importsBefore,\n resolvedValue.imports,\n );\n\n includedProperties.push(key);\n\n const keyDefinition = getKey(key);\n\n // A required $ref union whose variants were all recursively\n // skipped resolves to undefined; cast it to satisfy the type.\n if (isRequired && refName && resolvedValue.value === 'undefined') {\n imports.push({ name: refName });\n return `${keyDefinition}: undefined as unknown as ${refName}`;\n }\n\n // A re-expansion that still needed casts gained nothing over\n // casting here directly, so keep the smaller form.\n if (\n isRequired &&\n isRecursiveRef &&\n resolvedValue.value.includes(' as unknown as ')\n ) {\n imports.push({ name: refName });\n return `${keyDefinition}: {} as unknown as ${refName}`;\n }\n\n const hasDefault = 'default' in prop && prop.default !== undefined;\n\n if (!isRequired && !resolvedValue.overrided && !hasDefault) {\n const omitValue =\n mockOptions?.nonNullable || !hasNullable ? 'undefined' : 'null';\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, ${omitValue}])`;\n }\n\n const isNullable =\n Array.isArray(prop.type) && prop.type.includes('null');\n if (\n isNullable &&\n !resolvedValue.nullWrapped &&\n !resolvedValue.overrided &&\n !mockOptions?.nonNullable\n ) {\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, null])`;\n }\n\n return `${keyDefinition}: ${resolvedValue.value}`;\n },\n )\n .filter(Boolean);\n\n if (allowOverride) {\n propertyScalars.push(`...${overrideVarName}`);\n }\n\n value += propertyScalars.join(', ');\n value +=\n !combine || combine.separator === 'oneOf' || combine.separator === 'anyOf'\n ? '}'\n : '';\n\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n value,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n value: finalValue,\n nullWrapped,\n imports,\n name: schemaItem.name,\n includedProperties,\n };\n }\n\n if (itemAdditionalProperties) {\n if (itemAdditionalProperties === true) {\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n `{}`,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n value: finalValue,\n nullWrapped,\n imports: [],\n name: schemaItem.name,\n };\n }\n const additionalProperties = itemAdditionalProperties;\n if (\n isReference(additionalProperties) &&\n existingReferencedProperties.includes(\n getReferenceName(additionalProperties.$ref, context),\n )\n ) {\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n `{}`,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n value: finalValue,\n nullWrapped,\n imports: [],\n name: schemaItem.name,\n };\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...additionalProperties,\n name: schemaItem.name,\n path: schemaItem.path ? `${schemaItem.path}.#` : '#',\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n // An additionalProperties value is a fresh mock instance — reset the\n // chain, as with property values above.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs: [],\n splitMockImplementations,\n });\n\n const objectValue = `{\n [${DEFAULT_OBJECT_KEY_MOCK}]: ${resolvedValue.value}\n }`;\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n objectValue,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n ...resolvedValue,\n value: finalValue,\n nullWrapped,\n };\n }\n\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n '{}',\n schemaItem,\n mockOptions,\n combine,\n );\n\n return { value: finalValue, nullWrapped, imports: [], name: schemaItem.name };\n}\n","import {\n type ContextSpec,\n type GeneratorImport,\n getOperationTagKey,\n getRefInfo,\n isFunction,\n isReference,\n type OpenApiSchemaObject,\n OutputMockType,\n OutputMode,\n pascal,\n resolveRef,\n} from '@orval/core';\n\nimport {\n formatMockFactoryDeclaration,\n getMockFactorySignatureParts,\n getStrictMockTypeName,\n isStrictMock,\n} from '../../mock-types';\nimport type { MockSchema } from '../../types';\nimport { overrideVarName } from './object';\nimport { extractItemsRef } from './scalar';\n\n/**\n * Scope key for file-level array-item factory dedup. Must match how writers\n * group mock output: one bucket per tag file in tags modes, one bucket per\n * operation file in the tags-operations modes (each operation gets its own\n * mock file), otherwise one bucket for the whole target.\n */\nexport function getArrayItemMockFileScope(\n context: ContextSpec,\n tags: string[],\n operationId?: string,\n): string {\n const mode = context.output.mode;\n const mockType = context.activeMockOutputType ?? OutputMockType.MSW;\n let base: string;\n if (\n mode === OutputMode.TAGS_OPERATIONS ||\n mode === OutputMode.TAGS_OPERATIONS_SPLIT\n ) {\n base = `operation:${operationId ?? ''}`;\n } else if (mode === OutputMode.TAGS || mode === OutputMode.TAGS_SPLIT) {\n base = `tag:${getOperationTagKey({ tags })}`;\n } else if (mode === OutputMode.SPLIT) {\n base = 'split';\n } else {\n base = 'single';\n }\n return `${base}:${mockType}`;\n}\n\nfunction getFileLevelExtractedFactories(\n context: ContextSpec,\n scope: string,\n): Set<string> {\n context.arrayItemMockFactories ??= new Map();\n const existing = context.arrayItemMockFactories.get(scope);\n if (existing) {\n return existing;\n }\n const factories = new Set<string>();\n context.arrayItemMockFactories.set(scope, factories);\n return factories;\n}\n\n/**\n * True when any mock generator entry opts into reusable array-item mock\n * factories for object-like array item schemas in operation responses.\n */\nexport function shouldExtractArrayItemFactories(context: ContextSpec): boolean {\n return context.output.mock.generators.some(\n (g) => !isFunction(g) && g.arrayItems === true,\n );\n}\n\n/**\n * True when `schemas: true` already emits a consolidated factory for this\n * `$ref` item under `components/schemas`, so we must not re-export it from\n * the operation mock file.\n */\nfunction hasConsolidatedSchemaFactory(\n items: MockSchema,\n context: ContextSpec,\n): boolean {\n if (!context.output.schemas) {\n return false;\n }\n\n const itemsRef = extractItemsRef(items);\n if (!itemsRef) {\n return false;\n }\n\n const { refPaths } = getRefInfo(itemsRef, context);\n const isComponentsSchema =\n Array.isArray(refPaths) &&\n refPaths[0] === 'components' &&\n refPaths[1] === 'schemas';\n\n if (!isComponentsSchema) {\n return false;\n }\n\n return context.output.mock.generators.some(\n (g) =>\n !isFunction(g) && g.type === OutputMockType.FAKER && g.schemas === true,\n );\n}\n\n/**\n * True when `parentName` looks like a nested property key rather than the\n * generated response wrapper type (e.g. `outer` vs `GetTenants200`). Inlining\n * avoids factory/type-name collisions and mismatched `<Parent><Prop>Item` aliases.\n */\nfunction isAmbiguousInlineItemContext(\n operationId: string,\n parentName?: string,\n): boolean {\n if (!parentName) {\n return false;\n }\n\n return !parentName.toLowerCase().includes(operationId.toLowerCase());\n}\n\nfunction isNullableArrayItem(schema: OpenApiSchemaObject): boolean {\n if (schema.nullable === true) {\n return true;\n }\n\n return Array.isArray(schema.type) && schema.type.includes('null');\n}\n\nfunction isResolvedSchemaObjectLike(schema: OpenApiSchemaObject): boolean {\n if (schema.type === 'object' || schema.properties) {\n return true;\n }\n\n if (schema.allOf) {\n return true;\n }\n\n return false;\n}\n\n/**\n * True when array `items` resolve to an object-like schema worth extracting.\n * Conservative: skips scalar refs, oneOf/anyOf, nullable items, and nested\n * contexts where generated item type names cannot be inferred reliably.\n */\nfunction shouldExtractArrayItem(\n items: MockSchema,\n context: ContextSpec,\n operationId: string,\n parentName?: string,\n): boolean {\n const itemsRef = extractItemsRef(items);\n\n if (itemsRef) {\n try {\n const { schema } = resolveRef<OpenApiSchemaObject>(\n { $ref: itemsRef },\n context,\n );\n return isResolvedSchemaObjectLike(schema);\n } catch {\n return false;\n }\n }\n\n if (isReference(items)) {\n return false;\n }\n\n const schema = items as OpenApiSchemaObject;\n\n if (isNullableArrayItem(schema)) {\n return false;\n }\n\n if (schema.oneOf || schema.anyOf) {\n return false;\n }\n\n if (schema.allOf) {\n return true;\n }\n\n if (schema.type === 'object' || schema.properties) {\n return !isAmbiguousInlineItemContext(operationId, parentName);\n }\n\n return false;\n}\n\n/**\n * True when `mapValue` is already a bare factory call or a single spread of one.\n */\nfunction isAlreadyFactoryCall(mapValue: string): boolean {\n return /^(?:\\{\\s*\\.\\.\\.\\s*get\\w+Mock\\(\\)\\s*\\}|get\\w+Mock\\(\\))$/.test(\n mapValue.trim(),\n );\n}\n\ninterface ArrayItemFactoryNames {\n factoryName: string;\n typeName: string;\n}\n\n/**\n * Derive the exported factory and TypeScript type names for an array item.\n */\nfunction getArrayItemFactoryNames({\n items,\n propertyName,\n parentName,\n operationId,\n context,\n}: {\n items: MockSchema;\n propertyName: string;\n parentName?: string;\n operationId: string;\n context: ContextSpec;\n}): ArrayItemFactoryNames | undefined {\n if (!shouldExtractArrayItem(items, context, operationId, parentName)) {\n return undefined;\n }\n\n const itemsRef = extractItemsRef(items);\n if (itemsRef) {\n const { name } = getRefInfo(itemsRef, context);\n const typeName = pascal(name);\n return {\n factoryName: `get${typeName}Mock`,\n typeName,\n };\n }\n\n const itemPrefix =\n context.output.override.components.schemas.itemPrefix ?? '';\n const itemSuffix =\n context.output.override.components.schemas.itemSuffix ?? '';\n\n let typeName: string;\n if (parentName) {\n typeName = `${itemPrefix}${pascal(parentName)}${pascal(propertyName)}${itemSuffix}`;\n } else {\n // No `parentName`: the array IS the top-level response schema, and\n // `propertyName` here is the response definition string produced by\n // `getResReqTypes` (core/getters/res-req-types.ts) rather than a nested\n // property key. Two shapes reach this point:\n // - inline top-level array responses, where `propertyName` is the\n // response type expression with a trailing `[]`; the part before\n // `[]` is the element alias core already emitted via\n // `createTypeAliasIfNeeded` (core/resolvers/object.ts), when that\n // part is a bare identifier;\n // - `$ref`'d array schemas (`items` here is the array's resolved,\n // non-`$ref` items schema), where `propertyName` is the bare ref\n // name and core aliases the array's items as\n // `${pascal(refName)}${itemSuffix}` (core/getters/array.ts).\n // Nullable top-level arrays reach this branch too: core's scalar getter\n // appends a trailing ` | null` to either shape above (e.g.\n // `CatalogItems | null` or `GetFoo200Item[] | null`), so that suffix is\n // stripped before testing/deriving the type name below. `factoryName`\n // still keys off the original, unstripped `propertyName` — outputs on\n // the nullable path never compiled before this fix, so factory naming\n // there is not a compatibility surface.\n // If neither shape holds with certainty, bail (`undefined`) so the call\n // site keeps the pre-#3514 inline item body, which is always\n // type-correct, instead of referencing a name core never emitted (#3706).\n const nullableSuffix = ' | null';\n const workingName = propertyName.endsWith(nullableSuffix)\n ? propertyName.slice(0, -nullableSuffix.length)\n : propertyName;\n\n if (workingName.endsWith('[]')) {\n const base = workingName.slice(0, -2);\n if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(base)) {\n return undefined;\n }\n typeName = base;\n } else {\n const schema = items as OpenApiSchemaObject;\n if (schema.allOf && !schema.properties && schema.type !== 'object') {\n return undefined;\n }\n // Defense-in-depth: `workingName` should be a bare ref name here, but\n // guard against anything that isn't a valid identifier (e.g. a\n // malformed union expression) rather than emitting a phantom type.\n if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(workingName)) {\n return undefined;\n }\n typeName = `${itemPrefix}${pascal(workingName)}${itemSuffix}`;\n }\n }\n\n return {\n factoryName: `get${pascal(operationId)}Response${pascal(propertyName)}ItemMock`,\n typeName,\n };\n}\n\ninterface ExtractArrayItemMockOptions {\n items: MockSchema;\n propertyName: string;\n parentName?: string;\n operationId: string;\n tags: string[];\n mapValue: string;\n context: ContextSpec;\n splitMockImplementations: string[];\n imports: GeneratorImport[];\n}\n\n/**\n * When `arrayItems: true`, lift an object-like array item mock body into a\n * reusable exported factory and return the call site expression for `.map()`.\n */\nexport function extractArrayItemMock({\n items,\n propertyName,\n parentName,\n operationId,\n tags,\n mapValue,\n context,\n splitMockImplementations,\n imports,\n}: ExtractArrayItemMockOptions): string | undefined {\n if (!shouldExtractArrayItemFactories(context)) {\n return undefined;\n }\n\n if (\n !mapValue ||\n mapValue === '[]' ||\n isAlreadyFactoryCall(mapValue) ||\n hasConsolidatedSchemaFactory(items, context)\n ) {\n return undefined;\n }\n\n const names = getArrayItemFactoryNames({\n items,\n propertyName,\n parentName,\n operationId,\n context,\n });\n if (!names) {\n return undefined;\n }\n\n const { factoryName, typeName } = names;\n const scope = getArrayItemMockFileScope(context, tags, operationId);\n const fileLevelFactories = getFileLevelExtractedFactories(context, scope);\n const mockOptions = context.output.override.mock;\n const alreadyExtracted =\n fileLevelFactories.has(factoryName) ||\n splitMockImplementations.some((f) =>\n f.includes(`export const ${factoryName}`),\n );\n\n if (!alreadyExtracted) {\n const { param, returnType, returnCast } = getMockFactorySignatureParts(\n typeName,\n mockOptions,\n {\n isOverridable: true,\n overrideType: `Partial<${typeName}>`,\n },\n );\n const spreadPrefix = mapValue.startsWith('...') ? '' : '...';\n const func = formatMockFactoryDeclaration(\n factoryName,\n param,\n returnType,\n `{${spreadPrefix}${mapValue}, ...${overrideVarName}}`,\n returnCast,\n { terminateStatement: true },\n );\n splitMockImplementations.push(func);\n fileLevelFactories.add(factoryName);\n }\n\n imports.push({ name: typeName });\n\n const strictCast = isStrictMock(mockOptions)\n ? ` as ${getStrictMockTypeName(typeName)}`\n : '';\n\n return `{...${factoryName}()${strictCast}}`;\n}\n","import {\n type ContextSpec,\n isReference,\n type OpenApiSchemaObject,\n resolveRef,\n} from '@orval/core';\n\nconst DATE_FORMATS = new Set(['date', 'date-time']);\n\nfunction isDateFormat(\n format: string | undefined,\n): format is 'date' | 'date-time' {\n return format !== undefined && DATE_FORMATS.has(format);\n}\n\nfunction isSchemaObject(schema: unknown): schema is OpenApiSchemaObject {\n return (\n typeof schema === 'object' && schema !== null && !Array.isArray(schema)\n );\n}\n\nfunction resolveSchema(\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): OpenApiSchemaObject | undefined {\n if (!schema) {\n return undefined;\n }\n\n if (isReference(schema)) {\n return resolveRef<OpenApiSchemaObject>(schema, context).schema;\n }\n\n return schema;\n}\n\nfunction mergePropertySchemas(\n ...schemas: Array<OpenApiSchemaObject | undefined>\n): Record<string, OpenApiSchemaObject> {\n const merged: Record<string, OpenApiSchemaObject> = {};\n\n for (const schema of schemas) {\n if (!schema?.properties) {\n continue;\n }\n\n for (const [key, prop] of Object.entries(schema.properties)) {\n if (isSchemaObject(prop)) {\n merged[key] = prop;\n }\n }\n }\n\n return merged;\n}\n\nfunction getEffectiveScalarFormat(\n resolved: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): 'date' | 'date-time' | undefined {\n if (!resolved) {\n return undefined;\n }\n\n if (isDateFormat(resolved.format)) {\n return resolved.format;\n }\n\n const oneOf = resolved.oneOf as OpenApiSchemaObject[] | undefined;\n const anyOf = resolved.anyOf as OpenApiSchemaObject[] | undefined;\n\n for (const variant of [...(oneOf ?? []), ...(anyOf ?? [])]) {\n const resolvable =\n isReference(variant) || isSchemaObject(variant) ? variant : undefined;\n const resolvedVariant = resolveSchema(resolvable, context);\n\n if (isDateFormat(resolvedVariant?.format)) {\n return resolvedVariant.format;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolves compositional schemas (allOf / oneOf / anyOf) so example formatting\n * can see property formats on nested and referenced types.\n */\nfunction resolveExampleSchema(\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n seenRefs: Set<string> = new Set(),\n): OpenApiSchemaObject | undefined {\n if (!schema) {\n return undefined;\n }\n\n if (isReference(schema)) {\n const ref = schema.$ref;\n if (ref && seenRefs.has(ref)) {\n return resolveRef<OpenApiSchemaObject>(schema, context).schema;\n }\n if (ref) {\n seenRefs = new Set(seenRefs).add(ref);\n }\n }\n\n const resolved = resolveSchema(schema, context);\n if (!resolved) {\n return undefined;\n }\n\n const allOf = resolved.allOf as OpenApiSchemaObject[] | undefined;\n const oneOf = resolved.oneOf as OpenApiSchemaObject[] | undefined;\n const anyOf = resolved.anyOf as OpenApiSchemaObject[] | undefined;\n const compositors = [...(allOf ?? []), ...(oneOf ?? []), ...(anyOf ?? [])];\n\n const properties = mergePropertySchemas(\n resolved,\n ...compositors.map((sub) => resolveExampleSchema(sub, context, seenRefs)),\n );\n // OpenApiSchemaObject includes AnyOtherAttribute; cast before spread (see object.ts).\n const baseResolved = resolved as Record<string, unknown>;\n\n if (resolved.type === 'array' && isSchemaObject(resolved.items)) {\n const items = resolveExampleSchema(resolved.items, context, seenRefs);\n const itemProperties = items?.properties;\n const normalizedItems =\n itemProperties && Object.keys(itemProperties).length > 0\n ? { type: 'object' as const, properties: itemProperties }\n : items;\n\n return {\n ...baseResolved,\n ...(Object.keys(properties).length > 0 ? { properties } : {}),\n items: normalizedItems ?? resolved.items,\n } as OpenApiSchemaObject;\n }\n\n if (Object.keys(properties).length > 0) {\n return {\n ...baseResolved,\n properties,\n } as OpenApiSchemaObject;\n }\n\n if (compositors.length > 0 && (oneOf ?? anyOf)) {\n const variantProperties = mergePropertySchemas(\n ...compositors.map((sub) => resolveExampleSchema(sub, context, seenRefs)),\n );\n\n if (Object.keys(variantProperties).length > 0) {\n return {\n type: 'object',\n properties: variantProperties,\n };\n }\n }\n\n const scalarFormat = getEffectiveScalarFormat(resolved, context);\n if (scalarFormat) {\n return {\n ...baseResolved,\n format: scalarFormat,\n } as OpenApiSchemaObject;\n }\n\n return resolved;\n}\n\nexport function formatScalarExampleValue(\n example: unknown,\n format: string | undefined,\n context: ContextSpec,\n): string {\n if (\n context.output.override.useDates &&\n typeof example === 'string' &&\n isDateFormat(format)\n ) {\n return `new Date(${JSON.stringify(example)})`;\n }\n\n return JSON.stringify(example);\n}\n\nfunction formatLiteralValue(\n example: unknown,\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): string {\n if (example === null) {\n return 'null';\n }\n\n if (example === undefined) {\n return 'undefined';\n }\n\n const resolved = resolveExampleSchema(schema, context);\n\n if (Array.isArray(example)) {\n const itemsSchema =\n resolved?.type === 'array' && isSchemaObject(resolved.items)\n ? resolveExampleSchema(resolved.items, context)\n : resolved;\n\n return `[${example.map((item) => formatLiteralValue(item, itemsSchema, context)).join(', ')}]`;\n }\n\n if (typeof example === 'object') {\n const properties = resolved?.properties ?? {};\n\n const entries = Object.entries(example as Record<string, unknown>).map(\n ([key, value]) => {\n const propSchema = properties[key];\n const resolvedProp = isSchemaObject(propSchema)\n ? resolveExampleSchema(propSchema, context)\n : undefined;\n const safeKey = /^[a-zA-Z_$][\\w$]*$/.test(key)\n ? key\n : JSON.stringify(key);\n\n return `${safeKey}: ${formatLiteralValue(value, resolvedProp, context)}`;\n },\n );\n\n return `{ ${entries.join(', ')} }`;\n }\n\n if (\n context.output.override.useDates &&\n typeof example === 'string' &&\n isDateFormat(getEffectiveScalarFormat(resolved, context))\n ) {\n return `new Date(${JSON.stringify(example)})`;\n }\n\n return JSON.stringify(example);\n}\n\nexport function formatSchemaExampleValue(\n example: unknown,\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): string {\n if (!context.output.override.useDates || schema === undefined) {\n return JSON.stringify(example);\n }\n\n return formatLiteralValue(example, schema, context);\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport {\n compareNatural,\n type ContextSpec,\n EnumGeneration,\n type GeneratorImport,\n getRefInfo,\n isBoolean,\n isNumber,\n isReference,\n isString,\n jsStringLiteralEscape,\n mergeDeep,\n type MockOptions,\n type OpenApiSchemaObject,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { isFakerVersionV9 } from '../compatible-v9';\nimport { DEFAULT_FORMAT_MOCK } from '../constants';\nimport {\n getNullable,\n resolveMockOverride,\n resolveMockValue,\n} from '../resolvers';\nimport { extractArrayItemMock } from './array-item-factory';\nimport { formatSchemaExampleValue } from '../format-example-value';\nimport { getMockObject } from './object';\n\ninterface GetMockScalarOptions {\n item: MockSchemaObject;\n imports: GeneratorImport[];\n mockOptions?: MockOptions;\n operationId: string;\n isRef?: boolean;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Tracks the current contiguous `allOf` composition to break cyclic\n // inheritance; threaded through to `combineSchemasMock`.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}\n\nexport function getMockScalar({\n item,\n imports,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n allowOverride = false,\n}: GetMockScalarOptions): MockDefinition {\n const safeMockOptions: MockOptions = mockOptions ?? {};\n const nonNullableOption = safeMockOptions.nonNullable;\n // Add the property to the existing properties to validate on object recursion\n if (item.isRef) {\n existingReferencedProperties = [...existingReferencedProperties, item.name];\n }\n\n const operationProperty = resolveMockOverride(\n safeMockOptions.operations?.[operationId]?.properties,\n item,\n nonNullableOption,\n );\n\n if (operationProperty) {\n return operationProperty;\n }\n\n let overrideTag: { properties: Record<string, unknown> } = {\n properties: {},\n };\n const sortedTags = Object.entries(safeMockOptions.tags ?? {}).toSorted(\n (a, b) => compareNatural(a[0], b[0]),\n );\n for (const [tag, options] of sortedTags) {\n if (!tags.includes(tag)) {\n continue;\n }\n overrideTag = mergeDeep(overrideTag, options);\n }\n\n const tagProperty = resolveMockOverride(\n overrideTag.properties,\n item,\n nonNullableOption,\n );\n\n if (tagProperty) {\n return tagProperty;\n }\n\n // Schema-scoped overrides (#override.mock.schemas): apply only to properties\n // of a named schema. `item.parentName` is the enclosing schema name, set when\n // an object property is resolved (see getters/object.ts) — so the same\n // property name can mock differently per schema. More specific\n // operation/tag rules above still win; this beats the global `properties`.\n const schemaName = item.parentName;\n const schemaProperty = schemaName\n ? resolveMockOverride(\n safeMockOptions.schemas?.[schemaName]?.properties,\n item,\n nonNullableOption,\n )\n : undefined;\n\n if (schemaProperty) {\n return schemaProperty;\n }\n\n const property = resolveMockOverride(\n safeMockOptions.properties,\n item,\n nonNullableOption,\n );\n\n if (property) {\n return property;\n }\n\n if (\n context.output.override.mock?.useExamples ||\n safeMockOptions.useExamples\n ) {\n // OAS 3.0 inputs go through @scalar/openapi-parser's upgrade(), which\n // rewrites property-level `example: <value>` into `examples: [<value>]`\n // and deletes the singular field. Fall back to the array form so this\n // option keeps working post-upgrade.\n const propertyExample =\n item.example === undefined\n ? Array.isArray(item.examples) && item.examples.length > 0\n ? item.examples[0]\n : undefined\n : item.example;\n if (propertyExample !== undefined) {\n return {\n value: formatSchemaExampleValue(\n propertyExample,\n item as OpenApiSchemaObject,\n context,\n ),\n imports: [],\n name: item.name,\n overrided: true,\n };\n }\n }\n\n const formatOverrides = safeMockOptions.format ?? {};\n const ALL_FORMAT: Record<string, string> = {\n ...DEFAULT_FORMAT_MOCK,\n ...Object.fromEntries(\n Object.entries(formatOverrides).filter(\n (entry): entry is [string, string] => typeof entry[1] === 'string',\n ),\n ),\n };\n\n // Both OpenAPI 3.1 `type: [..., 'null']` and OpenAPI 3.0 `nullable: true`\n // reach here as a null union, because @scalar/openapi-parser upgrades 3.0\n // inputs to 3.1 before mock generation. When this getter wraps the value via\n // `getNullable` it flags the returned MockDefinition with `nullWrapped` so the\n // object property layer does not add a second `arrayElement([..., null])`.\n const isNullable = Array.isArray(item.type) && item.type.includes('null');\n const nullWrapped = isNullable && !nonNullableOption;\n // The @scalar/openapi-parser upgrader rewrites `format: binary` to\n // `contentMediaType: application/octet-stream` when upgrading OAS 3.0 → 3.1;\n // treat both equivalently so the mock emits the binary format value\n // (ArrayBuffer) instead of falling through to the string case.\n const schemaContentMediaType = (item as OpenApiSchemaObject).contentMediaType;\n if (\n !item.format &&\n schemaContentMediaType === 'application/octet-stream' &&\n ALL_FORMAT.binary\n ) {\n return {\n value: getNullable(ALL_FORMAT.binary, isNullable, nonNullableOption),\n imports: [],\n name: item.name,\n overrided: false,\n nullWrapped,\n };\n }\n if (item.format && ALL_FORMAT[item.format]) {\n let value = ALL_FORMAT[item.format];\n\n const dateFormats = ['date', 'date-time'];\n if (dateFormats.includes(item.format) && context.output.override.useDates) {\n value = `new Date(${value})`;\n }\n\n return {\n value: getNullable(value, isNullable, nonNullableOption),\n imports: [],\n name: item.name,\n overrided: false,\n nullWrapped,\n };\n }\n\n const type = getItemType(item);\n const isFakerV9 =\n !!context.output.packageJson &&\n isFakerVersionV9(context.output.packageJson);\n\n switch (type) {\n case 'number':\n case 'integer': {\n const intFunction =\n context.output.override.useBigInt &&\n (item.format === 'int64' || item.format === 'uint64')\n ? 'bigInt'\n : 'int';\n // Handle exclusiveMinimum/exclusiveMaximum for both OpenAPI 3.0 (boolean) and 3.1 (number).\n // OpenAPI 3.0: booleans indicating whether minimum/maximum is exclusive — use minimum/maximum as the bound.\n // OpenAPI 3.1: numbers representing the exclusive boundary value — use directly.\n const numMin = (\n typeof item.exclusiveMinimum === 'number'\n ? item.exclusiveMinimum\n : (item.minimum ?? safeMockOptions.numberMin)\n ) as number | undefined;\n const numMax = (\n typeof item.exclusiveMaximum === 'number'\n ? item.exclusiveMaximum\n : (item.maximum ?? safeMockOptions.numberMax)\n ) as number | undefined;\n const intParts: string[] = [];\n if (numMin !== undefined) intParts.push(`min: ${numMin}`);\n if (numMax !== undefined) intParts.push(`max: ${numMax}`);\n if (isFakerV9 && item.multipleOf !== undefined)\n intParts.push(`multipleOf: ${item.multipleOf}`);\n let value = getNullable(\n `faker.number.${intFunction}(${intParts.length > 0 ? `{${intParts.join(', ')}}` : ''})`,\n isNullable,\n nonNullableOption,\n );\n if (type === 'number') {\n const floatParts: string[] = [];\n if (numMin !== undefined) floatParts.push(`min: ${numMin}`);\n if (numMax !== undefined) floatParts.push(`max: ${numMax}`);\n if (isFakerV9 && item.multipleOf !== undefined) {\n floatParts.push(`multipleOf: ${item.multipleOf}`);\n } else if (safeMockOptions.fractionDigits !== undefined) {\n floatParts.push(`fractionDigits: ${safeMockOptions.fractionDigits}`);\n }\n value = getNullable(\n `faker.number.float(${floatParts.length > 0 ? `{${floatParts.join(', ')}}` : ''})`,\n isNullable,\n nonNullableOption,\n );\n }\n const numberImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n numberImports,\n context,\n existingReferencedProperties,\n 'number',\n );\n } else if ('const' in item) {\n value = JSON.stringify(item.const);\n }\n\n return {\n value,\n enums: item.enum,\n imports: numberImports,\n name: item.name,\n // `item.enum` / `const` reassign `value` after `getNullable`, discarding\n // the wrap — so only the plain numeric path is actually null-wrapped.\n nullWrapped: nullWrapped && !item.enum && !('const' in item),\n };\n }\n\n case 'boolean': {\n let value = 'faker.datatype.boolean()';\n const booleanImports: GeneratorImport[] = [];\n if (item.enum) {\n value = getEnum(\n item,\n booleanImports,\n context,\n existingReferencedProperties,\n 'boolean',\n );\n } else if ('const' in item) {\n value = JSON.stringify(item.const);\n }\n return {\n value,\n enums: item.enum,\n imports: booleanImports,\n name: item.name,\n };\n }\n\n case 'array': {\n // OpenAPI 3.1 tuples carry their positional element schemas in\n // `prefixItems` (not `items`). Mock each fixed position so the emitted\n // literal is assignable to the generated `[T0, T1, ...]` tuple type.\n // Emitting only the fixed positions stays type-safe even when `items`\n // also defines a rest element, because the generated type is\n // `[...prefix, ...Additional[]]` and the rest permits zero elements.\n const prefixItems = item.prefixItems as MockSchema[] | undefined;\n if (prefixItems && prefixItems.length > 0) {\n const tupleImports: GeneratorImport[] = [];\n const tupleValues = prefixItems.map((prefixItem, index) => {\n const { value: elementValue, imports: elementImports } =\n resolveMockValue({\n schema: {\n ...prefixItem,\n name: item.name,\n parentName: item.parentName,\n path: item.path ? `${item.path}.[${index}]` : `#.[${index}]`,\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n tupleImports.push(...elementImports);\n return elementValue;\n });\n return {\n value: `[${tupleValues.join(', ')}]`,\n imports: tupleImports,\n name: item.name,\n };\n }\n\n if (!item.items) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n const itemsRef = extractItemsRef(item.items);\n if (\n itemsRef &&\n existingReferencedProperties.includes(\n getRefInfo(itemsRef, context).name,\n )\n ) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n // If `items` is a single-element `allOf`/`oneOf`/`anyOf` wrapping a\n // `$ref`, treat it as a direct `$ref`. This avoids double-wrapping when\n // the inner schema is an enum array (whose `getEnum` already emits\n // `faker.helpers.arrayElements(...)`) and keeps recursion semantics in\n // line with direct-$ref items.\n const resolvedItems =\n itemsRef && !('$ref' in item.items) ? { $ref: itemsRef } : item.items;\n\n const {\n value,\n enums,\n imports: resolvedImports,\n } = resolveMockValue({\n schema: {\n ...resolvedItems,\n name: item.name,\n parentName: item.parentName,\n path: item.path ? `${item.path}.[]` : '#.[]',\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n\n if (enums) {\n return {\n value,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n let mapValue = value;\n\n const extractedItemCall = extractArrayItemMock({\n items: resolvedItems,\n propertyName: item.name,\n parentName: item.parentName,\n operationId,\n tags,\n mapValue,\n context,\n splitMockImplementations,\n imports: resolvedImports,\n });\n if (extractedItemCall) {\n mapValue = extractedItemCall;\n }\n\n if (\n combine &&\n !value.startsWith('faker') &&\n !value.startsWith('{') &&\n !value.startsWith('Array.from')\n ) {\n mapValue = `{${value}}`;\n }\n\n // Use global defaults for the missing bound only when they do not\n // invert the range; otherwise reuse the explicit schema bound so we\n // never invent values the user did not supply (and never produce\n // min > max). This also avoids relying on faker's internal default\n // upper bound when only `minItems` is specified, which can otherwise\n // produce very large arrays.\n const arrSchemaMin = item.minItems;\n const arrSchemaMax = item.maxItems;\n const arrGlobalMin = safeMockOptions.arrayMin;\n const arrGlobalMax = safeMockOptions.arrayMax;\n\n let arrMin: number | undefined;\n if (arrSchemaMin !== undefined) {\n arrMin = arrSchemaMin;\n } else if (arrSchemaMax === undefined) {\n arrMin = arrGlobalMin;\n } else if (arrGlobalMin === undefined || arrGlobalMin > arrSchemaMax) {\n arrMin = arrSchemaMax;\n } else {\n arrMin = arrGlobalMin;\n }\n\n let arrMax: number | undefined;\n if (arrSchemaMax !== undefined) {\n arrMax = arrSchemaMax;\n } else if (arrSchemaMin === undefined) {\n arrMax = arrGlobalMax;\n } else if (arrGlobalMax === undefined || arrGlobalMax < arrSchemaMin) {\n arrMax = arrSchemaMin;\n } else {\n arrMax = arrGlobalMax;\n }\n\n const arrParts: string[] = [];\n if (arrMin !== undefined) arrParts.push(`min: ${arrMin}`);\n if (arrMax !== undefined) arrParts.push(`max: ${arrMax}`);\n const arrLengthArg =\n arrParts.length > 0 ? `{${arrParts.join(', ')}}` : '';\n\n return {\n value:\n `Array.from({ length: faker.number.int(` +\n `${arrLengthArg}) ` +\n `}, (_, i) => i + 1).map(() => (${mapValue}))`,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n case 'string': {\n // faker.string.alpha's `length: { min, max }` form requires BOTH bounds.\n // When only one side is schema-specified, fall back to the global default\n // for the missing side only if it does not invert the range; otherwise\n // reuse the explicit bound so we never invent values the user did not\n // supply (and never produce min > max).\n const schemaMin = item.minLength;\n const schemaMax = item.maxLength;\n const globalMin = safeMockOptions.stringMin;\n const globalMax = safeMockOptions.stringMax;\n\n let strMin: number | undefined;\n if (schemaMin !== undefined) {\n strMin = schemaMin;\n } else if (schemaMax === undefined) {\n strMin = globalMin;\n } else if (globalMin === undefined || globalMin > schemaMax) {\n strMin = schemaMax;\n } else {\n strMin = globalMin;\n }\n\n let strMax: number | undefined;\n if (schemaMax !== undefined) {\n strMax = schemaMax;\n } else if (schemaMin === undefined) {\n strMax = globalMax;\n } else if (globalMax === undefined || globalMax < schemaMin) {\n strMax = schemaMin;\n } else {\n strMax = globalMax;\n }\n\n // faker.string.alpha's `length: { min, max }` requires both bounds, so\n // only emit a length argument when we have a complete pair. If only one\n // side could be resolved (e.g., no schema bound and only one global is\n // configured) we fall back to faker's own default length.\n const strLenParts: string[] = [];\n if (strMin !== undefined && strMax !== undefined) {\n strLenParts.push(`min: ${strMin}`, `max: ${strMax}`);\n }\n const length =\n strLenParts.length > 0 ? `{length: {${strLenParts.join(', ')}}}` : '';\n let value = `faker.string.alpha(${length})`;\n const stringImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n stringImports,\n context,\n existingReferencedProperties,\n 'string',\n );\n } else if (item.pattern) {\n value = `faker.helpers.fromRegExp(${JSON.stringify(item.pattern)})`;\n } else if ('const' in item) {\n value = JSON.stringify((item as OpenApiSchemaObject).const);\n }\n\n return {\n value: getNullable(value, isNullable, nonNullableOption),\n enums: item.enum,\n name: item.name,\n imports: stringImports,\n nullWrapped,\n };\n }\n\n case 'null': {\n return {\n value: 'null',\n imports: [],\n name: item.name,\n };\n }\n\n default: {\n if (item.enum) {\n const enumImports: GeneratorImport[] = [];\n const value = getEnum(\n item,\n enumImports,\n context,\n existingReferencedProperties,\n );\n\n return {\n value,\n enums: item.enum,\n imports: enumImports,\n name: item.name,\n };\n }\n\n return getMockObject({\n item,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator: combine.separator,\n includedProperties: [],\n }\n : undefined,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n }\n }\n}\n\n// Returns the $ref string from array `items` — either direct ($ref on items\n// itself) or wrapped in a single-element allOf/oneOf/anyOf composition.\n// Multi-element compositions return undefined to preserve combine semantics.\nexport function extractItemsRef(items: MockSchema): string | undefined {\n if (isReference(items)) {\n return items.$ref;\n }\n for (const key of ['allOf', 'oneOf', 'anyOf'] as const) {\n const composed = items[key] as MockSchema[] | undefined;\n if (\n Array.isArray(composed) &&\n composed.length === 1 &&\n isReference(composed[0])\n ) {\n return composed[0].$ref;\n }\n }\n return;\n}\n\nfunction getItemType(item: MockSchemaObject) {\n if (Array.isArray(item.type) && item.type.includes('null')) {\n const typesWithoutNull = item.type.filter((x) => x !== 'null');\n const itemType =\n typesWithoutNull.length === 1 ? typesWithoutNull[0] : typesWithoutNull;\n\n return itemType;\n }\n\n if (item.type) return item.type;\n if (!item.enum) return;\n\n const uniqTypes = new Set(item.enum.map((value) => typeof value));\n if (uniqTypes.size > 1) return;\n\n const type = [...uniqTypes.values()].at(0);\n if (!type) return;\n return ['string', 'number'].includes(type) ? type : undefined;\n}\n\n/**\n * Renders one enum member as a literal for the generated faker array.\n *\n * The branch is on the member's own type, never on the schema's declared\n * `type`: both come from the document and nothing makes them agree. Keying off\n * the declared type meant a string member under `type: 'integer'` was spliced\n * in as a live expression, a numeric member under `type: 'string'` crashed the\n * generator, and an object member emitted `[object Object]`.\n */\nfunction formatEnumMember(value: unknown): string {\n if (isString(value)) {\n return `'${jsStringLiteralEscape(value)}'`;\n }\n\n if (isNumber(value) || isBoolean(value)) {\n return String(value);\n }\n\n return JSON.stringify(value);\n}\n\nfunction getEnum(\n item: MockSchemaObject,\n imports: GeneratorImport[],\n context: ContextSpec,\n existingReferencedProperties: string[],\n // Only gates the `Object.values(...)` reference shortcut below. It must not\n // decide how a member is quoted — see `formatEnumMember`.\n type?: 'string' | 'number' | 'boolean',\n) {\n if (!item.enum) return '';\n const joinedEnumValues = item.enum\n .filter((e) => e !== null) // TODO fix type, e can absolutely be null\n .map((e) => formatEnumMember(e))\n .join(',');\n\n let enumValue = `[${joinedEnumValues}]`;\n if (context.output.override.enumGenerationType === EnumGeneration.ENUM) {\n const isRootSchema =\n !item.parentName && existingReferencedProperties.at(-1) === item.name;\n if (\n item.isRef ||\n existingReferencedProperties.length === 0 ||\n isRootSchema\n ) {\n enumValue += ` as ${item.name}${item.name.endsWith('[]') ? '' : '[]'}`;\n imports.push({ name: item.name });\n } else {\n const parentReference = existingReferencedProperties.at(-1);\n if (!parentReference) {\n return '';\n }\n\n enumValue += ` as ${parentReference}['${item.name}']`;\n if (!item.path?.endsWith('[]')) enumValue += '[]';\n imports.push({\n name: parentReference,\n });\n }\n } else {\n enumValue += ' as const';\n }\n\n // But if the value is a reference to a schema that emits a runtime value\n // (a native `enum` object or a `const` object), we can use it directly via\n // the imports and `Object.values`. A `union` reference is a pure type with\n // no runtime value, so `Object.values` would fail (TS2693) — keep the\n // inlined values in that case (#3690).\n //\n // Members must all actually be strings, not merely declared `type: 'string'`.\n // A numeric member emits a numeric TS enum, which compiles to a two-way map\n // (`{1: 'NUMBER_1', NUMBER_1: 1}`), so `Object.values` would also yield the\n // member *names* and the mock could return a value the schema never declared.\n if (\n item.isRef &&\n type === 'string' &&\n item.enum.every((e) => isString(e)) &&\n context.output.override.enumGenerationType !== EnumGeneration.UNION\n ) {\n enumValue = `Object.values(${item.name})`;\n imports.push({\n name: item.name,\n values: true,\n });\n }\n\n return item.path?.endsWith('[]')\n ? `faker.helpers.arrayElements(${enumValue})`\n : `faker.helpers.arrayElement(${enumValue})`;\n}\n","import {\n type ContextSpec,\n type GeneratorImport,\n getRefInfo,\n getRequiredKeys,\n isFunction,\n isReference,\n type MockOptions,\n type OpenApiSchemaObject,\n OutputMockType,\n pascal,\n} from '@orval/core';\nimport { prop } from 'remeda';\n\nimport {\n formatMockFactoryDeclaration,\n getMockFactorySignatureParts,\n getStrictMockTypeName,\n isStrictMock,\n} from '../../mock-types';\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { overrideVarName } from '../getters';\nimport { collectAllOfRequiredWithDeclared } from '../getters/all-of-required';\nimport { getMockScalar } from '../getters/scalar';\nimport { appendImportsDelta, mergeReturnedMockImports } from '../imports';\n\nfunction isRegex(key: string) {\n return key.startsWith('/') && key.endsWith('/');\n}\n\n// Drop `[]` array-items segments from a dotted JSON-pointer-ish path. Treating\n// the marker as transparent for property override matching lets a bare\n// property-name override apply wherever the property literally appears, even\n// inside arrays (#2465). Segment-based so both leading (`[].id`) and embedded\n// (`foo.[].id`) markers normalize equivalently.\nfunction stripArrayMarkerSegments(s: string): string {\n return s\n .split('.')\n .filter((seg) => seg !== '[]')\n .join('.');\n}\n\nexport function resolveMockOverride(\n properties: Record<string, unknown> | undefined = {},\n item: OpenApiSchemaObject & { name: string; path?: string },\n nonNullableOption?: boolean,\n) {\n const path = item.path ?? `#.${item.name}`;\n // Regex keys still match against the original (un-normalized) path so users\n // can opt into array-scoped targeting explicitly if ever needed.\n const normalizedPath = stripArrayMarkerSegments(path);\n const entries = Object.entries(properties);\n\n // Tier 1 — explicit matches: regex (against name or full path) and exact\n // array-transparent path. Checked first so a specific override (regex or\n // dotted path like `country.name`) always wins over the bare-name fallback.\n let property = entries.find(([key]) => {\n if (isRegex(key)) {\n const regex = new RegExp(key.slice(1, -1));\n if (regex.test(item.name) || regex.test(path)) {\n return true;\n }\n }\n\n if (`#.${stripArrayMarkerSegments(key)}` === normalizedPath) {\n return true;\n }\n\n return false;\n });\n\n // Tier 2 — bare property-name transparency (#3470): a dot-less key applies\n // wherever the property literally appears, including inside non-array nested\n // objects, mirroring the array transparency from #2465. Only reached when no\n // explicit Tier 1 key matched, so it never overrides a more specific key.\n if (!property) {\n property = entries.find(\n ([key]) => !isRegex(key) && !key.includes('.') && key === item.name,\n );\n }\n\n if (!property) {\n return;\n }\n\n return {\n value: getNullable(\n property[1] as string,\n isNullableSchema(item),\n nonNullableOption,\n ),\n imports: [],\n name: item.name,\n overrided: true,\n };\n}\n\n/** Resolves a `$ref` string to its schema in the loaded spec, if any. */\nexport function resolveRefTarget(\n ref: string | undefined,\n context: ContextSpec,\n): Partial<OpenApiSchemaObject> | undefined {\n if (typeof ref !== 'string') return undefined;\n // getRefInfo throws on refs without a '#' fragment\n const [, fragment] = ref.split('#');\n if (!fragment) return undefined;\n const { refPaths } = getRefInfo(ref, context);\n if (!Array.isArray(refPaths)) return undefined;\n\n return prop(\n context.spec,\n // @ts-expect-error: [ts2556] refPaths are not guaranteed to be valid keys of the spec\n ...refPaths,\n ) as Partial<OpenApiSchemaObject> | undefined;\n}\n\n/** OpenAPI 3.0 `nullable: true` or 3.1 `type` unions that include `null`. */\nexport function isNullableSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== 'object') {\n return false;\n }\n\n const { type, nullable } = schema as {\n type?: unknown;\n nullable?: unknown;\n };\n\n return nullable === true || (Array.isArray(type) && type.includes('null'));\n}\n\n/** When `nonNullableOption` is true (`override.mock.nonNullable`), omit the null branch. */\nexport function getNullable(\n value: string,\n nullable?: boolean,\n nonNullableOption?: boolean,\n) {\n if (!nullable || nonNullableOption) {\n return value;\n }\n\n return `faker.helpers.arrayElement([${value}, null])`;\n}\n\n/**\n * True when the active faker generator entry asks for consolidated schema\n * mock factories and the output is configured to host them (i.e. there is a\n * dedicated schemas directory we can import `index.faker` from). Used to\n * decide whether an operation factory should inline a `$ref`'d schema or\n * delegate to its `get<X>Mock` factory.\n */\nfunction shouldDelegateToSchemaFactories(context: ContextSpec): boolean {\n if (!context.output.schemas) return false;\n // The duplicate-type guard in `normalizeMocksOption` (see\n // `packages/orval/src/utils/options.ts`) ensures at most one faker entry\n // exists per output, so finding the first one that opted into schemas is\n // unambiguous today and remains correct if that guard ever loosens.\n const fakerEntry = context.output.mock.generators.find(\n (g) =>\n !isFunction(g) && g.type === OutputMockType.FAKER && g.schemas === true,\n );\n return !!fakerEntry;\n}\n\n/**\n * Predicate: this `$ref` points at a top-level `#/components/schemas/<Name>`\n * (vs. a parameter, response, or inline schema). Only those have a\n * corresponding `get<Name>Mock` factory in the consolidated faker file.\n */\nfunction isComponentsSchemaRef(refPaths: string[] | undefined): boolean {\n return (\n Array.isArray(refPaths) &&\n refPaths[0] === 'components' &&\n refPaths[1] === 'schemas'\n );\n}\n\n/**\n * Returns true when an operation- or tag-level mock override touches any\n * property declared on the referenced schema. In that case we must inline\n * the schema body so the override actually applies; the shared\n * `get<X>Mock` factory has no knowledge of operation-scoped overrides.\n *\n * Schema-scoped overrides (`override.mock.schemas`) need no special handling\n * here: they target a schema's *own* properties, so the schema's `get<X>Mock`\n * factory — built with the same mock options — already bakes them in, and\n * delegating to it preserves the override.\n *\n * Reuses `resolveMockOverride` so the same matching rules apply as for\n * regular property mocks — bare name, regex (`/.../`), and exact-path\n * (`#.foo.bar`). The parent's `path` (where the `$ref` appears in the\n * surrounding schema) gets composed into each synthetic property item so\n * exact-path overrides like `#.color.value` resolve correctly.\n */\nfunction hasOverrideTouchingSchema(\n schemaProperties: Record<string, unknown> | undefined,\n mockOptions: MockOptions | undefined,\n operationId: string,\n tags: string[],\n parentPath: string | undefined,\n): boolean {\n if (!schemaProperties) return false;\n const propertyNames = Object.keys(schemaProperties);\n if (propertyNames.length === 0) return false;\n\n const overrideBuckets: (Record<string, unknown> | undefined)[] = [\n mockOptions?.operations?.[operationId]?.properties,\n ];\n for (const tag of tags) {\n overrideBuckets.push(mockOptions?.tags?.[tag]?.properties);\n }\n\n return overrideBuckets.some((bucket) => {\n if (!bucket) return false;\n return propertyNames.some((propertyName) => {\n const synthetic = {\n name: propertyName,\n path: parentPath ? `${parentPath}.${propertyName}` : propertyName,\n } as OpenApiSchemaObject & { name: string; path?: string };\n return !!resolveMockOverride(bucket, synthetic);\n });\n });\n}\n\ninterface ResolveMockValueOptions {\n schema: MockSchema;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Tracks the current contiguous `allOf` composition to break cyclic\n // inheritance; threaded through to `combineSchemasMock`.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n allowOverride?: boolean;\n}\n\nexport function resolveMockValue({\n schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n allowOverride,\n}: ResolveMockValueOptions): MockDefinition & { type?: string } {\n if (isReference(schema)) {\n const schemaReference = schema as MockSchema & {\n path?: string;\n required?: string[];\n nullable?: boolean;\n };\n const schemaRefPath = typeof schema.$ref === 'string' ? schema.$ref : '';\n const { name, refPaths } = getRefInfo(schemaRefPath, context);\n\n const schemaRef = resolveRefTarget(schemaRefPath, context);\n\n const newSchema = {\n ...schemaRef,\n name,\n path: schemaReference.path,\n isRef: true,\n required: [\n ...((schemaRef?.required as string[] | undefined) ?? []),\n ...getRequiredKeys(schemaReference, name),\n ],\n ...(schemaReference.nullable === undefined\n ? {}\n : { nullable: schemaReference.nullable }),\n } as MockSchemaObject;\n\n // When a discriminator parent ($ref-loaded schema with both `discriminator`\n // and `oneOf`) is being expanded inside an `allOf` chain AND the chain\n // is rooted at one of that parent's mapping targets (i.e. the current\n // schema *is* a variant via `allOf: [parent, ...extras]`), the parent's\n // `oneOf` is descriptive of the union, not additive to this specific\n // variant. Re-expanding it inlines sibling factory calls into the derived\n // variant's mock body (#2155). Drop the `oneOf` side here; the parent\n // still contributes its own `properties` and other base attributes\n // through the remaining schema fields.\n //\n // The mapping-target check guards against cases like\n // `someField: allOf: [<discriminator parent>]` (e.g. #one-of-nested\n // `Example2.expiry`), where the surrounding schema is NOT a variant of\n // the parent and we still need the full union to randomize over.\n //\n // Symmetrically with the oneOf-side fix in `combineSchemasMock` (#3429),\n // also drop the discriminator key from the parent's `properties`: each\n // variant already carries a constrained discriminator value via\n // `resolveDiscriminators`, so leaving the parent's free-choice enum in\n // would just emit dead code (immediately shadowed by the variant's\n // constrained value through spread merge).\n if (\n combine?.separator === 'allOf' &&\n newSchema.discriminator &&\n newSchema.oneOf\n ) {\n const parentDiscriminator = newSchema.discriminator as {\n propertyName?: string;\n mapping?: Record<string, string>;\n };\n const mappingTargetNames = parentDiscriminator.mapping\n ? Object.values(parentDiscriminator.mapping).map((ref) =>\n pascal(ref.split('/').pop() ?? ''),\n )\n : [];\n const expandingAsVariant = existingReferencedProperties.some((refName) =>\n mappingTargetNames.includes(refName),\n );\n\n if (expandingAsVariant) {\n const mutableSchema = newSchema as Record<string, unknown>;\n delete mutableSchema.oneOf;\n const parentProperties = newSchema.properties as\n | Record<string, unknown>\n | undefined;\n if (\n parentDiscriminator.propertyName &&\n parentProperties &&\n parentDiscriminator.propertyName in parentProperties\n ) {\n const remainingProperties = Object.fromEntries(\n Object.entries(parentProperties).filter(\n ([key]) => key !== parentDiscriminator.propertyName,\n ),\n );\n if (Object.keys(remainingProperties).length === 0) {\n delete mutableSchema.properties;\n } else {\n mutableSchema.properties = remainingProperties;\n }\n const parentRequired = newSchema.required as string[] | undefined;\n if (Array.isArray(parentRequired)) {\n const filteredRequired = parentRequired.filter(\n (key) => key !== parentDiscriminator.propertyName,\n );\n if (filteredRequired.length === 0) {\n delete mutableSchema.required;\n } else {\n mutableSchema.required = filteredRequired;\n }\n }\n }\n }\n }\n\n const newSeparator = newSchema.allOf\n ? 'allOf'\n : newSchema.oneOf\n ? 'oneOf'\n : 'anyOf';\n\n // A shared factory only encodes the referenced schema's OWN optionality.\n // When this $ref sits inside an allOf composition, combineSchemasMock\n // attaches the composition-wide `required` union (schemaReference.required),\n // e.g. a constraint-only sibling `{ required: [id] }` makes the base's\n // optional `id` required. Delegating would keep the factory's\n // `arrayElement([..., undefined])` branch for that property and emit a\n // mock the composed type rejects, so inline the schema body instead.\n // The target's effective shape is computed recursively: its properties\n // and required may themselves live behind the target's own allOf chain.\n const targetEffective = schemaRef\n ? collectAllOfRequiredWithDeclared(\n [schemaRef as MockSchema],\n context,\n new Set(),\n )\n : undefined;\n const delegationDropsRequired = (schemaReference.required ?? []).some(\n (requiredName) =>\n targetEffective?.declared.has(requiredName) &&\n !targetEffective.required.includes(requiredName),\n );\n\n // When schema-level faker factories are being emitted (`schemas: true`),\n // delegate to `get<X>Mock()` instead of inlining the body. The factory\n // already encodes the same fields, so this both deduplicates the output\n // and lets a single source of truth drive shared mocks.\n const canDelegate =\n shouldDelegateToSchemaFactories(context) &&\n isComponentsSchemaRef(refPaths) &&\n // A ref already on the resolution path is recursive: delegating would\n // emit a factory call that re-enters itself at runtime. Inline it so\n // the recursion terminators can cut the cycle instead.\n !existingReferencedProperties.includes(name) &&\n !delegationDropsRequired &&\n !hasOverrideTouchingSchema(\n schemaRef?.properties as Record<string, unknown> | undefined,\n mockOptions,\n operationId,\n tags,\n schemaReference.path,\n );\n\n if (canDelegate) {\n const factoryName = `get${pascal(name)}Mock`;\n const factoryImport: GeneratorImport = {\n name: factoryName,\n values: true,\n schemaFactory: true,\n };\n const isObjectLike =\n newSchema.type === 'object' ||\n !!newSchema.allOf ||\n resolvesToObjectLike(newSchema, context);\n const mockTypeName = getStrictMockTypeName(pascal(name));\n const strictMockTypeImport: GeneratorImport | undefined =\n isStrictMock(mockOptions) && isObjectLike\n ? {\n name: mockTypeName,\n values: false,\n schemaFactory: true,\n }\n : undefined;\n // For object-like refs the historical inline output is `{ ...body }`\n // so the spread form keeps callers (combineSchemasMock, object\n // properties) working without other changes. For everything else\n // (scalars, arrays, nullables) emit the bare call.\n //\n // A `oneOf`/`anyOf` is only object-like when *every* branch resolves to\n // an object. A composition of primitives (e.g. `number | string`) makes\n // the factory return a primitive union, which is not spreadable: emitting\n // `{ ...get<X>Mock() }` is invalid TypeScript (TS2698) and would discard\n // the value as `{}` at runtime, so it must use the bare call (#3200).\n const strictObjectCast =\n isStrictMock(mockOptions) && isObjectLike ? ` as ${mockTypeName}` : '';\n const callValue = isObjectLike\n ? `{ ...${factoryName}()${strictObjectCast} }`\n : `${factoryName}()`;\n\n return {\n value: getNullable(\n callValue,\n Boolean(newSchema.nullable),\n mockOptions?.nonNullable,\n ),\n imports: strictMockTypeImport\n ? [factoryImport, strictMockTypeImport]\n : [factoryImport],\n name: newSchema.name,\n type: getType(newSchema),\n nullWrapped: Boolean(newSchema.nullable) && !mockOptions?.nonNullable,\n };\n }\n\n const importsBefore = imports.length;\n const scalar = getMockScalar({\n item: newSchema,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator:\n combine.separator === 'anyOf' ? newSeparator : combine.separator,\n includedProperties:\n newSeparator === 'allOf' ? [] : combine.includedProperties,\n }\n : undefined,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n if (\n scalar.value &&\n (newSchema.type === 'object' || newSchema.allOf) &&\n combine?.separator === 'oneOf'\n ) {\n const funcName = `get${pascal(operationId)}Response${pascal(newSchema.name)}Mock`;\n if (\n !splitMockImplementations.some((f) =>\n f.includes(`export const ${funcName}`),\n )\n ) {\n const discriminator = newSchema.discriminator as\n | { propertyName?: string }\n | undefined;\n const discriminatedProperty = discriminator?.propertyName;\n\n let overrideType = `Partial<${newSchema.name}>`;\n if (discriminatedProperty) {\n overrideType = `Omit<${overrideType}, '${discriminatedProperty}'>`;\n }\n\n const { param, returnType, returnCast } = getMockFactorySignatureParts(\n newSchema.name,\n mockOptions,\n {\n isOverridable: true,\n overrideType,\n },\n );\n const func = formatMockFactoryDeclaration(\n funcName,\n param,\n returnType,\n `{${scalar.value.startsWith('...') ? '' : '...'}${scalar.value}, ...${overrideVarName}}`,\n returnCast,\n { terminateStatement: true },\n );\n splitMockImplementations.push(func);\n }\n\n scalar.value = newSchema.nullable\n ? `${funcName}()`\n : `{...${funcName}()}`;\n\n const typeImport: GeneratorImport = {\n name: newSchema.name,\n values: false,\n };\n scalar.imports.push(typeImport);\n if (scalar.imports !== imports) {\n // Forward the helper's whole import set, not just the type import.\n // Pushing only `typeImport` mutates `imports`, which suppresses the\n // `mergeReturnedMockImports` call below and drops the imports the\n // helper body needs at runtime — e.g. an enum referenced through\n // `Object.values(...)` (#3656).\n appendImportsDelta(imports, scalar.imports, 0);\n }\n }\n\n mergeReturnedMockImports(imports, importsBefore, scalar.imports);\n\n return {\n ...scalar,\n type: getType(newSchema),\n };\n }\n\n const importsBefore = imports.length;\n const scalar = getMockScalar({\n item: schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n mergeReturnedMockImports(imports, importsBefore, scalar.imports);\n return {\n ...scalar,\n type: getType(schema),\n };\n}\n\nfunction getType(schema: MockSchema) {\n if (isReference(schema)) {\n return;\n }\n\n return (\n (schema.type as string | undefined) ??\n (schema.properties ? 'object' : schema.items ? 'array' : undefined)\n );\n}\n\n// Whether a schema (or a `$ref` to one) ultimately produces an object mock.\n// Used to decide if a delegated `get<X>Mock()` call may be spread into an\n// object literal. Object-like schemas are `type: 'object'`, `properties`,\n// `additionalProperties` and `allOf`; a `oneOf`/`anyOf` qualifies only when\n// every branch resolves to an object. A union containing a primitive\n// (e.g. `number | string`) does not, since spreading that union is invalid\n// TypeScript. `seen` carries the `$ref`s on the current resolution path to\n// guard against self-referential compositions. A fresh copy is taken at each\n// `$ref` hop so sibling branches sharing a `$ref` don't falsely trip the guard.\nfunction resolvesToObjectLike(\n schema: MockSchema,\n context: ContextSpec,\n seen = new Set<string>(),\n): boolean {\n let resolved: Partial<OpenApiSchemaObject> | undefined;\n\n if (isReference(schema)) {\n // A non-string or already-visited `$ref` can't be resolved further here.\n if (typeof schema.$ref !== 'string' || seen.has(schema.$ref)) {\n return false;\n }\n seen = new Set(seen).add(schema.$ref);\n resolved = resolveRefTarget(schema.$ref, context);\n } else {\n resolved = schema as Partial<OpenApiSchemaObject>;\n }\n\n if (!resolved) {\n return false;\n }\n\n if (\n resolved.type === 'object' ||\n resolved.properties ||\n resolved.additionalProperties ||\n resolved.allOf\n ) {\n return true;\n }\n\n const branches = (resolved.oneOf ?? resolved.anyOf) as\n | MockSchema[]\n | undefined;\n if (branches && branches.length > 0) {\n return branches.every((branch) =>\n resolvesToObjectLike(branch, context, seen),\n );\n }\n\n return false;\n}\n","import {\n type ContextSpec,\n type GeneratorImport,\n getRefInfo,\n isReference,\n type MockOptions,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { resolveMockValue } from '../resolvers';\nimport { collectAllOfRequired } from './all-of-required';\n\nfunction getReferenceName(\n ref: string | undefined,\n context: ContextSpec,\n): string {\n if (!ref) return '';\n\n return getRefInfo(ref, context).name;\n}\n\ninterface CombineSchemasMockOptions {\n item: MockSchemaObject;\n separator: 'allOf' | 'oneOf' | 'anyOf';\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Schemas on the *current contiguous `allOf` composition* — the chain of\n // `allOf` bases entered to reach the schema being expanded right now. This is\n // the canonical doc for this field; other sites just point here.\n //\n // Why it exists: to break cycles built purely from top-level named schemas\n // that extend each other (`A: allOf[B]`, `B: allOf[A]`). There every hop is a\n // `$ref`, so `item.isRef` is always true and the `!item.isRef` clause in\n // `shouldSkipRef` never fires; this chain catches the repeat instead. (It is\n // narrower than `existingReferencedProperties`, which records every visited\n // `$ref` — variants and properties included.)\n //\n // Invariant: it grows only on a direct `allOf` -> `allOf` base descent, and\n // resets to `[]` when crossing into a `oneOf`/`anyOf` variant or a property\n // value. Those boundaries begin a fresh mock instance whose own `allOf` base\n // is legitimate and must still be pulled in, so keeping the chain across them\n // would wrongly skip that base. Such re-entry can't loop forever anyway —\n // `existingReferencedProperties` already bounds it.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n}\n\nexport function combineSchemasMock({\n item,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n}: CombineSchemasMockOptions): MockDefinition {\n const combineImports: GeneratorImport[] = [];\n const includedProperties: string[] = [...(combine?.includedProperties ?? [])];\n const separatorItems = (item[separator] ?? []) as MockSchema[];\n const itemRequired = item.required as string[] | undefined;\n\n const isRefAndNotExisting =\n isReference(item) && !existingReferencedProperties.includes(item.name);\n\n // When a oneOf schema declares a discriminator with a mapping AND the\n // discriminator property is also declared on the parent's `properties`,\n // skip that property here. Each variant already encodes a constrained value\n // for it via `resolveDiscriminators`; emitting the parent's free-choice enum\n // alongside the picked variant would override the constrained value and\n // guarantee a discriminator mismatch (#2155).\n const discriminator = item.discriminator as\n | { propertyName?: string; mapping?: Record<string, string> }\n | undefined;\n const itemProperties = item.properties as Record<string, unknown> | undefined;\n const discriminatorPropertyName =\n separator === 'oneOf' &&\n discriminator?.mapping &&\n discriminator.propertyName &&\n itemProperties &&\n discriminator.propertyName in itemProperties\n ? discriminator.propertyName\n : undefined;\n\n const itemEntriesForResolve = Object.entries(item).filter(\n ([key]) => key !== separator,\n );\n if (discriminatorPropertyName && itemProperties) {\n const propertiesIdx = itemEntriesForResolve.findIndex(\n ([key]) => key === 'properties',\n );\n if (propertiesIdx !== -1) {\n const filteredProperties = Object.fromEntries(\n Object.entries(itemProperties).filter(\n ([key]) => key !== discriminatorPropertyName,\n ),\n );\n if (Object.keys(filteredProperties).length === 0) {\n itemEntriesForResolve.splice(propertiesIdx, 1);\n } else {\n itemEntriesForResolve[propertiesIdx] = [\n 'properties',\n filteredProperties,\n ];\n }\n }\n // Keep `required` in sync with the filtered properties — leaving the\n // discriminator key in `required` would describe a schema whose required\n // field is missing from `properties`.\n const requiredIdx = itemEntriesForResolve.findIndex(\n ([key]) => key === 'required',\n );\n if (requiredIdx !== -1 && Array.isArray(itemRequired)) {\n const filteredRequired = itemRequired.filter(\n (key) => key !== discriminatorPropertyName,\n );\n if (filteredRequired.length === 0) {\n itemEntriesForResolve.splice(requiredIdx, 1);\n } else {\n itemEntriesForResolve[requiredIdx] = ['required', filteredRequired];\n }\n }\n }\n\n const hasResolvableProperties = itemEntriesForResolve.some(\n ([key]) => key === 'properties',\n );\n\n const allRequiredFields: string[] = [];\n if (separator === 'allOf') {\n if (itemRequired) {\n allRequiredFields.push(...itemRequired);\n }\n allRequiredFields.push(...collectAllOfRequired(separatorItems, context));\n }\n\n // The composed schema's own sibling `properties` (declared next to the\n // `allOf`) are one more member of the composition, and their emission is\n // appended last, so it wins the spread merge. Resolve them with the same\n // `required` union as the members, otherwise a property required by a base\n // would be emitted here with an undefined branch the type rejects.\n const itemSchemaForResolve = Object.fromEntries(\n itemEntriesForResolve,\n ) as MockSchemaObject;\n if (separator === 'allOf' && allRequiredFields.length > 0) {\n const itemResolveRequired = itemSchemaForResolve.required as\n | string[]\n | undefined;\n itemSchemaForResolve.required = [\n ...new Set([...allRequiredFields, ...(itemResolveRequired ?? [])]),\n ];\n }\n\n const itemResolvedValue =\n isRefAndNotExisting || hasResolvableProperties\n ? resolveMockValue({\n schema: itemSchemaForResolve,\n combine: {\n separator: 'allOf',\n includedProperties: [],\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n })\n : undefined;\n\n includedProperties.push(...(itemResolvedValue?.includedProperties ?? []));\n combineImports.push(...(itemResolvedValue?.imports ?? []));\n let containsOnlyPrimitiveValues = true;\n\n let value = separator === 'allOf' ? '' : 'faker.helpers.arrayElement([';\n\n for (const val of separatorItems) {\n const refName = isReference(val) ? getReferenceName(val.$ref, context) : '';\n // For allOf: skip a base that would otherwise re-expand forever, in any of:\n // - `refName === item.name`: the schema lists itself as its own base;\n // - an already-seen *inline* base (`!item.isRef`): a circular inline allOf;\n // - a ref already on the contiguous allOf chain\n // (`existingReferencedAllOfRefs`): a top-level allOf cycle — see that\n // field's docs above.\n // Top-level refs (`item.isRef`) are otherwise allowed through so a schema\n // still inherits its base properties.\n // For oneOf/anyOf: skip a variant pointing back to an already-visited schema,\n // otherwise polymorphic recursion re-expands forever\n // (e.g. Base.Parent → oneOf [Derived → allOf [Base]]).\n const shouldSkipRef =\n separator === 'allOf'\n ? refName &&\n (refName === item.name ||\n (existingReferencedProperties.includes(refName) && !item.isRef) ||\n existingReferencedAllOfRefs.includes(refName))\n : refName && existingReferencedProperties.includes(refName);\n\n if (shouldSkipRef) {\n if (separatorItems.length === 1) {\n value = 'undefined';\n }\n continue;\n }\n\n // the required fields in this schema need to be considered\n // in the sub schema under the allOf key\n const schema = (() => {\n if (separator !== 'allOf' || allRequiredFields.length === 0) {\n return {\n ...val,\n name: item.name,\n path: item.path ?? '#',\n };\n }\n\n const valWithRequired = val as MockSchema & { required?: string[] };\n const valRequired = valWithRequired.required;\n const combinedRequired = valRequired\n ? [...allRequiredFields, ...valRequired]\n : allRequiredFields;\n\n return {\n ...val,\n name: item.name,\n path: item.path ?? '#',\n required: [...new Set(combinedRequired)],\n };\n })();\n\n const resolvedValue = resolveMockValue({\n schema,\n combine: {\n separator,\n includedProperties:\n separator === 'oneOf'\n ? (itemResolvedValue?.includedProperties ?? [])\n : includedProperties,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n // Grow the chain on an allOf base hop; reset it on a oneOf/anyOf variant\n // (a fresh instance). See `existingReferencedAllOfRefs` docs above.\n existingReferencedAllOfRefs:\n separator === 'allOf' && refName\n ? [...existingReferencedAllOfRefs, refName]\n : [],\n splitMockImplementations,\n });\n\n combineImports.push(...resolvedValue.imports);\n includedProperties.push(...(resolvedValue.includedProperties ?? []));\n\n if (resolvedValue.value === '{}') {\n containsOnlyPrimitiveValues = false;\n continue;\n }\n\n if (separator === 'allOf') {\n if (resolvedValue.value.startsWith('{') || !resolvedValue.type) {\n containsOnlyPrimitiveValues = false;\n value += `...${resolvedValue.value},`;\n continue;\n }\n\n if (resolvedValue.type === 'object') {\n containsOnlyPrimitiveValues = false;\n value += resolvedValue.value.startsWith('faker')\n ? `...${resolvedValue.value},`\n : `...{${resolvedValue.value}},`;\n continue;\n }\n }\n\n value += `${resolvedValue.value},`;\n }\n // When every oneOf/anyOf variant was skipped (e.g. all $refs were already on\n // the resolution stack) the loop leaves `value` at its initial opener. Emit\n // `undefined` instead of closing it as `faker.helpers.arrayElement([])`,\n // which throws at runtime.\n const isEmptyArrayElement =\n separator !== 'allOf' && value === 'faker.helpers.arrayElement([';\n\n let finalValue =\n value === 'undefined' || isEmptyArrayElement\n ? 'undefined'\n : // containsOnlyPrimitiveValues isn't just true, it's being set to false inside the above reduce and the type system doesn't detect it\n `${separator === 'allOf' && !containsOnlyPrimitiveValues ? '{' : ''}${value}${separator === 'allOf' ? (containsOnlyPrimitiveValues ? '' : '}') : '])'}`;\n if (itemResolvedValue) {\n finalValue = finalValue.startsWith('...')\n ? `...{${finalValue}, ${itemResolvedValue.value}}`\n : `{...${finalValue}, ${itemResolvedValue.value}}`;\n }\n if (finalValue.endsWith(',')) {\n finalValue = finalValue.slice(0, Math.max(0, finalValue.length - 1));\n }\n\n return {\n value: finalValue,\n imports: combineImports,\n name: item.name,\n includedProperties,\n };\n}\n","import {\n camelPathParamName,\n jsStringLiteralEscape,\n toColonRoutePath,\n} from '@orval/core';\n\n// MSW route params are camelized to match the generated mock function args.\n//\n// The result is a *source fragment*, not a plain value: the `\\\\:` below is two\n// literal backslashes so the emitted single-quoted literal compiles to MSW's\n// `\\:` escape for a colon that is not a param. Because of that, the spec text\n// has to be escaped for the literal here — before the colon escape is spliced\n// in — rather than at the emit site, where escaping again would double these\n// intentional backslashes.\nexport const getRouteMSW = (route: string, baseUrl = '*') =>\n `${jsStringLiteralEscape(baseUrl)}${toColonRoutePath(\n jsStringLiteralEscape(route).replaceAll(':', String.raw`\\\\:`),\n camelPathParamName,\n )}`;\n","import {\n type ContextSpec,\n generalJSTypesWithArray,\n type GeneratorImport,\n type GlobalMockOptions,\n isFunction,\n type MockOptions,\n type NormalizedOverrideOutput,\n type OpenApiDocument,\n resolveRef,\n type ResReqTypesValue,\n stringify,\n} from '@orval/core';\n\nimport { formatSchemaExampleValue } from '../faker/format-example-value';\nimport { getMockScalar } from '../faker/getters';\nimport {\n appendImportsDelta,\n collectSplitMockTypeImports,\n} from '../faker/imports';\n\nfunction getMockPropertiesWithoutFunc(\n properties:\n | Record<string, unknown>\n | ((spec: OpenApiDocument) => Record<string, unknown>),\n spec: OpenApiDocument,\n) {\n const resolvedProperties =\n typeof properties === 'function' ? properties(spec) : properties;\n const mockProperties: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(resolvedProperties)) {\n const implementation = isFunction(value)\n ? `(${String(value)})()`\n : (stringify(value) ?? 'undefined');\n\n mockProperties[key] = implementation.replaceAll(\n /import_faker\\.defaults|import_faker\\.faker|_faker\\.faker/g,\n 'faker',\n );\n }\n\n return mockProperties;\n}\n\nexport function getMockWithoutFunc(\n spec: OpenApiDocument,\n override?: NormalizedOverrideOutput,\n): MockOptions {\n const operations = override?.operations\n ? (() => {\n const operationMocks: Exclude<MockOptions['operations'], undefined> =\n {};\n\n for (const [key, value] of Object.entries(override.operations)) {\n if (!value?.mock?.properties) {\n continue;\n }\n\n operationMocks[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return operationMocks;\n })()\n : undefined;\n const tags = override?.tags\n ? (() => {\n const tagMocks: Exclude<MockOptions['tags'], undefined> = {};\n\n for (const [key, value] of Object.entries(override.tags)) {\n if (!value?.mock?.properties) {\n continue;\n }\n\n tagMocks[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return tagMocks;\n })()\n : undefined;\n const schemas = override?.mock?.schemas\n ? (() => {\n const schemaMocks: Exclude<MockOptions['schemas'], undefined> = {};\n\n for (const [key, value] of Object.entries(override.mock.schemas)) {\n if (!value?.properties) {\n continue;\n }\n\n schemaMocks[key] = {\n properties: getMockPropertiesWithoutFunc(value.properties, spec),\n };\n }\n\n return schemaMocks;\n })()\n : undefined;\n\n return {\n arrayMin: override?.mock?.arrayMin,\n arrayMax: override?.mock?.arrayMax,\n stringMin: override?.mock?.stringMin,\n stringMax: override?.mock?.stringMax,\n numberMin: override?.mock?.numberMin,\n numberMax: override?.mock?.numberMax,\n required: override?.mock?.required,\n nonNullable: override?.mock?.nonNullable,\n fractionDigits: override?.mock?.fractionDigits,\n ...(override?.mock?.properties\n ? {\n properties: getMockPropertiesWithoutFunc(\n override.mock.properties,\n spec,\n ),\n }\n : {}),\n ...(override?.mock?.format\n ? {\n format: getMockPropertiesWithoutFunc(override.mock.format, spec),\n }\n : {}),\n ...(operations ? { operations } : {}),\n ...(tags ? { tags } : {}),\n ...(schemas ? { schemas } : {}),\n };\n}\n\nfunction getMockNumberOption(\n mockOptionsWithoutFunc: Record<string, unknown>,\n key: 'arrayMin' | 'arrayMax',\n) {\n const value = mockOptionsWithoutFunc[key];\n return typeof value === 'number' ? value : undefined;\n}\n\nfunction getMockScalarJsTypes(\n definition: string,\n mockOptionsWithoutFunc: Record<string, unknown>,\n) {\n const isArray = definition.endsWith('[]');\n const type = isArray ? definition.slice(0, -2) : definition;\n const arrayMin = getMockNumberOption(mockOptionsWithoutFunc, 'arrayMin');\n const arrayMax = getMockNumberOption(mockOptionsWithoutFunc, 'arrayMax');\n\n switch (type) {\n case 'number': {\n const numArrParts: string[] = [];\n if (arrayMin !== undefined) numArrParts.push(`min: ${arrayMin}`);\n if (arrayMax !== undefined) numArrParts.push(`max: ${arrayMax}`);\n const numArrArg =\n numArrParts.length > 0 ? `{${numArrParts.join(', ')}}` : '';\n return isArray\n ? `Array.from({length: faker.number.int(${numArrArg})}, () => faker.number.int())`\n : 'faker.number.int()';\n }\n case 'string': {\n const strArrParts: string[] = [];\n if (arrayMin !== undefined) strArrParts.push(`min: ${arrayMin}`);\n if (arrayMax !== undefined) strArrParts.push(`max: ${arrayMax}`);\n const strArrArg =\n strArrParts.length > 0 ? `{${strArrParts.join(', ')}}` : '';\n return isArray\n ? `Array.from({length: faker.number.int(${strArrArg})}, () => faker.word.sample())`\n : 'faker.word.sample()';\n }\n default: {\n return 'undefined';\n }\n }\n}\n\ninterface GetResponsesMockDefinitionOptions {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n mockOptionsWithoutFunc: Record<string, unknown>;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpec;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}\n\nfunction getExampleEntries(examples: unknown): unknown[] {\n if (Array.isArray(examples)) {\n return examples;\n }\n\n if (examples && typeof examples === 'object') {\n return Object.values(examples as Record<string, unknown>);\n }\n\n return [];\n}\n\nfunction unwrapExampleValue(example: unknown): unknown {\n if (example && typeof example === 'object' && 'value' in example) {\n return (example as { value?: unknown }).value;\n }\n\n return example;\n}\n\nexport function getResponsesMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: GetResponsesMockDefinitionOptions) {\n const result = {\n definitions: [] as string[],\n imports: [] as GeneratorImport[],\n };\n const scalarMockOptions =\n mockOptions?.useExamples === undefined\n ? mockOptionsWithoutFunc\n : {\n ...mockOptionsWithoutFunc,\n useExamples: mockOptions.useExamples,\n };\n\n for (const response of responses) {\n const { value: definition, example, examples, imports, isRef } = response;\n let { originalSchema } = response;\n\n if (context.output.override.mock?.useExamples || mockOptions?.useExamples) {\n const exampleValue = unwrapExampleValue(\n example ??\n originalSchema?.example ??\n getExampleEntries(examples)[0] ??\n getExampleEntries(originalSchema?.examples)[0],\n );\n\n if (exampleValue !== undefined) {\n const formatted = formatSchemaExampleValue(\n exampleValue,\n originalSchema,\n context,\n );\n result.definitions.push(\n transformer ? transformer(formatted, returnType) : formatted,\n );\n continue;\n }\n }\n\n if (!definition || generalJSTypesWithArray.includes(definition)) {\n const value = getMockScalarJsTypes(definition, mockOptionsWithoutFunc);\n\n result.definitions.push(\n transformer ? transformer(value, returnType) : value,\n );\n continue;\n }\n\n if (!originalSchema && definition === 'Blob') {\n originalSchema = { type: 'string', format: 'binary' };\n } else if (!originalSchema) {\n continue;\n }\n\n const resolvedSchema = resolveRef(originalSchema, context).schema;\n\n // `imports` belongs to the response type entry, which core shares across\n // operations that resolve the same schema. Mock resolution appends the\n // value imports it needs (`Object.values(Enum)`), and only the delta is\n // reported below, so work on a copy: mutating the shared array would leak\n // mock-only value imports into every later client that imports the same\n // schema, turning its `import type` into a value import (#3931).\n const responseImports = imports ? [...imports] : [];\n const importsBefore = responseImports.length;\n const scalar = getMockScalar({\n item: {\n ...(resolvedSchema as Record<string, unknown>),\n name: definition,\n ...(context.output.override.enumGenerationType === 'enum' && isRef\n ? { isRef: true }\n : {}),\n },\n imports: responseImports,\n mockOptions: scalarMockOptions,\n operationId,\n tags,\n context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n });\n\n appendImportsDelta(result.imports, responseImports, importsBefore);\n if (scalar.imports !== responseImports) {\n appendImportsDelta(result.imports, scalar.imports, 0);\n }\n result.definitions.push(\n transformer ? transformer(scalar.value, returnType) : scalar.value,\n );\n }\n\n appendImportsDelta(\n result.imports,\n collectSplitMockTypeImports(splitMockImplementations),\n 0,\n );\n\n return result;\n}\n\ninterface GetMockDefinitionOptions {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n imports: GeneratorImport[];\n override: NormalizedOverrideOutput;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpec;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}\n\nexport function getMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n override,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: GetMockDefinitionOptions) {\n const mockOptionsWithoutFunc = getMockWithoutFunc(context.spec, override);\n\n const { definitions, imports } = getResponsesMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n });\n\n return {\n definition: '[' + definitions.join(', ') + ']',\n definitions,\n imports,\n };\n}\n\nexport function getMockOptionsDataOverride(\n operationTags: string[],\n operationId: string,\n override: NormalizedOverrideOutput,\n) {\n const responseOverride =\n override.operations[operationId]?.mock?.data ??\n operationTags\n .map((operationTag) => override.tags[operationTag]?.mock?.data)\n .find((e) => e !== undefined);\n const implementation = isFunction(responseOverride)\n ? `(${String(responseOverride)})()`\n : stringify(responseOverride);\n\n return implementation?.replaceAll(\n /import_faker\\.defaults|import_faker\\.faker|_faker\\.faker/g,\n 'faker',\n );\n}\n","import {\n type ClientMockGeneratorBuilder,\n escapeRegExp,\n generateDependencyImports,\n type GenerateMockImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GlobalMockOptions,\n isFunction,\n isMswMock,\n isObject,\n jsStringLiteralEscape,\n pascal,\n type ResReqTypesValue,\n type StrictMockSchemaKind,\n} from '@orval/core';\n\nimport { getDelay } from '../delay';\nimport { getRouteMSW, overrideVarName } from '../faker/getters';\nimport {\n applyStrictMockReturnType,\n collectStrictMockSchemaTypeNamesFromImplementation,\n formatMockFactoryDeclaration,\n getMockFactorySignatureParts,\n getSchemaTypeNamesFromResponses,\n getSimpleSchemaReturnType,\n getStrictMockSchemaKindsFromResponses,\n isStrictMock,\n mergeStrictMockSchemaKinds,\n mergeStrictMockSchemaTypeNames,\n} from '../mock-types';\nimport { getMockDefinition, getMockOptionsDataOverride } from './mocks';\n\nfunction getMSWDependencies(\n options?: GlobalMockOptions,\n): GeneratorDependency[] {\n const locale = options?.locale;\n\n const fakerDependency: GeneratorDependency = {\n exports: [{ name: 'faker', values: true }],\n dependency: locale ? `@faker-js/faker/locale/${locale}` : '@faker-js/faker',\n };\n\n const hasDelay =\n options && isMswMock(options) ? options.delay !== false : true;\n\n const exports = [\n { name: 'http', values: true },\n { name: 'HttpResponse', values: true },\n { name: 'RequestHandlerOptions', values: false },\n ];\n\n if (hasDelay) {\n exports.push({ name: 'delay', values: true });\n }\n\n return [{ exports, dependency: 'msw' }, fakerDependency];\n}\n\nexport const generateMSWImports: GenerateMockImports = ({\n implementation,\n imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n options,\n}) => {\n return generateDependencyImports(\n implementation,\n [...getMSWDependencies(options), ...imports],\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\nfunction generateDefinition(\n name: string,\n route: string,\n getResponseMockFunctionNameBase: string,\n handlerNameBase: string,\n { operationId, response, verb, tags }: GeneratorVerbOptions,\n { override, context, mock }: GeneratorOptions,\n returnType: string,\n status: string,\n responseImports: GeneratorImport[],\n responses: ResReqTypesValue[],\n contentTypes: string[],\n splitMockImplementations: string[],\n) {\n const oldSplitMockImplementations = [...splitMockImplementations];\n const { definitions, definition, imports } = getMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n override,\n context,\n mockOptions: isFunction(mock) ? undefined : mock,\n splitMockImplementations,\n });\n\n const mockData = getMockOptionsDataOverride(tags, operationId, override);\n\n let value = '';\n\n if (mockData) {\n value = mockData;\n } else if (definitions.length > 1) {\n value = `faker.helpers.arrayElement(${definition})`;\n } else if (definitions[0]) {\n value = definitions[0];\n }\n\n const isResponseOverridable = value.includes(overrideVarName);\n const isTextLikeContentType = (ct: string) =>\n ct.startsWith('text/') || ct === 'application/xml' || ct.endsWith('+xml');\n const isTypeExactlyString = (typeExpr: string) =>\n typeExpr.trim().replaceAll(/^\\(+|\\)+$/g, '') === 'string';\n const isUnionContainingString = (typeExpr: string) =>\n typeExpr\n .split('|')\n .map((part) => part.trim().replaceAll(/^\\(+|\\)+$/g, ''))\n .includes('string');\n const isBinaryLikeContentType = (ct: string) =>\n ct === 'application/octet-stream' ||\n ct === 'application/pdf' ||\n ct.startsWith('image/') ||\n ct.startsWith('audio/') ||\n ct.startsWith('video/') ||\n ct.startsWith('font/');\n\n const preferredContentType = isFunction(mock)\n ? undefined\n : (\n mock as { preferredContentType?: string } | undefined\n )?.preferredContentType?.toLowerCase();\n // match preferredContentType against `responses` (not the wider `contentTypes` which mixes success and error MIMEs).\n const preferredContentTypeMatch = preferredContentType\n ? responses.find(\n (r) => r.contentType.toLowerCase() === preferredContentType,\n )?.contentType\n : undefined;\n const contentTypesByPreference = preferredContentTypeMatch\n ? [preferredContentTypeMatch]\n : contentTypes;\n const responsesByPreference = preferredContentTypeMatch\n ? responses.filter((r) => r.contentType === preferredContentTypeMatch)\n : responses;\n\n const hasTextLikeContentType = contentTypes.some((ct) =>\n isTextLikeContentType(ct),\n );\n const isExactlyStringReturnType = isTypeExactlyString(returnType);\n\n // Keep text helpers for exact string success return types whenever a text-like\n // media type is available in the declared content types. This prevents a\n // preferredContentType that matches an error media type from forcing\n // HttpResponse.json() for text/plain success responses.\n const isTextResponse =\n (isExactlyStringReturnType && hasTextLikeContentType) ||\n contentTypesByPreference.some((ct) => isTextLikeContentType(ct));\n const isSchemaBinary = (r: ResReqTypesValue) =>\n r.originalSchema?.format === 'binary' ||\n (r.originalSchema?.contentMediaType === 'application/octet-stream' &&\n !r.originalSchema.contentEncoding);\n // When preferredContentType matched, only use schema-binary metadata to decide\n // the binary path — don't let the content-type name alone force it (issue #2962).\n // A structured schema (e.g. Pet) paired with application/octet-stream via\n // preference should not discard the body as new ArrayBuffer(0).\n // When no preference matched, keep the content-type heuristic so binary-like\n // types with no schema metadata still get the correct helper.\n const isBinaryResponse = preferredContentTypeMatch\n ? responsesByPreference.some((r) => isSchemaBinary(r))\n : contentTypesByPreference.some((ct) => isBinaryLikeContentType(ct)) ||\n responsesByPreference.some((r) => isSchemaBinary(r));\n // Bare ref names of schema-binary responses (include alias for collision-renamed imports).\n const binaryRefNames = responsesByPreference\n .filter((r) => isSchemaBinary(r))\n .flatMap((r) =>\n r.imports.flatMap((imp) =>\n imp.alias ? [imp.name, imp.alias] : [imp.name],\n ),\n );\n const isReturnHttpResponse = value && value !== 'undefined';\n\n const getResponseMockFunctionName = `${getResponseMockFunctionNameBase}${pascal(\n name,\n )}`;\n const handlerName = `${handlerNameBase}${pascal(name)}`;\n\n const addedSplitMockImplementations = splitMockImplementations.slice(\n oldSplitMockImplementations.length,\n );\n splitMockImplementations.push(...addedSplitMockImplementations);\n const mockImplementations =\n addedSplitMockImplementations.length > 0\n ? `${addedSplitMockImplementations.join('\\n\\n')}\\n\\n`\n : '';\n\n const binaryTypeRewriteRegex = new RegExp(\n String.raw`\\b(?:${['Blob', ...binaryRefNames].map((n) => escapeRegExp(n)).join('|')})\\b`,\n 'g',\n );\n const mockReturnType = isBinaryResponse\n ? returnType.replaceAll(binaryTypeRewriteRegex, 'ArrayBuffer')\n : returnType;\n\n // Detect when the return type is a union containing void (e.g. \"Resource | void\"\n // from endpoints with both 200 JSON and 204 No Content responses). In this case\n // we need runtime branching so that void responses use `new HttpResponse(null)`\n // instead of `HttpResponse.json()` which does not accept void/undefined.\n const isVoidUnionType =\n mockReturnType !== 'void' &&\n mockReturnType.split('|').some((part) => part.trim() === 'void');\n const noContentStatusCode = isVoidUnionType\n ? (responses.find((r) => r.value === 'void')?.key ?? '204')\n : undefined;\n const nonVoidMockReturnType = isVoidUnionType\n ? mockReturnType\n .split('|')\n .filter((part) => part.trim() !== 'void')\n .join(' | ')\n .trim()\n : mockReturnType;\n\n const hasJsonContentType = contentTypesByPreference.some(\n (ct) => ct.includes('json') || ct.includes('+json'),\n );\n const hasStringReturnType =\n isTypeExactlyString(mockReturnType) ||\n isUnionContainingString(mockReturnType);\n const overrideResponseType = `Partial<Extract<${nonVoidMockReturnType}, object>>`;\n const shouldPreferJsonResponse = hasJsonContentType && !hasStringReturnType;\n\n // When the return type is a union containing both string and structured types\n // (e.g. `string | Pet`) AND both text-like and JSON content types are available,\n // we need runtime branching to pick the correct HttpResponse helper based on\n // the actual resolved value type. Without this, objects could be JSON.stringify'd\n // and served under a text-like Content-Type (e.g. xml/html/plain), which is\n // semantically incorrect for structured JSON data.\n const needsRuntimeContentTypeSwitch =\n isTextResponse &&\n hasJsonContentType &&\n hasStringReturnType &&\n mockReturnType !== 'string';\n\n const mockOptionsFromOverride = override.mock;\n const strictMock = isStrictMock(mockOptionsFromOverride);\n const schemaTypeNames = strictMock\n ? getSchemaTypeNamesFromResponses(responses)\n : [];\n const strictMockReturnType = strictMock\n ? applyStrictMockReturnType(nonVoidMockReturnType, schemaTypeNames)\n : nonVoidMockReturnType;\n const simpleSchemaReturnType = strictMock\n ? getSimpleSchemaReturnType(nonVoidMockReturnType, schemaTypeNames)\n : undefined;\n\n let mockFactoryParam = '';\n let mockFactoryReturnType = nonVoidMockReturnType;\n let mockFactoryReturnCast = '';\n\n if (isResponseOverridable) {\n if (strictMock && simpleSchemaReturnType) {\n const signature = getMockFactorySignatureParts(\n simpleSchemaReturnType,\n mockOptionsFromOverride,\n {\n isOverridable: true,\n overrideType: overrideResponseType,\n },\n );\n mockFactoryParam = signature.param;\n mockFactoryReturnType = signature.returnType;\n mockFactoryReturnCast = signature.returnCast;\n } else {\n mockFactoryParam = `overrideResponse: ${overrideResponseType} = {}`;\n mockFactoryReturnType = strictMock\n ? strictMockReturnType\n : nonVoidMockReturnType;\n }\n } else if (strictMock) {\n mockFactoryReturnType = strictMockReturnType;\n }\n\n const mockImplementation = isReturnHttpResponse\n ? `${mockImplementations}${formatMockFactoryDeclaration(\n getResponseMockFunctionName,\n mockFactoryParam,\n mockFactoryReturnType,\n value,\n mockFactoryReturnCast,\n { omitReturnType: Boolean(mockData) },\n )}\\n\\n`\n : mockImplementations;\n\n const delay = getDelay(override, isFunction(mock) ? undefined : mock);\n const infoParam = 'info';\n const resolvedResponseExpr = `overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(${infoParam}) : overrideResponse)\n : ${getResponseMockFunctionName}()`;\n\n const statusCode = status === 'default' ? 200 : status.replace(/XX$/, '00');\n\n // Determine the preferred non-JSON content type for binary responses\n const binaryContentType =\n (preferredContentTypeMatch &&\n isBinaryLikeContentType(preferredContentTypeMatch)\n ? preferredContentTypeMatch\n : contentTypes.find((ct) => isBinaryLikeContentType(ct))) ??\n 'application/octet-stream';\n\n // Pick the most specific MSW response helper based on the first\n // text-like content type so the correct Content-Type header is set.\n // MSW provides HttpResponse.xml() for application/xml and +xml,\n // HttpResponse.html() for text/html, and HttpResponse.text() for\n // all other text/* types.\n const shouldIgnorePreferredForTextHelper =\n isExactlyStringReturnType &&\n !!preferredContentTypeMatch &&\n !isTextLikeContentType(preferredContentTypeMatch) &&\n hasTextLikeContentType;\n const firstTextCt = shouldIgnorePreferredForTextHelper\n ? contentTypes.find((ct) => isTextLikeContentType(ct))\n : contentTypesByPreference.find((ct) => isTextLikeContentType(ct));\n const textHelper =\n firstTextCt === 'application/xml' || firstTextCt?.endsWith('+xml')\n ? 'xml'\n : firstTextCt === 'text/html'\n ? 'html'\n : 'text';\n\n // MSW's HttpResponse helpers set a default Content-Type that may differ\n // from the OpenAPI-declared media type (e.g. application/problem+json is\n // served as application/json by HttpResponse.json(), application/xml is\n // served as text/xml by HttpResponse.xml()). Emit an explicit\n // Content-Type header whenever the resolved media type diverges from the\n // helper default so vendor/problem-details contracts survive the mock.\n const firstJsonCt = contentTypesByPreference.find((ct) =>\n ct.includes('json'),\n );\n const textHelperDefaultContentType =\n textHelper === 'xml'\n ? 'text/xml'\n : textHelper === 'html'\n ? 'text/html'\n : 'text/plain';\n const jsonCtHeaderSuffix =\n firstJsonCt && firstJsonCt !== 'application/json'\n ? `, headers: { 'Content-Type': '${jsStringLiteralEscape(firstJsonCt)}' }`\n : // When preferredContentType matched a non-JSON type (e.g. application/octet-stream)\n // and the structured schema falls through to HttpResponse.json(), emit the\n // selected media type as the Content-Type so the contract survives.\n preferredContentTypeMatch && !preferredContentTypeMatch.includes('json')\n ? `, headers: { 'Content-Type': '${jsStringLiteralEscape(\n preferredContentTypeMatch,\n )}' }`\n : '';\n const textCtHeaderSuffix =\n firstTextCt && firstTextCt !== textHelperDefaultContentType\n ? `, headers: { 'Content-Type': '${jsStringLiteralEscape(firstTextCt)}' }`\n : '';\n\n let responseBody: string;\n // Use a prelude to evaluate the override expression once into a temp variable\n // (the expression contains `await` so must not be duplicated). Only emit it\n // when we actually generate a `*ResponseMock()` helper — otherwise the\n // prelude would reference a function that doesn't exist (issue #3270).\n let responsePrelude = '';\n if (isReturnHttpResponse) {\n if (isBinaryResponse) {\n responsePrelude = `const binaryBody = ${resolvedResponseExpr};`;\n } else if (isVoidUnionType || needsRuntimeContentTypeSwitch) {\n responsePrelude = `const resolvedBody = ${resolvedResponseExpr};`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n responsePrelude = `const resolvedBody = ${resolvedResponseExpr};\n const textBody = typeof resolvedBody === 'string' ? resolvedBody : JSON.stringify(resolvedBody ?? null);`;\n }\n }\n if (!isReturnHttpResponse) {\n responseBody = `new HttpResponse(null,\n { status: ${statusCode}\n })`;\n } else if (isBinaryResponse) {\n responseBody = `HttpResponse.arrayBuffer(\n binaryBody instanceof ArrayBuffer\n ? binaryBody\n : new ArrayBuffer(0),\n { status: ${statusCode},\n headers: { 'Content-Type': '${jsStringLiteralEscape(binaryContentType)}' }\n })`;\n } else if (isVoidUnionType) {\n // Runtime branching for void union types (e.g. 200 JSON + 204 No Content).\n // When the resolved body is undefined, return an empty response with the\n // no-content status code; otherwise use the appropriate response helper.\n let nonVoidBody: string;\n if (needsRuntimeContentTypeSwitch) {\n nonVoidBody = `typeof resolvedBody === 'string'\n ? HttpResponse.${textHelper}(resolvedBody, { status: ${statusCode}${textCtHeaderSuffix} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode}${jsonCtHeaderSuffix} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n nonVoidBody = `HttpResponse.${textHelper}(\n typeof resolvedBody === 'string' ? resolvedBody : JSON.stringify(resolvedBody ?? null),\n { status: ${statusCode}${textCtHeaderSuffix} })`;\n } else {\n nonVoidBody = `HttpResponse.json(resolvedBody, { status: ${statusCode}${jsonCtHeaderSuffix} })`;\n }\n responseBody = `resolvedBody === undefined\n ? new HttpResponse(null, { status: ${noContentStatusCode} })\n : ${nonVoidBody}`;\n } else if (needsRuntimeContentTypeSwitch) {\n // Runtime branching: when the resolved value is a string, use the\n // appropriate text helper; otherwise fall back to HttpResponse.json()\n // so objects are never JSON.stringify'd under a text/xml Content-Type.\n responseBody = `typeof resolvedBody === 'string'\n ? HttpResponse.${textHelper}(resolvedBody, { status: ${statusCode}${textCtHeaderSuffix} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode}${jsonCtHeaderSuffix} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n responseBody = `HttpResponse.${textHelper}(textBody,\n { status: ${statusCode}${textCtHeaderSuffix}\n })`;\n } else {\n responseBody = `HttpResponse.json(${resolvedResponseExpr},\n { status: ${statusCode}${jsonCtHeaderSuffix}\n })`;\n }\n\n const infoType = `Parameters<Parameters<typeof http.${verb}>[1]>[0]`;\n\n const handlerImplementation = `\nexport const ${handlerName} = (overrideResponse?: ${mockReturnType} | ((${infoParam}: ${infoType}) => Promise<${mockReturnType}> | ${mockReturnType}), options?: RequestHandlerOptions) => {\n return http.${verb}('${route}', async (${infoParam}: ${infoType}) => {${\n delay === false\n ? ''\n : `await delay(${isFunction(delay) ? `(${String(delay)})()` : String(delay)});`\n }\n ${isReturnHttpResponse ? '' : `if (typeof overrideResponse === 'function') {await overrideResponse(info); }`}\n ${responsePrelude}\n return ${responseBody}\n }, options)\n}\\n`;\n\n const includeResponseImports = [\n ...imports,\n ...response.imports.filter((r) => {\n // Only keep imports referenced in the mock. Aliased imports\n // (`Foo as __Foo`) reference the alias rather than the bare name, so\n // match against either. Mirrors `addDependency` in core/generators/imports.ts (#3269).\n const searchWords = [r.alias, r.name]\n .filter((p): p is string => Boolean(p?.length))\n .map((part) => escapeRegExp(part))\n .join('|');\n if (!searchWords) {\n return false;\n }\n const reg = new RegExp(String.raw`\\b(${searchWords})\\b`);\n return reg.test(handlerImplementation) || reg.test(mockImplementation);\n }),\n ];\n\n return {\n implementation: {\n function: mockImplementation,\n handlerName: handlerName,\n handler: handlerImplementation,\n },\n imports: includeResponseImports,\n strictMockSchemaTypeNames: strictMock\n ? mergeStrictMockSchemaTypeNames(\n schemaTypeNames,\n // Nested split factories: see collectStrictMockSchemaTypeNamesFromImplementation\n // re regex-coupling note — prefer threading names from getters long-term.\n collectStrictMockSchemaTypeNamesFromImplementation(\n mockImplementation,\n ),\n )\n : undefined,\n strictMockSchemaKinds: strictMock\n ? mergeStrictMockSchemaKinds(\n getStrictMockSchemaKindsFromResponses(responses, context),\n Object.fromEntries(\n (\n collectStrictMockSchemaTypeNamesFromImplementation(\n mockImplementation,\n ) ?? []\n ).map((name) => [name, 'object' satisfies StrictMockSchemaKind]),\n ),\n )\n : undefined,\n };\n}\n\nexport function generateMSW(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder {\n const { pathRoute, override, mock } = generatorOptions;\n const { operationName, response } = generatorVerbOptions;\n\n const overrideBaseUrl =\n override.mock && 'baseUrl' in override.mock\n ? (override.mock as { baseUrl?: string }).baseUrl\n : undefined;\n const mockBaseUrl = mock && isMswMock(mock) ? mock.baseUrl : undefined;\n const route = getRouteMSW(pathRoute, overrideBaseUrl ?? mockBaseUrl);\n\n // Derive names from operationName (not operationId): splitByContentType keeps\n // one operationId across variants but suffixes operationName (e.g. *WithJson /\n // *WithFormData), and the client side already names functions from it. Using\n // operationId here would emit duplicate handler names and break tsc. See #3342.\n const handlerName = `get${pascal(operationName)}MockHandler`;\n const getResponseMockFunctionName = `get${pascal(operationName)}ResponseMock`;\n\n const splitMockImplementations: string[] = [];\n\n const baseDefinition = generateDefinition(\n '',\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n response.definition.success,\n response.types.success[0]?.key ?? '200',\n response.imports,\n response.types.success,\n response.contentTypes,\n splitMockImplementations,\n );\n\n const mockImplementations = [baseDefinition.implementation.function];\n const handlerImplementations = [baseDefinition.implementation.handler];\n const imports = [...baseDefinition.imports];\n const strictMockSchemaTypeNames = new Set(\n baseDefinition.strictMockSchemaTypeNames,\n );\n const strictMockSchemaKinds: Record<string, StrictMockSchemaKind> = {\n ...baseDefinition.strictMockSchemaKinds,\n };\n\n if (\n generatorOptions.mock &&\n isObject(generatorOptions.mock) &&\n generatorOptions.mock.generateEachHttpStatus\n ) {\n for (const statusResponse of [\n ...response.types.success,\n ...response.types.errors,\n ]) {\n const definition = generateDefinition(\n statusResponse.key,\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n statusResponse.value,\n statusResponse.key,\n response.imports,\n [statusResponse],\n [statusResponse.contentType],\n splitMockImplementations,\n );\n mockImplementations.push(definition.implementation.function);\n handlerImplementations.push(definition.implementation.handler);\n imports.push(...definition.imports);\n for (const name of definition.strictMockSchemaTypeNames ?? []) {\n strictMockSchemaTypeNames.add(name);\n }\n if (definition.strictMockSchemaKinds) {\n for (const [name, kind] of Object.entries(\n definition.strictMockSchemaKinds,\n )) {\n strictMockSchemaKinds[name] ??= kind;\n }\n }\n }\n }\n\n const aggregatedStrictNames = [...strictMockSchemaTypeNames];\n\n return {\n implementation: {\n function: mockImplementations.join('\\n'),\n handlerName,\n handler: handlerImplementations.join('\\n'),\n },\n imports: imports,\n strictMockSchemaTypeNames:\n aggregatedStrictNames.length > 0 ? aggregatedStrictNames : undefined,\n strictMockSchemaKinds: mergeStrictMockSchemaKinds(strictMockSchemaKinds),\n };\n}\n","import {\n type ClientMockGeneratorBuilder,\n type ContextSpec,\n generateDependencyImports,\n type GenerateMockImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorOptions,\n type GeneratorSchema,\n type GeneratorVerbOptions,\n type GlobalMockOptions,\n pascal,\n type StrictMockSchemaKind,\n} from '@orval/core';\n\nimport {\n formatMockFactoryDeclaration,\n classifyStrictMockSchemaType,\n collectStrictMockSchemaTypeNamesFromImplementation,\n getMockFactorySignatureParts,\n getStrictMockTypeName,\n isStrictMock,\n mergeStrictMockSchemaKinds,\n} from '../mock-types';\nimport { appendImportsDelta } from './imports';\nimport { generateMSW } from '../msw';\nimport { getMockWithoutFunc } from '../msw/mocks';\nimport { getMockScalar } from './getters';\n\nfunction getFakerDependencies(\n options?: GlobalMockOptions,\n): GeneratorDependency[] {\n const locale = options?.locale;\n\n return [\n {\n exports: [{ name: 'faker', values: true }],\n dependency: locale\n ? `@faker-js/faker/locale/${locale}`\n : '@faker-js/faker',\n },\n ];\n}\n\n/**\n * Emits the import header for a faker-only mock file. Faker output never\n * imports from `msw`, so this only emits `import { faker } from '@faker-js/faker'`\n * (or the locale-scoped variant) plus any operation-specific imports.\n */\nexport const generateFakerImports: GenerateMockImports = ({\n implementation,\n imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n options,\n}) => {\n return generateDependencyImports(\n implementation,\n [...getFakerDependencies(options), ...imports],\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\n/**\n * Generates the faker-only mock output for a single operation. This reuses\n * the response-factory portion of {@link generateMSW} and strips out the\n * handler and aggregator entries so callers can write a standalone\n * `<file>.faker.ts` with no `msw` dependency.\n */\nexport function generateFaker(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder {\n const result = generateMSW(generatorVerbOptions, generatorOptions);\n return {\n implementation: {\n function: result.implementation.function,\n handler: '',\n handlerName: '',\n },\n imports: result.imports,\n strictMockSchemaTypeNames: result.strictMockSchemaTypeNames,\n strictMockSchemaKinds: result.strictMockSchemaKinds,\n };\n}\n\nexport interface GenerateFakerForSchemasResult {\n implementation: string;\n imports: GeneratorImport[];\n strictMockSchemaTypeNames?: string[];\n strictMockSchemaKinds?: Record<string, StrictMockSchemaKind>;\n}\n\n/**\n * Builds the contents of a consolidated faker mock file for every entry under\n * `components/schemas`. Each schema produces a `get<SchemaName>Mock(overrides)`\n * factory in the spirit of the existing per-operation `get<Op>ResponseMock`\n * helpers. Opt in via `mock.generators: [{ type: 'faker', schemas: true }]`.\n *\n * Returns the function bodies plus any `GeneratorImport` references the\n * factories need so the writer can hoist them into the file header.\n */\nexport function generateFakerForSchemas(\n schemas: GeneratorSchema[],\n context: ContextSpec,\n options: GlobalMockOptions,\n): GenerateFakerForSchemasResult {\n const factories: string[] = [];\n const strictMockTypeNames = new Set<string>();\n const strictMockSchemaKinds: Record<string, StrictMockSchemaKind> = {};\n const allImports: GeneratorImport[] = [];\n // Shared across schemas so we emit each helper (e.g. an `allOf`-discriminator\n // sub-factory) once even when several schemas reference the same union arm.\n const splitMockImplementations: string[] = [];\n\n // Names of the factories we're about to emit in this file. When the\n // delegation logic in `resolveMockValue` produces a `getXMock()` call for\n // a `components/schemas` ref, it pushes a `{ schemaFactory: true }` import\n // — but if `X` is itself one of the schemas being generated here, the\n // factory lives in this very file and must not be imported.\n const localFactoryNames = new Set(\n schemas.filter((s) => !!s.schema).map((s) => `get${pascal(s.name)}Mock`),\n );\n const localMockTypeNames = new Set(\n schemas\n .filter((s) => !!s.schema)\n .map((s) => getStrictMockTypeName(pascal(s.name))),\n );\n\n // Serialize override.mock.properties functions the same way operation\n // response mocks do (IIFE expressions), not raw function references.\n const mockOptions = getMockWithoutFunc(context.spec, context.output.override);\n\n for (const generatorSchema of schemas) {\n const { name, schema } = generatorSchema;\n if (!schema) continue;\n\n const factoryName = `get${pascal(name)}Mock`;\n const factoryImports: GeneratorImport[] = [];\n const factoryImportsBefore = factoryImports.length;\n const schemaName = pascal(name);\n\n const result = getMockScalar({\n item: {\n ...(schema as Record<string, unknown>),\n name: schemaName,\n } as Parameters<typeof getMockScalar>[0]['item'],\n imports: factoryImports,\n mockOptions,\n operationId: name,\n tags: [],\n context,\n // Seed the schema under generation on both stacks so allOf/oneOf cycles\n // (e.g. System.Xml.Linq-style inheritance) terminate instead of overflowing\n // the stack while building consolidated schema factories (#3590).\n existingReferencedProperties: [schemaName],\n existingReferencedAllOfRefs: [schemaName],\n splitMockImplementations,\n allowOverride: true,\n isRef: false,\n } as Parameters<typeof getMockScalar>[0]);\n\n appendImportsDelta(allImports, factoryImports, factoryImportsBefore);\n if (result.imports !== factoryImports) {\n appendImportsDelta(allImports, result.imports, 0);\n }\n\n // Match the behavior of operation-response factories: only declare the\n // `overrideResponse` parameter when the generated expression actually\n // references it (top-level object schemas). Array / scalar / enum\n // schemas don't splice an override, so we omit the parameter rather than\n // emit a `Partial<Pet[]>` signature TS can't satisfy.\n const typeName = pascal(name);\n const isOverridable = result.value.includes('overrideResponse');\n const { param, returnType, returnCast } = getMockFactorySignatureParts(\n typeName,\n mockOptions,\n {\n isOverridable,\n overrideType: `Partial<${typeName}>`,\n },\n );\n const factory = formatMockFactoryDeclaration(\n factoryName,\n param,\n returnType,\n result.value,\n returnCast,\n );\n\n if (isStrictMock(mockOptions)) {\n strictMockTypeNames.add(typeName);\n strictMockSchemaKinds[typeName] = classifyStrictMockSchemaType(schema);\n }\n\n factories.push(factory);\n\n // Track the schema type itself as an import so writers can reference it\n // from the generated factory file.\n allImports.push({\n name: pascal(name),\n values: false,\n });\n }\n\n // De-duplicate imports by name+alias so the header doesn't list the same\n // schema twice when multiple factories reference it. \"Any value wins\":\n // if the same name is pushed both as a type-only import and as a value\n // import (e.g. an enum used both in an `as Foo` cast and an\n // `Object.values(Foo)` call), we keep the value form. A plain\n // `import { Foo }` works in both annotation and runtime positions, so\n // emitting the value form avoids `TS1361: 'X' cannot be used as a value\n // because it was imported using 'import type'`.\n const mergedImports = new Map<string, GeneratorImport>();\n for (const imp of allImports) {\n // Drop self-references: `get<Schema>Mock` factories generated in this\n // very file (pushed when delegation in `resolveMockValue` produced a\n // local factory call). Without this we'd emit\n // `import { getPetMock } from '.'` next to its own `export const`.\n if (imp.schemaFactory && localFactoryNames.has(imp.name)) continue;\n if (imp.schemaFactory && !imp.values && localMockTypeNames.has(imp.name)) {\n continue;\n }\n\n const key = `${imp.name}::${imp.alias ?? ''}`;\n const existing = mergedImports.get(key);\n if (!existing) {\n mergedImports.set(key, imp);\n continue;\n }\n if (!existing.values && imp.values) {\n mergedImports.set(key, imp);\n }\n }\n const uniqueImports = [...mergedImports.values()];\n\n // Reference `options` so unused-parameter rules don't complain; future\n // schema-specific behavior (e.g. naming convention) will read from it.\n void options;\n\n // Helper factories from union/discriminator handling (`splitMockImplementations`)\n // are emitted before the public `get<Schema>Mock` factories so call sites\n // declared after them resolve cleanly without TS hoisting concerns.\n const implementation = [...splitMockImplementations, ...factories]\n .filter(Boolean)\n .join('\\n\\n');\n\n for (const name of collectStrictMockSchemaTypeNamesFromImplementation(\n implementation,\n )) {\n strictMockTypeNames.add(name);\n strictMockSchemaKinds[name] ??= 'object';\n }\n\n const aggregatedStrictNames = [...strictMockTypeNames];\n\n return {\n implementation,\n imports: uniqueImports,\n strictMockSchemaTypeNames:\n aggregatedStrictNames.length > 0 ? aggregatedStrictNames : undefined,\n strictMockSchemaKinds: mergeStrictMockSchemaKinds(strictMockSchemaKinds),\n };\n}\n","import type {\n FakerMockOptions,\n GenerateMockImports,\n GeneratorOptions,\n GeneratorVerbOptions,\n GlobalMockOptions,\n MswMockOptions,\n} from '@orval/core';\nimport { OutputMockType } from '@orval/core';\n\nimport { generateFaker, generateFakerImports } from './faker';\nimport { generateMSW, generateMSWImports } from './msw';\n\nexport const DEFAULT_MSW_OPTIONS: MswMockOptions = {\n type: OutputMockType.MSW,\n useExamples: false,\n};\n\nexport const DEFAULT_FAKER_OPTIONS: FakerMockOptions = {\n type: OutputMockType.FAKER,\n useExamples: false,\n schemas: false,\n operationResponses: true,\n};\n\n/**\n * Returns the default GlobalMockOptions for a given mock type. Used when\n * normalizing user-provided entries in `output.mock.generators` so callers\n * can omit the per-type defaults.\n */\nexport const getDefaultMockOptionsForType = (\n type: GlobalMockOptions['type'],\n): GlobalMockOptions => {\n switch (type) {\n case OutputMockType.FAKER: {\n return DEFAULT_FAKER_OPTIONS;\n }\n case OutputMockType.MSW: {\n return DEFAULT_MSW_OPTIONS;\n }\n }\n};\n\n/**\n * Dispatches mock-file imports generation to the appropriate generator based\n * on the `OutputMockType` discriminator on the mock options.\n */\nexport const generateMockImports: GenerateMockImports = (importOptions) => {\n switch (importOptions.options?.type) {\n case OutputMockType.FAKER: {\n return generateFakerImports(importOptions);\n }\n default: {\n return generateMSWImports(importOptions);\n }\n }\n};\n\n/**\n * Dispatches per-operation mock generation to the appropriate generator\n * based on the `OutputMockType` discriminator. Each entry in\n * `output.mock.generators` is dispatched here individually.\n */\nexport function generateMock(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: Omit<GeneratorOptions, 'mock'> & {\n mock: GlobalMockOptions;\n },\n) {\n const { context } = generatorOptions;\n const previousActiveMockOutputType = context.activeMockOutputType;\n context.activeMockOutputType = generatorOptions.mock.type;\n\n try {\n switch (generatorOptions.mock.type) {\n case OutputMockType.FAKER: {\n return generateFaker(generatorVerbOptions, generatorOptions);\n }\n default: {\n return generateMSW(generatorVerbOptions, generatorOptions);\n }\n }\n } finally {\n context.activeMockOutputType = previousActiveMockOutputType;\n }\n}\n\nexport type { GenerateFakerForSchemasResult } from './faker';\nexport {\n generateFaker,\n generateFakerForSchemas,\n generateFakerImports,\n} from './faker';\nexport {\n buildStrictMockTypeFileHeader,\n dedupeStrictMockTypeDeclarations,\n} from './mock-types';\nexport { generateMSW, generateMSWImports } from './msw';\n"],"mappings":";;;AAcA,SAAgB,aACd,aACS;CACT,OAAO,QACL,eAAe,YAAY,YAAY,YAAY,WACrD;AACF;AAEA,SAAgB,sBAAsB,UAA0B;CAC9D,OAAO,GAAG,SAAS;AACrB;AAEA,SAAgB,sCAA8C;CAC5D,OAAO;;;;;;;;;;;AAWT;AAeA,SAAgB,6BACd,QACA,SACsB;CACtB,IAAI,CAAC,QACH,OAAO;CAGT,IACE,OAAO,WAAW,YACjB,OAAO,qBAAqB,8BAC3B,CAAC,OAAO,iBAEV,OAAO;CA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A;CACA,MAAM,EAAE,YAAY;CACpB,MAAM,+BAA+B,QAAQ;CAC7C,QAAQ,uBAAuB,iBAAiB,KAAK;CAErD,IAAI;EACF,QAAQ,iBAAiB,KAAK,MAA9B;GACE,KAAK,eAAe,OAClB,OAAO,cAAc,sBAAsB,gBAAgB;GAE7D,SACE,OAAO,YAAY,sBAAsB,gBAAgB;EAE7D;CACF,UAAU;EACR,QAAQ,uBAAuB;CACjC;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["getReferenceName","valWithRequired"],"sources":["../src/mock-types.ts","../src/faker/imports.ts","../src/delay.ts","../src/faker/getters/all-of-required.ts","../src/faker/compatible-v9.ts","../src/faker/constants.ts","../src/faker/getters/object.ts","../src/faker/getters/array-item-factory.ts","../src/faker/format-example-value.ts","../src/faker/getters/scalar.ts","../src/faker/resolvers/value.ts","../src/faker/getters/combine.ts","../src/faker/getters/route.ts","../src/msw/mocks.ts","../src/msw/index.ts","../src/faker/index.ts","../src/index.ts"],"sourcesContent":["import {\n escapeRegExp,\n type ContextSpec,\n type FinalizeMockImplementationOptions,\n type MockOptions,\n type OpenApiReferenceObject,\n type OpenApiSchemaObject,\n resolveRef,\n type ResReqTypesValue,\n type StrictMockSchemaKind,\n} from '@orval/core';\n\nexport type { StrictMockSchemaKind };\n\nexport function isStrictMock(\n mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>,\n): boolean {\n return Boolean(\n mockOptions && mockOptions.required && mockOptions.nonNullable,\n );\n}\n\nexport function getStrictMockTypeName(typeName: string): string {\n return `${typeName}Mock`;\n}\n\nexport function getStrictMockHelperTypeDeclarations(): string {\n return `export type KeysWithNull<O> = {\n [K in keyof O]-?: null extends O[K] ? K : never;\n}[keyof O];\n\nexport type MockWithNullableOverrides<\n T,\n O extends Partial<T>,\n M extends Record<keyof T, unknown>,\n> = Omit<M, Extract<KeysWithNull<O>, keyof T>> & {\n [K in Extract<KeysWithNull<O>, keyof T>]: M[K] | null;\n};`;\n}\n\nexport function isSchemaNullableAtRoot(schema?: OpenApiSchemaObject): boolean {\n if (!schema) {\n return false;\n }\n\n if (schema.nullable === true) {\n return true;\n }\n\n const type = schema.type;\n return Array.isArray(type) && type.includes('null');\n}\n\nexport function classifyStrictMockSchemaType(\n schema?: OpenApiSchemaObject,\n context?: ContextSpec,\n): StrictMockSchemaKind {\n if (!schema) {\n return 'object';\n }\n\n if (\n schema.format === 'binary' ||\n (schema.contentMediaType === 'application/octet-stream' &&\n !schema.contentEncoding)\n ) {\n return 'binary';\n }\n\n if (typeof schema.$ref === 'string') {\n if (context) {\n const { schema: resolved } = resolveRef(\n schema as OpenApiReferenceObject,\n context,\n );\n return classifyStrictMockSchemaType(\n resolved as OpenApiSchemaObject,\n context,\n );\n }\n\n return 'object';\n }\n\n if (\n schema.type === 'object' ||\n schema.properties ||\n isComposedObjectSchema(schema)\n ) {\n return 'object';\n }\n\n return 'alias';\n}\n\nfunction isComposedObjectSchema(schema: OpenApiSchemaObject): boolean {\n const branches = (schema.oneOf ?? schema.anyOf ?? schema.allOf) as\n | (OpenApiSchemaObject | OpenApiReferenceObject)[]\n | undefined;\n if (!branches?.length) {\n return false;\n }\n\n return branches.some((branch) => {\n const item = branch as OpenApiSchemaObject;\n if (\n typeof item.$ref === 'string' ||\n item.type === 'object' ||\n item.properties\n ) {\n return true;\n }\n\n return isComposedObjectSchema(item);\n });\n}\n\nexport function getStrictMockTypeDeclaration(\n typeName: string,\n kind: StrictMockSchemaKind = 'object',\n options?: { schemaNullableAtRoot?: boolean },\n): string {\n const mockTypeName = getStrictMockTypeName(typeName);\n\n if (kind === 'alias') {\n return `export type ${mockTypeName} = ${typeName};`;\n }\n\n if (kind === 'binary') {\n return `export type ${mockTypeName} = ArrayBuffer;`;\n }\n\n const mappedType = `{\\n [K in keyof Required<NonNullable<${typeName}>>]: NonNullable<Required<NonNullable<${typeName}>>[K]>;\\n}`;\n const objectMockType = options?.schemaNullableAtRoot\n ? `${mappedType} | null`\n : mappedType;\n\n return `export type ${mockTypeName} = ${objectMockType};`;\n}\n\nexport function getStrictMockTypeDeclarations(\n typeNames: Iterable<string>,\n kinds?: Readonly<Record<string, StrictMockSchemaKind>>,\n nullableAtRoot?: Readonly<Record<string, boolean>>,\n): string {\n const unique = [...new Set(typeNames)];\n if (unique.length === 0) {\n return '';\n }\n\n return unique\n .map((typeName) =>\n getStrictMockTypeDeclaration(typeName, kinds?.[typeName] ?? 'object', {\n schemaNullableAtRoot: nullableAtRoot?.[typeName],\n }),\n )\n .join('\\n\\n');\n}\n\nfunction strictMockResolvedImportMatches(\n typeName: string,\n resolvedImport: { name?: string; alias?: string } | undefined,\n importBareName?: string,\n): boolean {\n const resolvedName = resolvedImport?.name;\n if (!resolvedName) {\n return false;\n }\n\n if (typeName === resolvedName) {\n return true;\n }\n\n if (resolvedImport.alias && typeName === resolvedImport.alias) {\n return true;\n }\n\n return importBareName !== undefined && importBareName === resolvedName;\n}\n\nfunction resolveStrictMockSchemaForTypeName(\n typeName: string,\n originalSchema: OpenApiSchemaObject | undefined,\n context?: ContextSpec,\n importBareName?: string,\n): OpenApiSchemaObject | undefined {\n if (!originalSchema) {\n return undefined;\n }\n\n if (!context) {\n return originalSchema;\n }\n\n const branches = (originalSchema.oneOf ??\n originalSchema.anyOf ??\n originalSchema.allOf) as\n | (OpenApiSchemaObject | OpenApiReferenceObject)[]\n | undefined;\n\n if (branches?.length) {\n for (const branch of branches) {\n if (typeof branch.$ref !== 'string') {\n continue;\n }\n\n const resolved = resolveRef(branch as OpenApiReferenceObject, context);\n if (\n strictMockResolvedImportMatches(\n typeName,\n resolved.imports[0],\n importBareName,\n )\n ) {\n return resolved.schema as OpenApiSchemaObject;\n }\n }\n\n return undefined;\n }\n\n if (typeof originalSchema.$ref === 'string') {\n const resolved = resolveRef(\n originalSchema as OpenApiReferenceObject,\n context,\n );\n if (\n strictMockResolvedImportMatches(\n typeName,\n resolved.imports[0],\n importBareName,\n )\n ) {\n return resolved.schema as OpenApiSchemaObject;\n }\n\n return undefined;\n }\n\n return originalSchema;\n}\n\nexport function getMockFactoryReturnType(\n typeName: string,\n mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>,\n): string {\n return isStrictMock(mockOptions) ? getStrictMockTypeName(typeName) : typeName;\n}\n\nexport interface MockFactorySignatureParts {\n param: string;\n returnType: string;\n returnCast: string;\n}\n\nexport interface GetMockFactorySignaturePartsOptions {\n isOverridable?: boolean;\n overrideType?: string;\n}\n\nexport function getMockFactorySignatureParts(\n typeName: string,\n mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>,\n options: GetMockFactorySignaturePartsOptions = {},\n): MockFactorySignatureParts {\n const isOverridable = options.isOverridable ?? false;\n const overrideType = options.overrideType ?? `Partial<${typeName}>`;\n const mockTypeName = getStrictMockTypeName(typeName);\n\n if (!isOverridable) {\n return {\n param: '',\n returnType: getMockFactoryReturnType(typeName, mockOptions),\n returnCast: '',\n };\n }\n\n if (isStrictMock(mockOptions)) {\n return {\n param: `<O extends ${overrideType} = {}>(overrideResponse?: O)`,\n returnType: `MockWithNullableOverrides<${typeName}, O, ${mockTypeName}>`,\n returnCast: ` as MockWithNullableOverrides<${typeName}, O, ${mockTypeName}>`,\n };\n }\n\n return {\n param: `overrideResponse: ${overrideType} = {}`,\n returnType: typeName,\n returnCast: '',\n };\n}\n\nexport function getSimpleSchemaReturnType(\n returnType: string,\n schemaTypeNames: string[],\n): string | undefined {\n const trimmed = returnType.trim();\n return schemaTypeNames.includes(trimmed) ? trimmed : undefined;\n}\n\nexport function formatMockFactoryDeclaration(\n factoryName: string,\n param: string,\n returnType: string,\n body: string,\n returnCast: string,\n options?: { omitReturnType?: boolean; terminateStatement?: boolean },\n): string {\n const header = param\n ? param.startsWith('<')\n ? `export const ${factoryName} = ${param}`\n : `export const ${factoryName} = (${param})`\n : `export const ${factoryName} = ()`;\n\n const returnTypeAnnotation =\n options?.omitReturnType || !returnType ? '' : `: ${returnType}`;\n\n const statementTerminator =\n returnCast || options?.terminateStatement ? ';' : '';\n\n return `${header}${returnTypeAnnotation} => (${body})${returnCast}${statementTerminator}`;\n}\n\nexport function getSchemaTypeNamesFromResponses(\n responses: ResReqTypesValue[],\n): string[] {\n const names = new Set<string>();\n\n for (const response of responses) {\n for (const imp of response.imports) {\n if (imp.values || imp.schemaFactory) {\n continue;\n }\n\n const importName = imp.alias ?? imp.name;\n if (/^[A-Z]\\w*$/.test(importName)) {\n names.add(importName);\n }\n }\n\n const { value } = response;\n if (!value) {\n continue;\n }\n\n const baseType = value.endsWith('[]') ? value.slice(0, -2) : value;\n if (/^[A-Z]\\w*$/.test(baseType)) {\n names.add(baseType);\n }\n }\n\n return [...names];\n}\n\nexport function getStrictMockSchemaKindsFromResponses(\n responses: ResReqTypesValue[],\n context?: ContextSpec,\n): Record<string, StrictMockSchemaKind> {\n const kinds: Record<string, StrictMockSchemaKind> = {};\n\n for (const response of responses) {\n for (const imp of response.imports) {\n if (imp.values || imp.schemaFactory) {\n continue;\n }\n\n const importName = imp.alias ?? imp.name;\n if (!/^[A-Z]\\w*$/.test(importName)) {\n continue;\n }\n\n const schemaForImport = resolveStrictMockSchemaForTypeName(\n importName,\n response.originalSchema,\n context,\n imp.name,\n );\n if (!schemaForImport) {\n continue;\n }\n\n kinds[importName] = classifyStrictMockSchemaType(\n schemaForImport,\n context,\n );\n }\n\n const { value } = response;\n if (!value || !response.originalSchema) {\n continue;\n }\n\n const baseType = value.endsWith('[]') ? value.slice(0, -2) : value;\n if (!/^[A-Z]\\w*$/.test(baseType)) {\n continue;\n }\n\n const schema = response.originalSchema;\n if (value.endsWith('[]') && schema.type === 'array' && schema.items) {\n const items = schema.items as OpenApiSchemaObject;\n kinds[baseType] = classifyStrictMockSchemaType(items, context);\n continue;\n }\n\n const schemaForType =\n resolveStrictMockSchemaForTypeName(\n baseType,\n response.originalSchema,\n context,\n ) ?? response.originalSchema;\n kinds[baseType] = classifyStrictMockSchemaType(schemaForType, context);\n }\n\n return kinds;\n}\n\nexport function buildStrictMockTypeFileHeader(\n schemaTypeNames: Iterable<string>,\n kinds?: Readonly<Record<string, StrictMockSchemaKind>>,\n): string {\n const uniqueSchemaNames = [...new Set(schemaTypeNames)];\n const schemaBlock = getStrictMockTypeDeclarations(uniqueSchemaNames, kinds);\n\n return [getStrictMockHelperTypeDeclarations(), schemaBlock]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Prepends shared strict-mock helper types and each `{Schema}Mock` alias once at\n * the top of a mock file. Generators pass `strictSchemaTypeNames`; no scraping.\n *\n * Not idempotent — callers must invoke this exactly once per aggregated mock\n * file (writers and `writeFakerSchemaMocks`), not from import hooks.\n */\nexport function dedupeStrictMockTypeDeclarations(\n implementation: string,\n options: FinalizeMockImplementationOptions = {},\n): string {\n if (!isStrictMock(options.mockOptions)) {\n return implementation;\n }\n\n const schemaTypeNames = options.strictSchemaTypeNames\n ? [...new Set(options.strictSchemaTypeNames)]\n : [];\n if (schemaTypeNames.length === 0) {\n return implementation;\n }\n\n const header = buildStrictMockTypeFileHeader(\n schemaTypeNames,\n options.strictMockSchemaKinds,\n );\n\n return `${header}\\n\\n${implementation.trimStart()}`;\n}\n\nexport function applyStrictMockReturnType(\n returnType: string,\n schemaTypeNames: string[],\n): string {\n if (schemaTypeNames.length === 0) {\n return returnType;\n }\n\n let result = returnType;\n const sorted = [...schemaTypeNames].toSorted((a, b) => b.length - a.length);\n\n for (const name of sorted) {\n result = result.replaceAll(\n new RegExp(String.raw`\\b${escapeRegExp(name)}\\b`, 'g'),\n getStrictMockTypeName(name),\n );\n }\n\n return result;\n}\n\nconst STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDES =\n /MockWithNullableOverrides<([A-Z]\\w*),/g;\nconst STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDE_ALIAS =\n /MockWithNullableOverrides<[^,]+,\\s*[^,]+,\\s*([A-Z]\\w*Mock)>/g;\nconst STRICT_MOCK_SCHEMA_TYPE_FROM_MOCK_ALIAS_RETURN =\n /\\): ([A-Z]\\w*Mock)(?:\\[\\]|;)/g;\n\n/** Inverse of {@link getStrictMockTypeName}: `PetMock` → `Pet`, `WidgetMockMock` → `WidgetMock`. */\nfunction getSchemaTypeNameFromStrictMockAlias(alias: string): string {\n return alias.endsWith('Mock') ? alias.slice(0, -4) : alias;\n}\n\n/**\n * Collect schema type names referenced by strict mock factories in generated\n * implementation text (nested split factories, array item helpers, etc.).\n *\n * This reverse-parses emitted factory syntax and is therefore coupled to the\n * current `formatMockFactoryDeclaration` / `getMockFactorySignatureParts`\n * shape. The structurally robust alternative is to record each nested item's\n * schema name where split factories are generated (array-item / faker getters,\n * where the `$ref` name is known) and thread it into `strictMockSchemaTypeNames`.\n */\nexport function collectStrictMockSchemaTypeNamesFromImplementation(\n implementation: string,\n): string[] {\n const names = new Set<string>();\n\n for (const match of implementation.matchAll(\n STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDES,\n )) {\n names.add(match[1]);\n }\n\n for (const pattern of [\n STRICT_MOCK_SCHEMA_TYPE_FROM_OVERRIDE_ALIAS,\n STRICT_MOCK_SCHEMA_TYPE_FROM_MOCK_ALIAS_RETURN,\n ]) {\n for (const match of implementation.matchAll(pattern)) {\n names.add(getSchemaTypeNameFromStrictMockAlias(match[1]));\n }\n }\n\n return [...names];\n}\n\nexport function mergeStrictMockSchemaTypeNames(\n ...groups: Array<Iterable<string> | undefined>\n): string[] | undefined {\n const names = new Set<string>();\n\n for (const group of groups) {\n if (!group) continue;\n for (const name of group) {\n names.add(name);\n }\n }\n\n return names.size > 0 ? [...names] : undefined;\n}\n\nexport function mergeStrictMockSchemaKinds(\n ...groups: Array<Readonly<Record<string, StrictMockSchemaKind>> | undefined>\n): Record<string, StrictMockSchemaKind> | undefined {\n const merged: Record<string, StrictMockSchemaKind> = {};\n\n for (const group of groups) {\n if (!group) continue;\n for (const [name, kind] of Object.entries(group)) {\n merged[name] ??= kind;\n }\n }\n\n return Object.keys(merged).length > 0 ? merged : undefined;\n}\n","import type { GeneratorImport } from '@orval/core';\n\n/**\n * Appends entries added to `source` since `sinceIndex`. Uses indexed push\n * instead of spread so large import batches (common with `schemas: true`\n * delegation on wide objects) do not overflow the call stack.\n */\nexport function appendImportsDelta(\n target: GeneratorImport[],\n source: GeneratorImport[],\n sinceIndex: number,\n): void {\n for (let i = sinceIndex; i < source.length; i++) {\n target.push(source[i]!);\n }\n}\n\n/**\n * Merge imports returned from mock resolution when the shared imports array\n * was not mutated in place. Enum mocks and nested object factories return\n * their imports separately; schema-factory delegation mutates `sharedImports`\n * directly and must not be merged again from `resolvedImports`.\n */\nexport function mergeReturnedMockImports(\n sharedImports: GeneratorImport[],\n sharedBefore: number,\n resolvedImports: GeneratorImport[],\n): void {\n if (sharedImports.length === sharedBefore) {\n appendImportsDelta(sharedImports, resolvedImports, 0);\n }\n}\n\n/** Recover type imports referenced by nested oneOf split mock helpers. */\nexport function collectSplitMockTypeImports(\n implementations: readonly string[],\n): GeneratorImport[] {\n const seen = new Set<string>();\n const imports: GeneratorImport[] = [];\n\n const addType = (name: string | undefined) => {\n if (!name || seen.has(name)) return;\n seen.add(name);\n imports.push({ name, values: false });\n };\n\n for (const impl of implementations) {\n for (const match of impl.matchAll(\n /export const get\\w+Mock = \\(\\s*overrideResponse: Partial<(\\w+)[^)]*\\):\\s*(\\w+)\\s*=>/g,\n )) {\n addType(match[1]);\n addType(match[2]);\n }\n\n for (const match of impl.matchAll(\n /export const get\\w+Mock[\\s\\S]*?MockWithNullableOverrides<(?:Extract<(\\w+),[^>]+>|(\\w+)),/g,\n )) {\n addType(match[1] ?? match[2]);\n }\n }\n\n return imports;\n}\n","import {\n type GlobalMockOptions,\n isBoolean,\n isFunction,\n isMswMock,\n isNumber,\n type MswMockOptions,\n type NormalizedOverrideOutput,\n} from '@orval/core';\n\nexport const getDelay = (\n override?: NormalizedOverrideOutput,\n options?: GlobalMockOptions,\n): MswMockOptions['delay'] => {\n // `delay` and `delayFunctionLazyExecute` are MSW-only. Narrow the\n // discriminated `GlobalMockOptions` union (and the partial override\n // counterpart) before reading them.\n const mswOptions = options && isMswMock(options) ? options : undefined;\n const overrideMock = override?.mock as Partial<MswMockOptions> | undefined;\n const overrideDelay = overrideMock?.delay ?? mswOptions?.delay;\n const delayFunctionLazyExecute =\n overrideMock?.delayFunctionLazyExecute ??\n mswOptions?.delayFunctionLazyExecute;\n if (isFunction(overrideDelay)) {\n return delayFunctionLazyExecute ? overrideDelay : overrideDelay();\n }\n if (isNumber(overrideDelay) || isBoolean(overrideDelay)) {\n return overrideDelay;\n }\n return false;\n};\n","import {\n type ContextSpec,\n getRefInfo,\n isReference,\n type OpenApiSchemaObject,\n} from '@orval/core';\nimport { prop } from 'remeda';\n\nimport type { MockSchema } from '../../types';\n\n// Resolve a `$ref` (following `$ref`-to-`$ref` alias chains, like the model\n// side's `derefComponentSchema`) to its target schema. `seen` holds the refs\n// on the current traversal path and breaks cycles; returns undefined for\n// unresolvable or already-visited refs.\nfunction derefAllOfMember(\n member: MockSchema,\n context: ContextSpec,\n seen: Set<string>,\n): Partial<OpenApiSchemaObject> | undefined {\n let current: unknown = member;\n\n while (current && typeof current === 'object' && isReference(current)) {\n const ref = current.$ref;\n if (typeof ref !== 'string' || seen.has(ref)) {\n return undefined;\n }\n seen.add(ref);\n const { refPaths } = getRefInfo(ref, context);\n current = Array.isArray(refPaths)\n ? prop(\n context.spec,\n // @ts-expect-error: refPaths are not guaranteed to be valid keys of the spec\n ...refPaths,\n )\n : undefined;\n }\n\n return current && typeof current === 'object'\n ? (current as Partial<OpenApiSchemaObject>)\n : undefined;\n}\n\n// `allOf` makes `required` the union across every member, including `$ref`'d\n// ones (resolved through alias chains and nested `allOf`, cycle-guarded by\n// `seen`) and constraint-only members (`{ required: [...] }` alone, #3750).\n//\n// Boundary filter: names collected from a nested composition count only when\n// that composition also declares the property. The generated types work the\n// same way (core getters/combine.ts, #3663), and collecting more than the\n// model requires would flip the #910 cyclic-reference guard from omission to\n// `key: null` on a property the type keeps optional. Direct members are\n// exempt: their `required` applies to the composition being emitted now.\n//\n// Returns the declared property names alongside `required` so callers one\n// level up can apply the same boundary filter.\nexport function collectAllOfRequiredWithDeclared(\n schemas: MockSchema[],\n context: ContextSpec,\n seen: Set<string>,\n): { required: string[]; declared: Set<string> } {\n const required: string[] = [];\n const declared = new Set<string>();\n\n for (const val of schemas) {\n // Branch-local copy: the cycle guard is scoped to the current traversal\n // path, not shared across sibling members. A target first visited inside\n // one member's nested chain (where the boundary filter may drop its\n // undeclared names) must still be visitable as a later DIRECT member,\n // whose `required` counts unfiltered. Termination is preserved because a\n // ref still cannot repeat within a single path. Same pattern as\n // `resolvesToObjectLike` in resolvers/value.ts.\n const memberSeen = new Set(seen);\n const schema = derefAllOfMember(val, context, memberSeen);\n if (!schema) {\n continue;\n }\n\n const properties = schema.properties as Record<string, unknown> | undefined;\n if (properties && typeof properties === 'object') {\n for (const key of Object.keys(properties)) {\n declared.add(key);\n }\n }\n\n if (Array.isArray(schema.required)) {\n required.push(...(schema.required as string[]));\n }\n\n if (Array.isArray(schema.allOf)) {\n const inner = collectAllOfRequiredWithDeclared(\n schema.allOf as MockSchema[],\n context,\n memberSeen,\n );\n required.push(\n ...inner.required.filter(\n (name) =>\n inner.declared.has(name) || (properties && name in properties),\n ),\n );\n for (const key of inner.declared) {\n declared.add(key);\n }\n }\n }\n\n return { required, declared };\n}\n\nexport function collectAllOfRequired(\n schemas: MockSchema[],\n context: ContextSpec,\n): string[] {\n return collectAllOfRequiredWithDeclared(schemas, context, new Set()).required;\n}\n","import { compareVersions, type PackageJson } from '@orval/core';\n\nconst getFakerPackageVersion = (packageJson: PackageJson) => {\n return (\n packageJson.resolvedVersions?.['@faker-js/faker'] ??\n packageJson.dependencies?.['@faker-js/faker'] ??\n packageJson.devDependencies?.['@faker-js/faker'] ??\n packageJson.peerDependencies?.['@faker-js/faker']\n );\n};\n\nexport const isFakerVersionV9 = (packageJson: PackageJson) => {\n const version = getFakerPackageVersion(packageJson);\n\n if (!version) {\n return false;\n }\n\n const withoutRc = version.split('-')[0];\n\n return compareVersions(withoutRc, '9.0.0');\n};\n","import type { OpenApiSchemaObject } from '@orval/core';\n\nexport const DEFAULT_FORMAT_MOCK: Record<\n Required<Extract<OpenApiSchemaObject, object>>['format'],\n string\n> = {\n bic: 'faker.finance.bic()',\n binary: 'new ArrayBuffer(faker.number.int({ min: 1, max: 64 }))',\n city: 'faker.location.city()',\n country: 'faker.location.country()',\n date: 'faker.date.past().toISOString().slice(0, 10)',\n 'date-time': \"faker.date.past().toISOString().slice(0, 19) + 'Z'\",\n email: 'faker.internet.email()',\n firstName: 'faker.person.firstName()',\n gender: 'faker.person.gender()',\n iban: 'faker.finance.iban()',\n ipv4: 'faker.internet.ipv4()',\n ipv6: 'faker.internet.ipv6()',\n jobTitle: 'faker.person.jobTitle()',\n lastName: 'faker.person.lastName()',\n password: 'faker.internet.password()',\n phoneNumber: 'faker.phone.number()',\n streetName: 'faker.location.street()',\n uri: 'faker.internet.url()',\n url: 'faker.internet.url()',\n userName: 'faker.internet.userName()',\n uuid: 'faker.string.uuid()',\n zipCode: 'faker.location.zipCode()',\n};\n\n// #980 replace CUID so tests are consistent\nexport const DEFAULT_OBJECT_KEY_MOCK = 'faker.string.alphanumeric(5)';\n","import {\n compareNatural,\n type ContextSpec,\n type GeneratorImport,\n getKey,\n getRefInfo,\n isReference,\n type MockOptions,\n type OpenApiReferenceObject,\n type OpenApiSchemaObject,\n PropertySortOrder,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { DEFAULT_OBJECT_KEY_MOCK } from '../constants';\nimport {\n resolveMockValue,\n getNullable,\n isNullableSchema,\n resolveRefTarget,\n} from '../resolvers/value';\nimport { mergeReturnedMockImports } from '../imports';\nimport { combineSchemasMock } from './combine';\n\nexport const overrideVarName = 'overrideResponse';\n\nfunction wrapRootNullableObjectValue(\n value: string,\n schemaItem: MockSchemaObject,\n mockOptions: MockOptions | undefined,\n combine?: GetMockObjectOptions['combine'],\n): { value: string; nullWrapped: boolean } {\n const nullableAtRoot =\n !combine && isNullableSchema(schemaItem) && !mockOptions?.nonNullable;\n\n return {\n value: nullableAtRoot ? getNullable(value, true) : value,\n nullWrapped: nullableAtRoot,\n };\n}\n\nfunction getReferenceName(\n ref: string | undefined,\n context: ContextSpec,\n): string {\n if (!ref) return '';\n\n return getRefInfo(ref, context).name;\n}\n\nfunction isNullableRefTarget(\n ref: string | undefined,\n context: ContextSpec,\n): boolean {\n return isNullableSchema(resolveRefTarget(ref, context));\n}\n\n// One-hop lookahead before re-expanding a recursive ref: when the target's\n// own required refs already sit on the path and cannot be nulled, the\n// re-expansion can only end in casts, so skip the wasted work.\nfunction reExpansionWouldCollapse(\n ref: string | undefined,\n context: ContextSpec,\n existingReferencedProperties: string[],\n nonNullable: boolean | undefined,\n): boolean {\n const target = resolveRefTarget(ref, context);\n const targetProperties = target?.properties as\n | Record<string, OpenApiReferenceObject | OpenApiSchemaObject>\n | undefined;\n const targetRequired = target?.required as string[] | undefined;\n if (!targetProperties || !Array.isArray(targetRequired)) return false;\n\n return Object.entries(targetProperties).some(([key, property]) => {\n if (!targetRequired.includes(key) || !isReference(property)) return false;\n if (\n !existingReferencedProperties.includes(\n getReferenceName(property.$ref, context),\n )\n ) {\n return false;\n }\n return nonNullable || !isNullableRefTarget(property.$ref, context);\n });\n}\n\ninterface GetMockObjectOptions {\n item: MockSchemaObject;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Tracks the current contiguous `allOf` composition to break cyclic\n // inheritance. See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}\n\nexport function getMockObject({\n item,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n allowOverride = false,\n}: GetMockObjectOptions): MockDefinition {\n if (isReference(item)) {\n return resolveMockValue({\n schema: {\n ...item,\n name: item.name,\n path: item.path ? `${item.path}.${item.name}` : item.name,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n }\n\n const schemaItem = item as MockSchemaObject & Record<string, unknown>;\n const itemAllOf = schemaItem.allOf as MockSchema[] | undefined;\n const itemOneOf = schemaItem.oneOf as MockSchema[] | undefined;\n const itemAnyOf = schemaItem.anyOf as MockSchema[] | undefined;\n const itemType = schemaItem.type as string | string[] | undefined;\n const itemProperties = schemaItem.properties as\n | Record<string, OpenApiReferenceObject | OpenApiSchemaObject>\n | undefined;\n const itemRequired = schemaItem.required as string[] | undefined;\n const itemAdditionalProperties = schemaItem.additionalProperties as\n | boolean\n | OpenApiReferenceObject\n | OpenApiSchemaObject\n | undefined;\n\n if (itemAllOf || itemOneOf || itemAnyOf) {\n const separator = itemAllOf ? 'allOf' : itemOneOf ? 'oneOf' : 'anyOf';\n return combineSchemasMock({\n item: schemaItem,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n }\n\n if (Array.isArray(itemType)) {\n const nonNullTypes = mockOptions?.nonNullable\n ? itemType.filter((type) => type !== 'null')\n : itemType;\n\n if (nonNullTypes.length === 0) {\n return { value: 'null', imports: [], name: schemaItem.name };\n }\n\n if (nonNullTypes.length === 1) {\n return getMockObject({\n item: {\n ...schemaItem,\n type: nonNullTypes[0],\n } as MockSchemaObject & Record<string, unknown>,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n }\n\n // Spread the base schema into each type entry so that object properties\n // (e.g. `properties`, `required`, `additionalProperties`) are preserved.\n // Without this, `{ type: \"object\", properties: {...} }` collapses to\n // `{ type: \"object\" }` and the mock generator returns `{}` instead of\n // building the actual object shape. Mirrors the fix in core getters/object.ts.\n const isPropertylessObject =\n !itemProperties &&\n (!itemRequired || itemRequired.length === 0) &&\n !itemAdditionalProperties;\n\n if (\n isPropertylessObject &&\n nonNullTypes.includes('object') &&\n nonNullTypes.includes('null') &&\n nonNullTypes.every((type) => type === 'object' || type === 'null')\n ) {\n if (mockOptions?.nonNullable) {\n return { value: '{}', imports: [], name: schemaItem.name };\n }\n\n return {\n value: 'faker.helpers.arrayElement([{}, null])',\n imports: [],\n name: schemaItem.name,\n };\n }\n\n const baseItem = schemaItem as Record<string, unknown>;\n return combineSchemasMock({\n item: {\n anyOf: nonNullTypes.map((type) => ({\n ...baseItem,\n type,\n })) as unknown as MockSchema[],\n name: schemaItem.name,\n },\n separator: 'anyOf',\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n }\n\n if (itemProperties) {\n let value =\n !combine || combine.separator === 'oneOf' || combine.separator === 'anyOf'\n ? '{'\n : '';\n const imports: GeneratorImport[] = [];\n const includedProperties: string[] = [];\n\n const entries = Object.entries(itemProperties);\n if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n entries.sort((a, b) => {\n return compareNatural(a[0], b[0]);\n });\n }\n const propertyScalars = entries\n .map(\n ([key, prop]: [\n string,\n OpenApiReferenceObject | OpenApiSchemaObject,\n ]) => {\n if (combine?.includedProperties.includes(key)) {\n return;\n }\n\n const isRequired =\n mockOptions?.required ??\n (Array.isArray(itemRequired) ? itemRequired : []).includes(key);\n\n const hasNullable = 'nullable' in prop && prop.nullable === true;\n\n const refName = isReference(prop)\n ? getReferenceName(prop.$ref, context)\n : '';\n const isRecursiveRef =\n !!refName && existingReferencedProperties.includes(refName);\n\n // Recursive $ref. Optional properties are dropped, nullable ones\n // keep null. The rest expands one more level, letting the deeper\n // array/union guards close the cycle with a typed stub. One\n // re-expansion per path, and none when it could only end in casts:\n // an all-required cycle has no finite value, and unbounded\n // re-expansion blows up on dense specs.\n if (isRecursiveRef) {\n if (!isRequired) {\n return;\n }\n const keyDefinition = getKey(key);\n if (\n !mockOptions?.nonNullable &&\n (hasNullable ||\n (isReference(prop) && isNullableRefTarget(prop.$ref, context)))\n ) {\n return `${keyDefinition}: null`;\n }\n const inReExpansion =\n new Set(existingReferencedProperties).size !==\n existingReferencedProperties.length;\n if (\n inReExpansion ||\n (isReference(prop) &&\n reExpansionWouldCollapse(\n prop.$ref,\n context,\n existingReferencedProperties,\n mockOptions?.nonNullable,\n ))\n ) {\n imports.push({ name: refName });\n return `${keyDefinition}: {} as unknown as ${refName}`;\n }\n }\n\n const importsBefore = imports.length;\n const resolvedValue = resolveMockValue({\n schema: {\n ...(prop as Record<string, unknown>),\n name: key,\n parentName: schemaItem.name,\n path: schemaItem.path ? `${schemaItem.path}.${key}` : `#.${key}`,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n // A property value is a fresh mock instance, not part of this\n // object's allOf composition — reset the chain.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs: [],\n splitMockImplementations,\n });\n\n mergeReturnedMockImports(\n imports,\n importsBefore,\n resolvedValue.imports,\n );\n\n includedProperties.push(key);\n\n const keyDefinition = getKey(key);\n\n // A required $ref union whose variants were all recursively\n // skipped resolves to undefined; cast it to satisfy the type.\n if (isRequired && refName && resolvedValue.value === 'undefined') {\n imports.push({ name: refName });\n return `${keyDefinition}: undefined as unknown as ${refName}`;\n }\n\n // A re-expansion that still needed casts gained nothing over\n // casting here directly, so keep the smaller form.\n if (\n isRequired &&\n isRecursiveRef &&\n resolvedValue.value.includes(' as unknown as ')\n ) {\n imports.push({ name: refName });\n return `${keyDefinition}: {} as unknown as ${refName}`;\n }\n\n const hasDefault = 'default' in prop && prop.default !== undefined;\n\n if (!isRequired && !resolvedValue.overrided && !hasDefault) {\n const omitValue =\n mockOptions?.nonNullable || !hasNullable ? 'undefined' : 'null';\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, ${omitValue}])`;\n }\n\n const isNullable =\n Array.isArray(prop.type) && prop.type.includes('null');\n if (\n isNullable &&\n !resolvedValue.nullWrapped &&\n !resolvedValue.overrided &&\n !mockOptions?.nonNullable\n ) {\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, null])`;\n }\n\n return `${keyDefinition}: ${resolvedValue.value}`;\n },\n )\n .filter(Boolean);\n\n if (allowOverride) {\n propertyScalars.push(`...${overrideVarName}`);\n }\n\n value += propertyScalars.join(', ');\n value +=\n !combine || combine.separator === 'oneOf' || combine.separator === 'anyOf'\n ? '}'\n : '';\n\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n value,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n value: finalValue,\n nullWrapped,\n imports,\n name: schemaItem.name,\n includedProperties,\n };\n }\n\n if (itemAdditionalProperties) {\n if (itemAdditionalProperties === true) {\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n `{}`,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n value: finalValue,\n nullWrapped,\n imports: [],\n name: schemaItem.name,\n };\n }\n const additionalProperties = itemAdditionalProperties;\n if (\n isReference(additionalProperties) &&\n existingReferencedProperties.includes(\n getReferenceName(additionalProperties.$ref, context),\n )\n ) {\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n `{}`,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n value: finalValue,\n nullWrapped,\n imports: [],\n name: schemaItem.name,\n };\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...additionalProperties,\n name: schemaItem.name,\n path: schemaItem.path ? `${schemaItem.path}.#` : '#',\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n // An additionalProperties value is a fresh mock instance — reset the\n // chain, as with property values above.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs: [],\n splitMockImplementations,\n });\n\n const objectValue = `{\n [${DEFAULT_OBJECT_KEY_MOCK}]: ${resolvedValue.value}\n }`;\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n objectValue,\n schemaItem,\n mockOptions,\n combine,\n );\n\n return {\n ...resolvedValue,\n value: finalValue,\n nullWrapped,\n };\n }\n\n const { value: finalValue, nullWrapped } = wrapRootNullableObjectValue(\n '{}',\n schemaItem,\n mockOptions,\n combine,\n );\n\n return { value: finalValue, nullWrapped, imports: [], name: schemaItem.name };\n}\n","import {\n type ContextSpec,\n type GeneratorImport,\n getOperationTagKey,\n getRefInfo,\n isFunction,\n isReference,\n type OpenApiSchemaObject,\n OutputMockType,\n OutputMode,\n pascal,\n resolveRef,\n} from '@orval/core';\n\nimport {\n formatMockFactoryDeclaration,\n getMockFactorySignatureParts,\n getStrictMockTypeName,\n isStrictMock,\n} from '../../mock-types';\nimport type { MockSchema } from '../../types';\nimport { overrideVarName } from './object';\nimport { extractItemsRef } from './scalar';\n\n/**\n * Scope key for file-level array-item factory dedup. Must match how writers\n * group mock output: one bucket per tag file in tags modes, one bucket per\n * operation file in the tags-operations modes (each operation gets its own\n * mock file), otherwise one bucket for the whole target.\n */\nexport function getArrayItemMockFileScope(\n context: ContextSpec,\n tags: string[],\n operationId?: string,\n): string {\n const mode = context.output.mode;\n const mockType = context.activeMockOutputType ?? OutputMockType.MSW;\n let base: string;\n if (\n mode === OutputMode.TAGS_OPERATIONS ||\n mode === OutputMode.TAGS_OPERATIONS_SPLIT\n ) {\n base = `operation:${operationId ?? ''}`;\n } else if (mode === OutputMode.TAGS || mode === OutputMode.TAGS_SPLIT) {\n base = `tag:${getOperationTagKey({ tags })}`;\n } else if (mode === OutputMode.SPLIT) {\n base = 'split';\n } else {\n base = 'single';\n }\n return `${base}:${mockType}`;\n}\n\nfunction getFileLevelExtractedFactories(\n context: ContextSpec,\n scope: string,\n): Set<string> {\n context.arrayItemMockFactories ??= new Map();\n const existing = context.arrayItemMockFactories.get(scope);\n if (existing) {\n return existing;\n }\n const factories = new Set<string>();\n context.arrayItemMockFactories.set(scope, factories);\n return factories;\n}\n\n/**\n * True when any mock generator entry opts into reusable array-item mock\n * factories for object-like array item schemas in operation responses.\n */\nexport function shouldExtractArrayItemFactories(context: ContextSpec): boolean {\n return context.output.mock.generators.some(\n (g) => !isFunction(g) && g.arrayItems === true,\n );\n}\n\n/**\n * True when `schemas: true` already emits a consolidated factory for this\n * `$ref` item under `components/schemas`, so we must not re-export it from\n * the operation mock file.\n */\nfunction hasConsolidatedSchemaFactory(\n items: MockSchema,\n context: ContextSpec,\n): boolean {\n if (!context.output.schemas) {\n return false;\n }\n\n const itemsRef = extractItemsRef(items);\n if (!itemsRef) {\n return false;\n }\n\n const { refPaths } = getRefInfo(itemsRef, context);\n const isComponentsSchema =\n Array.isArray(refPaths) &&\n refPaths[0] === 'components' &&\n refPaths[1] === 'schemas';\n\n if (!isComponentsSchema) {\n return false;\n }\n\n return context.output.mock.generators.some(\n (g) =>\n !isFunction(g) && g.type === OutputMockType.FAKER && g.schemas === true,\n );\n}\n\n/**\n * True when `parentName` looks like a nested property key rather than the\n * generated response wrapper type (e.g. `outer` vs `GetTenants200`). Inlining\n * avoids factory/type-name collisions and mismatched `<Parent><Prop>Item` aliases.\n */\nfunction isAmbiguousInlineItemContext(\n operationId: string,\n parentName?: string,\n): boolean {\n if (!parentName) {\n return false;\n }\n\n return !parentName.toLowerCase().includes(operationId.toLowerCase());\n}\n\nfunction isNullableArrayItem(schema: OpenApiSchemaObject): boolean {\n if (schema.nullable === true) {\n return true;\n }\n\n return Array.isArray(schema.type) && schema.type.includes('null');\n}\n\nfunction isResolvedSchemaObjectLike(schema: OpenApiSchemaObject): boolean {\n if (schema.type === 'object' || schema.properties) {\n return true;\n }\n\n if (schema.allOf) {\n return true;\n }\n\n return false;\n}\n\n/**\n * True when array `items` resolve to an object-like schema worth extracting.\n * Conservative: skips scalar refs, oneOf/anyOf, nullable items, and nested\n * contexts where generated item type names cannot be inferred reliably.\n */\nfunction shouldExtractArrayItem(\n items: MockSchema,\n context: ContextSpec,\n operationId: string,\n parentName?: string,\n): boolean {\n const itemsRef = extractItemsRef(items);\n\n if (itemsRef) {\n try {\n const { schema } = resolveRef<OpenApiSchemaObject>(\n { $ref: itemsRef },\n context,\n );\n return isResolvedSchemaObjectLike(schema);\n } catch {\n return false;\n }\n }\n\n if (isReference(items)) {\n return false;\n }\n\n const schema = items as OpenApiSchemaObject;\n\n if (isNullableArrayItem(schema)) {\n return false;\n }\n\n if (schema.oneOf || schema.anyOf) {\n return false;\n }\n\n if (schema.allOf) {\n return true;\n }\n\n if (schema.type === 'object' || schema.properties) {\n return !isAmbiguousInlineItemContext(operationId, parentName);\n }\n\n return false;\n}\n\n/**\n * True when `mapValue` is already a bare factory call or a single spread of one.\n */\nfunction isAlreadyFactoryCall(mapValue: string): boolean {\n return /^(?:\\{\\s*\\.\\.\\.\\s*get\\w+Mock\\(\\)\\s*\\}|get\\w+Mock\\(\\))$/.test(\n mapValue.trim(),\n );\n}\n\ninterface ArrayItemFactoryNames {\n factoryName: string;\n typeName: string;\n}\n\n/**\n * Derive the exported factory and TypeScript type names for an array item.\n */\nfunction getArrayItemFactoryNames({\n items,\n propertyName,\n parentName,\n operationId,\n context,\n}: {\n items: MockSchema;\n propertyName: string;\n parentName?: string;\n operationId: string;\n context: ContextSpec;\n}): ArrayItemFactoryNames | undefined {\n if (!shouldExtractArrayItem(items, context, operationId, parentName)) {\n return undefined;\n }\n\n const itemsRef = extractItemsRef(items);\n if (itemsRef) {\n const { name } = getRefInfo(itemsRef, context);\n const typeName = pascal(name);\n return {\n factoryName: `get${typeName}Mock`,\n typeName,\n };\n }\n\n const itemPrefix =\n context.output.override.components.schemas.itemPrefix ?? '';\n const itemSuffix =\n context.output.override.components.schemas.itemSuffix ?? '';\n\n let typeName: string;\n if (parentName) {\n typeName = `${itemPrefix}${pascal(parentName)}${pascal(propertyName)}${itemSuffix}`;\n } else {\n // No `parentName`: the array IS the top-level response schema, and\n // `propertyName` here is the response definition string produced by\n // `getResReqTypes` (core/getters/res-req-types.ts) rather than a nested\n // property key. Two shapes reach this point:\n // - inline top-level array responses, where `propertyName` is the\n // response type expression with a trailing `[]`; the part before\n // `[]` is the element alias core already emitted via\n // `createTypeAliasIfNeeded` (core/resolvers/object.ts), when that\n // part is a bare identifier;\n // - `$ref`'d array schemas (`items` here is the array's resolved,\n // non-`$ref` items schema), where `propertyName` is the bare ref\n // name and core aliases the array's items as\n // `${pascal(refName)}${itemSuffix}` (core/getters/array.ts).\n // Nullable top-level arrays reach this branch too: core's scalar getter\n // appends a trailing ` | null` to either shape above (e.g.\n // `CatalogItems | null` or `GetFoo200Item[] | null`), so that suffix is\n // stripped before testing/deriving the type name below. `factoryName`\n // still keys off the original, unstripped `propertyName` — outputs on\n // the nullable path never compiled before this fix, so factory naming\n // there is not a compatibility surface.\n // If neither shape holds with certainty, bail (`undefined`) so the call\n // site keeps the pre-#3514 inline item body, which is always\n // type-correct, instead of referencing a name core never emitted (#3706).\n const nullableSuffix = ' | null';\n const workingName = propertyName.endsWith(nullableSuffix)\n ? propertyName.slice(0, -nullableSuffix.length)\n : propertyName;\n\n if (workingName.endsWith('[]')) {\n const base = workingName.slice(0, -2);\n if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(base)) {\n return undefined;\n }\n typeName = base;\n } else {\n const schema = items as OpenApiSchemaObject;\n if (schema.allOf && !schema.properties && schema.type !== 'object') {\n return undefined;\n }\n // Defense-in-depth: `workingName` should be a bare ref name here, but\n // guard against anything that isn't a valid identifier (e.g. a\n // malformed union expression) rather than emitting a phantom type.\n if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(workingName)) {\n return undefined;\n }\n typeName = `${itemPrefix}${pascal(workingName)}${itemSuffix}`;\n }\n }\n\n return {\n factoryName: `get${pascal(operationId)}Response${pascal(propertyName)}ItemMock`,\n typeName,\n };\n}\n\ninterface ExtractArrayItemMockOptions {\n items: MockSchema;\n propertyName: string;\n parentName?: string;\n operationId: string;\n tags: string[];\n mapValue: string;\n context: ContextSpec;\n splitMockImplementations: string[];\n imports: GeneratorImport[];\n}\n\n/**\n * When `arrayItems: true`, lift an object-like array item mock body into a\n * reusable exported factory and return the call site expression for `.map()`.\n */\nexport function extractArrayItemMock({\n items,\n propertyName,\n parentName,\n operationId,\n tags,\n mapValue,\n context,\n splitMockImplementations,\n imports,\n}: ExtractArrayItemMockOptions): string | undefined {\n if (!shouldExtractArrayItemFactories(context)) {\n return undefined;\n }\n\n if (\n !mapValue ||\n mapValue === '[]' ||\n isAlreadyFactoryCall(mapValue) ||\n hasConsolidatedSchemaFactory(items, context)\n ) {\n return undefined;\n }\n\n const names = getArrayItemFactoryNames({\n items,\n propertyName,\n parentName,\n operationId,\n context,\n });\n if (!names) {\n return undefined;\n }\n\n const { factoryName, typeName } = names;\n const scope = getArrayItemMockFileScope(context, tags, operationId);\n const fileLevelFactories = getFileLevelExtractedFactories(context, scope);\n const mockOptions = context.output.override.mock;\n const alreadyExtracted =\n fileLevelFactories.has(factoryName) ||\n splitMockImplementations.some((f) =>\n f.includes(`export const ${factoryName}`),\n );\n\n if (!alreadyExtracted) {\n const { param, returnType, returnCast } = getMockFactorySignatureParts(\n typeName,\n mockOptions,\n {\n isOverridable: true,\n overrideType: `Partial<${typeName}>`,\n },\n );\n const spreadPrefix = mapValue.startsWith('...') ? '' : '...';\n const func = formatMockFactoryDeclaration(\n factoryName,\n param,\n returnType,\n `{${spreadPrefix}${mapValue}, ...${overrideVarName}}`,\n returnCast,\n { terminateStatement: true },\n );\n splitMockImplementations.push(func);\n fileLevelFactories.add(factoryName);\n }\n\n imports.push({ name: typeName });\n\n const strictCast = isStrictMock(mockOptions)\n ? ` as ${getStrictMockTypeName(typeName)}`\n : '';\n\n return `{...${factoryName}()${strictCast}}`;\n}\n","import {\n type ContextSpec,\n isReference,\n type OpenApiSchemaObject,\n resolveRef,\n} from '@orval/core';\n\nconst DATE_FORMATS = new Set(['date', 'date-time']);\n\nfunction isDateFormat(\n format: string | undefined,\n): format is 'date' | 'date-time' {\n return format !== undefined && DATE_FORMATS.has(format);\n}\n\nfunction isSchemaObject(schema: unknown): schema is OpenApiSchemaObject {\n return (\n typeof schema === 'object' && schema !== null && !Array.isArray(schema)\n );\n}\n\nfunction resolveSchema(\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): OpenApiSchemaObject | undefined {\n if (!schema) {\n return undefined;\n }\n\n if (isReference(schema)) {\n return resolveRef<OpenApiSchemaObject>(schema, context).schema;\n }\n\n return schema;\n}\n\nfunction mergePropertySchemas(\n ...schemas: Array<OpenApiSchemaObject | undefined>\n): Record<string, OpenApiSchemaObject> {\n const merged: Record<string, OpenApiSchemaObject> = {};\n\n for (const schema of schemas) {\n if (!schema?.properties) {\n continue;\n }\n\n for (const [key, prop] of Object.entries(schema.properties)) {\n if (isSchemaObject(prop)) {\n merged[key] = prop;\n }\n }\n }\n\n return merged;\n}\n\nfunction getEffectiveScalarFormat(\n resolved: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): 'date' | 'date-time' | undefined {\n if (!resolved) {\n return undefined;\n }\n\n if (isDateFormat(resolved.format)) {\n return resolved.format;\n }\n\n const oneOf = resolved.oneOf as OpenApiSchemaObject[] | undefined;\n const anyOf = resolved.anyOf as OpenApiSchemaObject[] | undefined;\n\n for (const variant of [...(oneOf ?? []), ...(anyOf ?? [])]) {\n const resolvable =\n isReference(variant) || isSchemaObject(variant) ? variant : undefined;\n const resolvedVariant = resolveSchema(resolvable, context);\n\n if (isDateFormat(resolvedVariant?.format)) {\n return resolvedVariant.format;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolves compositional schemas (allOf / oneOf / anyOf) so example formatting\n * can see property formats on nested and referenced types.\n */\nfunction resolveExampleSchema(\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n seenRefs: Set<string> = new Set(),\n): OpenApiSchemaObject | undefined {\n if (!schema) {\n return undefined;\n }\n\n if (isReference(schema)) {\n const ref = schema.$ref;\n if (ref && seenRefs.has(ref)) {\n return resolveRef<OpenApiSchemaObject>(schema, context).schema;\n }\n if (ref) {\n seenRefs = new Set(seenRefs).add(ref);\n }\n }\n\n const resolved = resolveSchema(schema, context);\n if (!resolved) {\n return undefined;\n }\n\n const allOf = resolved.allOf as OpenApiSchemaObject[] | undefined;\n const oneOf = resolved.oneOf as OpenApiSchemaObject[] | undefined;\n const anyOf = resolved.anyOf as OpenApiSchemaObject[] | undefined;\n const compositors = [...(allOf ?? []), ...(oneOf ?? []), ...(anyOf ?? [])];\n\n const properties = mergePropertySchemas(\n resolved,\n ...compositors.map((sub) => resolveExampleSchema(sub, context, seenRefs)),\n );\n // OpenApiSchemaObject includes AnyOtherAttribute; cast before spread (see object.ts).\n const baseResolved = resolved as Record<string, unknown>;\n\n if (resolved.type === 'array' && isSchemaObject(resolved.items)) {\n const items = resolveExampleSchema(resolved.items, context, seenRefs);\n const itemProperties = items?.properties;\n const normalizedItems =\n itemProperties && Object.keys(itemProperties).length > 0\n ? { type: 'object' as const, properties: itemProperties }\n : items;\n\n return {\n ...baseResolved,\n ...(Object.keys(properties).length > 0 ? { properties } : {}),\n items: normalizedItems ?? resolved.items,\n } as OpenApiSchemaObject;\n }\n\n if (Object.keys(properties).length > 0) {\n return {\n ...baseResolved,\n properties,\n } as OpenApiSchemaObject;\n }\n\n if (compositors.length > 0 && (oneOf ?? anyOf)) {\n const variantProperties = mergePropertySchemas(\n ...compositors.map((sub) => resolveExampleSchema(sub, context, seenRefs)),\n );\n\n if (Object.keys(variantProperties).length > 0) {\n return {\n type: 'object',\n properties: variantProperties,\n };\n }\n }\n\n const scalarFormat = getEffectiveScalarFormat(resolved, context);\n if (scalarFormat) {\n return {\n ...baseResolved,\n format: scalarFormat,\n } as OpenApiSchemaObject;\n }\n\n return resolved;\n}\n\nexport function formatScalarExampleValue(\n example: unknown,\n format: string | undefined,\n context: ContextSpec,\n): string {\n if (\n context.output.override.useDates &&\n typeof example === 'string' &&\n isDateFormat(format)\n ) {\n return `new Date(${JSON.stringify(example)})`;\n }\n\n return JSON.stringify(example);\n}\n\nfunction formatLiteralValue(\n example: unknown,\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): string {\n if (example === null) {\n return 'null';\n }\n\n if (example === undefined) {\n return 'undefined';\n }\n\n const resolved = resolveExampleSchema(schema, context);\n\n if (Array.isArray(example)) {\n const itemsSchema =\n resolved?.type === 'array' && isSchemaObject(resolved.items)\n ? resolveExampleSchema(resolved.items, context)\n : resolved;\n\n return `[${example.map((item) => formatLiteralValue(item, itemsSchema, context)).join(', ')}]`;\n }\n\n if (typeof example === 'object') {\n const properties = resolved?.properties ?? {};\n\n const entries = Object.entries(example as Record<string, unknown>).map(\n ([key, value]) => {\n const propSchema = properties[key];\n const resolvedProp = isSchemaObject(propSchema)\n ? resolveExampleSchema(propSchema, context)\n : undefined;\n const safeKey = /^[a-zA-Z_$][\\w$]*$/.test(key)\n ? key\n : JSON.stringify(key);\n\n return `${safeKey}: ${formatLiteralValue(value, resolvedProp, context)}`;\n },\n );\n\n return `{ ${entries.join(', ')} }`;\n }\n\n if (\n context.output.override.useDates &&\n typeof example === 'string' &&\n isDateFormat(getEffectiveScalarFormat(resolved, context))\n ) {\n return `new Date(${JSON.stringify(example)})`;\n }\n\n return JSON.stringify(example);\n}\n\nexport function formatSchemaExampleValue(\n example: unknown,\n schema: OpenApiSchemaObject | undefined,\n context: ContextSpec,\n): string {\n if (!context.output.override.useDates || schema === undefined) {\n return JSON.stringify(example);\n }\n\n return formatLiteralValue(example, schema, context);\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport {\n compareNatural,\n type ContextSpec,\n EnumGeneration,\n type GeneratorImport,\n getRefInfo,\n isBoolean,\n isNumber,\n isReference,\n isString,\n jsStringLiteralEscape,\n mergeDeep,\n safeNumericConstraint,\n type MockOptions,\n type OpenApiSchemaObject,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { isFakerVersionV9 } from '../compatible-v9';\nimport { DEFAULT_FORMAT_MOCK } from '../constants';\nimport {\n getNullable,\n resolveMockOverride,\n resolveMockValue,\n} from '../resolvers';\nimport { extractArrayItemMock } from './array-item-factory';\nimport { formatSchemaExampleValue } from '../format-example-value';\nimport { getMockObject } from './object';\n\ninterface GetMockScalarOptions {\n item: MockSchemaObject;\n imports: GeneratorImport[];\n mockOptions?: MockOptions;\n operationId: string;\n isRef?: boolean;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Tracks the current contiguous `allOf` composition to break cyclic\n // inheritance; threaded through to `combineSchemasMock`.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}\n\nexport function getMockScalar({\n item,\n imports,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n allowOverride = false,\n}: GetMockScalarOptions): MockDefinition {\n const safeMockOptions: MockOptions = mockOptions ?? {};\n const nonNullableOption = safeMockOptions.nonNullable;\n // Add the property to the existing properties to validate on object recursion\n if (item.isRef) {\n existingReferencedProperties = [...existingReferencedProperties, item.name];\n }\n\n const operationProperty = resolveMockOverride(\n safeMockOptions.operations?.[operationId]?.properties,\n item,\n nonNullableOption,\n );\n\n if (operationProperty) {\n return operationProperty;\n }\n\n let overrideTag: { properties: Record<string, unknown> } = {\n properties: {},\n };\n const sortedTags = Object.entries(safeMockOptions.tags ?? {}).toSorted(\n (a, b) => compareNatural(a[0], b[0]),\n );\n for (const [tag, options] of sortedTags) {\n if (!tags.includes(tag)) {\n continue;\n }\n overrideTag = mergeDeep(overrideTag, options);\n }\n\n const tagProperty = resolveMockOverride(\n overrideTag.properties,\n item,\n nonNullableOption,\n );\n\n if (tagProperty) {\n return tagProperty;\n }\n\n // Schema-scoped overrides (#override.mock.schemas): apply only to properties\n // of a named schema. `item.parentName` is the enclosing schema name, set when\n // an object property is resolved (see getters/object.ts) — so the same\n // property name can mock differently per schema. More specific\n // operation/tag rules above still win; this beats the global `properties`.\n const schemaName = item.parentName;\n const schemaProperty = schemaName\n ? resolveMockOverride(\n safeMockOptions.schemas?.[schemaName]?.properties,\n item,\n nonNullableOption,\n )\n : undefined;\n\n if (schemaProperty) {\n return schemaProperty;\n }\n\n const property = resolveMockOverride(\n safeMockOptions.properties,\n item,\n nonNullableOption,\n );\n\n if (property) {\n return property;\n }\n\n if (\n context.output.override.mock?.useExamples ||\n safeMockOptions.useExamples\n ) {\n // OAS 3.0 inputs go through @scalar/openapi-parser's upgrade(), which\n // rewrites property-level `example: <value>` into `examples: [<value>]`\n // and deletes the singular field. Fall back to the array form so this\n // option keeps working post-upgrade.\n const propertyExample =\n item.example === undefined\n ? Array.isArray(item.examples) && item.examples.length > 0\n ? item.examples[0]\n : undefined\n : item.example;\n if (propertyExample !== undefined) {\n return {\n value: formatSchemaExampleValue(\n propertyExample,\n item as OpenApiSchemaObject,\n context,\n ),\n imports: [],\n name: item.name,\n overrided: true,\n };\n }\n }\n\n const formatOverrides = safeMockOptions.format ?? {};\n const ALL_FORMAT: Record<string, string> = {\n ...DEFAULT_FORMAT_MOCK,\n ...Object.fromEntries(\n Object.entries(formatOverrides).filter(\n (entry): entry is [string, string] => typeof entry[1] === 'string',\n ),\n ),\n };\n\n // Both OpenAPI 3.1 `type: [..., 'null']` and OpenAPI 3.0 `nullable: true`\n // reach here as a null union, because @scalar/openapi-parser upgrades 3.0\n // inputs to 3.1 before mock generation. When this getter wraps the value via\n // `getNullable` it flags the returned MockDefinition with `nullWrapped` so the\n // object property layer does not add a second `arrayElement([..., null])`.\n const isNullable = Array.isArray(item.type) && item.type.includes('null');\n const nullWrapped = isNullable && !nonNullableOption;\n // The @scalar/openapi-parser upgrader rewrites `format: binary` to\n // `contentMediaType: application/octet-stream` when upgrading OAS 3.0 → 3.1;\n // treat both equivalently so the mock emits the binary format value\n // (ArrayBuffer) instead of falling through to the string case.\n const schemaContentMediaType = (item as OpenApiSchemaObject).contentMediaType;\n if (\n !item.format &&\n schemaContentMediaType === 'application/octet-stream' &&\n ALL_FORMAT.binary\n ) {\n return {\n value: getNullable(ALL_FORMAT.binary, isNullable, nonNullableOption),\n imports: [],\n name: item.name,\n overrided: false,\n nullWrapped,\n };\n }\n if (item.format && ALL_FORMAT[item.format]) {\n let value = ALL_FORMAT[item.format];\n\n const dateFormats = ['date', 'date-time'];\n if (dateFormats.includes(item.format) && context.output.override.useDates) {\n value = `new Date(${value})`;\n }\n\n return {\n value: getNullable(value, isNullable, nonNullableOption),\n imports: [],\n name: item.name,\n overrided: false,\n nullWrapped,\n };\n }\n\n const type = getItemType(item);\n const isFakerV9 =\n !!context.output.packageJson &&\n isFakerVersionV9(context.output.packageJson);\n\n switch (type) {\n case 'number':\n case 'integer': {\n const intFunction =\n context.output.override.useBigInt &&\n (item.format === 'int64' || item.format === 'uint64')\n ? 'bigInt'\n : 'int';\n // Handle exclusiveMinimum/exclusiveMaximum for both OpenAPI 3.0 (boolean) and 3.1 (number).\n // OpenAPI 3.0: booleans indicating whether minimum/maximum is exclusive — use minimum/maximum as the bound.\n // OpenAPI 3.1: numbers representing the exclusive boundary value — use directly.\n // Spec-supplied bounds land in `faker.number.int({min: ${numMin}})` as\n // bare expressions, so assert them rather than casting. `typeof` is not\n // enough for the exclusive branches: a YAML document can say `.nan` or\n // `.inf`, which are numbers but would emit `min: NaN` / `max: Infinity`.\n const specMin = safeNumericConstraint(item.minimum, 'minimum');\n const specMax = safeNumericConstraint(item.maximum, 'maximum');\n const numMin =\n typeof item.exclusiveMinimum === 'number'\n ? safeNumericConstraint(item.exclusiveMinimum, 'exclusiveMinimum')\n : (specMin ?? safeMockOptions.numberMin);\n const numMax =\n typeof item.exclusiveMaximum === 'number'\n ? safeNumericConstraint(item.exclusiveMaximum, 'exclusiveMaximum')\n : (specMax ?? safeMockOptions.numberMax);\n const intParts: string[] = [];\n if (numMin !== undefined) intParts.push(`min: ${numMin}`);\n if (numMax !== undefined) intParts.push(`max: ${numMax}`);\n if (isFakerV9 && item.multipleOf !== undefined)\n intParts.push(\n `multipleOf: ${safeNumericConstraint(item.multipleOf, 'multipleOf')}`,\n );\n let value = getNullable(\n `faker.number.${intFunction}(${intParts.length > 0 ? `{${intParts.join(', ')}}` : ''})`,\n isNullable,\n nonNullableOption,\n );\n if (type === 'number') {\n const floatParts: string[] = [];\n if (numMin !== undefined) floatParts.push(`min: ${numMin}`);\n if (numMax !== undefined) floatParts.push(`max: ${numMax}`);\n if (isFakerV9 && item.multipleOf !== undefined) {\n floatParts.push(\n `multipleOf: ${safeNumericConstraint(item.multipleOf, 'multipleOf')}`,\n );\n } else if (safeMockOptions.fractionDigits !== undefined) {\n floatParts.push(`fractionDigits: ${safeMockOptions.fractionDigits}`);\n }\n value = getNullable(\n `faker.number.float(${floatParts.length > 0 ? `{${floatParts.join(', ')}}` : ''})`,\n isNullable,\n nonNullableOption,\n );\n }\n const numberImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n numberImports,\n context,\n existingReferencedProperties,\n 'number',\n );\n } else if ('const' in item) {\n value = JSON.stringify(item.const);\n }\n\n return {\n value,\n enums: item.enum,\n imports: numberImports,\n name: item.name,\n // `item.enum` / `const` reassign `value` after `getNullable`, discarding\n // the wrap — so only the plain numeric path is actually null-wrapped.\n nullWrapped: nullWrapped && !item.enum && !('const' in item),\n };\n }\n\n case 'boolean': {\n let value = 'faker.datatype.boolean()';\n const booleanImports: GeneratorImport[] = [];\n if (item.enum) {\n value = getEnum(\n item,\n booleanImports,\n context,\n existingReferencedProperties,\n 'boolean',\n );\n } else if ('const' in item) {\n value = JSON.stringify(item.const);\n }\n return {\n value,\n enums: item.enum,\n imports: booleanImports,\n name: item.name,\n };\n }\n\n case 'array': {\n // OpenAPI 3.1 tuples carry their positional element schemas in\n // `prefixItems` (not `items`). Mock each fixed position so the emitted\n // literal is assignable to the generated `[T0, T1, ...]` tuple type.\n // Emitting only the fixed positions stays type-safe even when `items`\n // also defines a rest element, because the generated type is\n // `[...prefix, ...Additional[]]` and the rest permits zero elements.\n const prefixItems = item.prefixItems as MockSchema[] | undefined;\n if (prefixItems && prefixItems.length > 0) {\n const tupleImports: GeneratorImport[] = [];\n const tupleValues = prefixItems.map((prefixItem, index) => {\n const { value: elementValue, imports: elementImports } =\n resolveMockValue({\n schema: {\n ...prefixItem,\n name: item.name,\n parentName: item.parentName,\n path: item.path ? `${item.path}.[${index}]` : `#.[${index}]`,\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n tupleImports.push(...elementImports);\n return elementValue;\n });\n return {\n value: `[${tupleValues.join(', ')}]`,\n imports: tupleImports,\n name: item.name,\n };\n }\n\n if (!item.items) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n const itemsRef = extractItemsRef(item.items);\n if (\n itemsRef &&\n existingReferencedProperties.includes(\n getRefInfo(itemsRef, context).name,\n )\n ) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n // If `items` is a single-element `allOf`/`oneOf`/`anyOf` wrapping a\n // `$ref`, treat it as a direct `$ref`. This avoids double-wrapping when\n // the inner schema is an enum array (whose `getEnum` already emits\n // `faker.helpers.arrayElements(...)`) and keeps recursion semantics in\n // line with direct-$ref items.\n const resolvedItems =\n itemsRef && !('$ref' in item.items) ? { $ref: itemsRef } : item.items;\n\n const {\n value,\n enums,\n imports: resolvedImports,\n } = resolveMockValue({\n schema: {\n ...resolvedItems,\n name: item.name,\n parentName: item.parentName,\n path: item.path ? `${item.path}.[]` : '#.[]',\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n });\n\n if (enums) {\n return {\n value,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n let mapValue = value;\n\n const extractedItemCall = extractArrayItemMock({\n items: resolvedItems,\n propertyName: item.name,\n parentName: item.parentName,\n operationId,\n tags,\n mapValue,\n context,\n splitMockImplementations,\n imports: resolvedImports,\n });\n if (extractedItemCall) {\n mapValue = extractedItemCall;\n }\n\n if (\n combine &&\n !value.startsWith('faker') &&\n !value.startsWith('{') &&\n !value.startsWith('Array.from')\n ) {\n mapValue = `{${value}}`;\n }\n\n // Use global defaults for the missing bound only when they do not\n // invert the range; otherwise reuse the explicit schema bound so we\n // never invent values the user did not supply (and never produce\n // min > max). This also avoids relying on faker's internal default\n // upper bound when only `minItems` is specified, which can otherwise\n // produce very large arrays.\n const arrSchemaMin = safeNumericConstraint(item.minItems, 'minItems');\n const arrSchemaMax = safeNumericConstraint(item.maxItems, 'maxItems');\n const arrGlobalMin = safeMockOptions.arrayMin;\n const arrGlobalMax = safeMockOptions.arrayMax;\n\n let arrMin: number | undefined;\n if (arrSchemaMin !== undefined) {\n arrMin = arrSchemaMin;\n } else if (arrSchemaMax === undefined) {\n arrMin = arrGlobalMin;\n } else if (arrGlobalMin === undefined || arrGlobalMin > arrSchemaMax) {\n arrMin = arrSchemaMax;\n } else {\n arrMin = arrGlobalMin;\n }\n\n let arrMax: number | undefined;\n if (arrSchemaMax !== undefined) {\n arrMax = arrSchemaMax;\n } else if (arrSchemaMin === undefined) {\n arrMax = arrGlobalMax;\n } else if (arrGlobalMax === undefined || arrGlobalMax < arrSchemaMin) {\n arrMax = arrSchemaMin;\n } else {\n arrMax = arrGlobalMax;\n }\n\n const arrParts: string[] = [];\n if (arrMin !== undefined) arrParts.push(`min: ${arrMin}`);\n if (arrMax !== undefined) arrParts.push(`max: ${arrMax}`);\n const arrLengthArg =\n arrParts.length > 0 ? `{${arrParts.join(', ')}}` : '';\n\n return {\n value:\n `Array.from({ length: faker.number.int(` +\n `${arrLengthArg}) ` +\n `}, (_, i) => i + 1).map(() => (${mapValue}))`,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n case 'string': {\n // faker.string.alpha's `length: { min, max }` form requires BOTH bounds.\n // When only one side is schema-specified, fall back to the global default\n // for the missing side only if it does not invert the range; otherwise\n // reuse the explicit bound so we never invent values the user did not\n // supply (and never produce min > max).\n const schemaMin = safeNumericConstraint(item.minLength, 'minLength');\n const schemaMax = safeNumericConstraint(item.maxLength, 'maxLength');\n const globalMin = safeMockOptions.stringMin;\n const globalMax = safeMockOptions.stringMax;\n\n let strMin: number | undefined;\n if (schemaMin !== undefined) {\n strMin = schemaMin;\n } else if (schemaMax === undefined) {\n strMin = globalMin;\n } else if (globalMin === undefined || globalMin > schemaMax) {\n strMin = schemaMax;\n } else {\n strMin = globalMin;\n }\n\n let strMax: number | undefined;\n if (schemaMax !== undefined) {\n strMax = schemaMax;\n } else if (schemaMin === undefined) {\n strMax = globalMax;\n } else if (globalMax === undefined || globalMax < schemaMin) {\n strMax = schemaMin;\n } else {\n strMax = globalMax;\n }\n\n // faker.string.alpha's `length: { min, max }` requires both bounds, so\n // only emit a length argument when we have a complete pair. If only one\n // side could be resolved (e.g., no schema bound and only one global is\n // configured) we fall back to faker's own default length.\n const strLenParts: string[] = [];\n if (strMin !== undefined && strMax !== undefined) {\n strLenParts.push(`min: ${strMin}`, `max: ${strMax}`);\n }\n const length =\n strLenParts.length > 0 ? `{length: {${strLenParts.join(', ')}}}` : '';\n let value = `faker.string.alpha(${length})`;\n const stringImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n stringImports,\n context,\n existingReferencedProperties,\n 'string',\n );\n } else if (item.pattern) {\n value = `faker.helpers.fromRegExp(${JSON.stringify(item.pattern)})`;\n } else if ('const' in item) {\n value = JSON.stringify((item as OpenApiSchemaObject).const);\n }\n\n return {\n value: getNullable(value, isNullable, nonNullableOption),\n enums: item.enum,\n name: item.name,\n imports: stringImports,\n nullWrapped,\n };\n }\n\n case 'null': {\n return {\n value: 'null',\n imports: [],\n name: item.name,\n };\n }\n\n default: {\n if (item.enum) {\n const enumImports: GeneratorImport[] = [];\n const value = getEnum(\n item,\n enumImports,\n context,\n existingReferencedProperties,\n );\n\n return {\n value,\n enums: item.enum,\n imports: enumImports,\n name: item.name,\n };\n }\n\n return getMockObject({\n item,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator: combine.separator,\n includedProperties: [],\n }\n : undefined,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n }\n }\n}\n\n// Returns the $ref string from array `items` — either direct ($ref on items\n// itself) or wrapped in a single-element allOf/oneOf/anyOf composition.\n// Multi-element compositions return undefined to preserve combine semantics.\nexport function extractItemsRef(items: MockSchema): string | undefined {\n if (isReference(items)) {\n return items.$ref;\n }\n for (const key of ['allOf', 'oneOf', 'anyOf'] as const) {\n const composed = items[key] as MockSchema[] | undefined;\n if (\n Array.isArray(composed) &&\n composed.length === 1 &&\n isReference(composed[0])\n ) {\n return composed[0].$ref;\n }\n }\n return;\n}\n\nfunction getItemType(item: MockSchemaObject) {\n if (Array.isArray(item.type) && item.type.includes('null')) {\n const typesWithoutNull = item.type.filter((x) => x !== 'null');\n const itemType =\n typesWithoutNull.length === 1 ? typesWithoutNull[0] : typesWithoutNull;\n\n return itemType;\n }\n\n if (item.type) return item.type;\n if (!item.enum) return;\n\n const uniqTypes = new Set(item.enum.map((value) => typeof value));\n if (uniqTypes.size > 1) return;\n\n const type = [...uniqTypes.values()].at(0);\n if (!type) return;\n return ['string', 'number'].includes(type) ? type : undefined;\n}\n\n/**\n * Renders one enum member as a literal for the generated faker array.\n *\n * The branch is on the member's own type, never on the schema's declared\n * `type`: both come from the document and nothing makes them agree. Keying off\n * the declared type meant a string member under `type: 'integer'` was spliced\n * in as a live expression, a numeric member under `type: 'string'` crashed the\n * generator, and an object member emitted `[object Object]`.\n */\nfunction formatEnumMember(value: unknown): string {\n if (isString(value)) {\n return `'${jsStringLiteralEscape(value)}'`;\n }\n\n if (isNumber(value) || isBoolean(value)) {\n return String(value);\n }\n\n return JSON.stringify(value);\n}\n\nfunction getEnum(\n item: MockSchemaObject,\n imports: GeneratorImport[],\n context: ContextSpec,\n existingReferencedProperties: string[],\n // Only gates the `Object.values(...)` reference shortcut below. It must not\n // decide how a member is quoted — see `formatEnumMember`.\n type?: 'string' | 'number' | 'boolean',\n) {\n if (!item.enum) return '';\n const joinedEnumValues = item.enum\n .filter((e) => e !== null) // TODO fix type, e can absolutely be null\n .map((e) => formatEnumMember(e))\n .join(',');\n\n let enumValue = `[${joinedEnumValues}]`;\n if (context.output.override.enumGenerationType === EnumGeneration.ENUM) {\n const isRootSchema =\n !item.parentName && existingReferencedProperties.at(-1) === item.name;\n if (\n item.isRef ||\n existingReferencedProperties.length === 0 ||\n isRootSchema\n ) {\n enumValue += ` as ${item.name}${item.name.endsWith('[]') ? '' : '[]'}`;\n imports.push({ name: item.name });\n } else {\n const parentReference = existingReferencedProperties.at(-1);\n if (!parentReference) {\n return '';\n }\n\n enumValue += ` as ${parentReference}['${item.name}']`;\n if (!item.path?.endsWith('[]')) enumValue += '[]';\n imports.push({\n name: parentReference,\n });\n }\n } else {\n enumValue += ' as const';\n }\n\n // But if the value is a reference to a schema that emits a runtime value\n // (a native `enum` object or a `const` object), we can use it directly via\n // the imports and `Object.values`. A `union` reference is a pure type with\n // no runtime value, so `Object.values` would fail (TS2693) — keep the\n // inlined values in that case (#3690).\n //\n // Members must all actually be strings, not merely declared `type: 'string'`.\n // A numeric member emits a numeric TS enum, which compiles to a two-way map\n // (`{1: 'NUMBER_1', NUMBER_1: 1}`), so `Object.values` would also yield the\n // member *names* and the mock could return a value the schema never declared.\n if (\n item.isRef &&\n type === 'string' &&\n item.enum.every((e) => isString(e)) &&\n context.output.override.enumGenerationType !== EnumGeneration.UNION\n ) {\n enumValue = `Object.values(${item.name})`;\n imports.push({\n name: item.name,\n values: true,\n });\n }\n\n return item.path?.endsWith('[]')\n ? `faker.helpers.arrayElements(${enumValue})`\n : `faker.helpers.arrayElement(${enumValue})`;\n}\n","import {\n type ContextSpec,\n type GeneratorImport,\n getRefInfo,\n getRequiredKeys,\n isFunction,\n isReference,\n type MockOptions,\n type OpenApiSchemaObject,\n OutputMockType,\n pascal,\n} from '@orval/core';\nimport { prop } from 'remeda';\n\nimport {\n formatMockFactoryDeclaration,\n getMockFactorySignatureParts,\n getStrictMockTypeName,\n isStrictMock,\n} from '../../mock-types';\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { overrideVarName } from '../getters';\nimport { collectAllOfRequiredWithDeclared } from '../getters/all-of-required';\nimport { getMockScalar } from '../getters/scalar';\nimport { appendImportsDelta, mergeReturnedMockImports } from '../imports';\n\nfunction isRegex(key: string) {\n return key.startsWith('/') && key.endsWith('/');\n}\n\n// Drop `[]` array-items segments from a dotted JSON-pointer-ish path. Treating\n// the marker as transparent for property override matching lets a bare\n// property-name override apply wherever the property literally appears, even\n// inside arrays (#2465). Segment-based so both leading (`[].id`) and embedded\n// (`foo.[].id`) markers normalize equivalently.\nfunction stripArrayMarkerSegments(s: string): string {\n return s\n .split('.')\n .filter((seg) => seg !== '[]')\n .join('.');\n}\n\nexport function resolveMockOverride(\n properties: Record<string, unknown> | undefined = {},\n item: OpenApiSchemaObject & { name: string; path?: string },\n nonNullableOption?: boolean,\n) {\n const path = item.path ?? `#.${item.name}`;\n // Regex keys still match against the original (un-normalized) path so users\n // can opt into array-scoped targeting explicitly if ever needed.\n const normalizedPath = stripArrayMarkerSegments(path);\n const entries = Object.entries(properties);\n\n // Tier 1 — explicit matches: regex (against name or full path) and exact\n // array-transparent path. Checked first so a specific override (regex or\n // dotted path like `country.name`) always wins over the bare-name fallback.\n let property = entries.find(([key]) => {\n if (isRegex(key)) {\n const regex = new RegExp(key.slice(1, -1));\n if (regex.test(item.name) || regex.test(path)) {\n return true;\n }\n }\n\n if (`#.${stripArrayMarkerSegments(key)}` === normalizedPath) {\n return true;\n }\n\n return false;\n });\n\n // Tier 2 — bare property-name transparency (#3470): a dot-less key applies\n // wherever the property literally appears, including inside non-array nested\n // objects, mirroring the array transparency from #2465. Only reached when no\n // explicit Tier 1 key matched, so it never overrides a more specific key.\n if (!property) {\n property = entries.find(\n ([key]) => !isRegex(key) && !key.includes('.') && key === item.name,\n );\n }\n\n if (!property) {\n return;\n }\n\n return {\n value: getNullable(\n property[1] as string,\n isNullableSchema(item),\n nonNullableOption,\n ),\n imports: [],\n name: item.name,\n overrided: true,\n };\n}\n\n/** Resolves a `$ref` string to its schema in the loaded spec, if any. */\nexport function resolveRefTarget(\n ref: string | undefined,\n context: ContextSpec,\n): Partial<OpenApiSchemaObject> | undefined {\n if (typeof ref !== 'string') return undefined;\n // getRefInfo throws on refs without a '#' fragment\n const [, fragment] = ref.split('#');\n if (!fragment) return undefined;\n const { refPaths } = getRefInfo(ref, context);\n if (!Array.isArray(refPaths)) return undefined;\n\n return prop(\n context.spec,\n // @ts-expect-error: [ts2556] refPaths are not guaranteed to be valid keys of the spec\n ...refPaths,\n ) as Partial<OpenApiSchemaObject> | undefined;\n}\n\n/** OpenAPI 3.0 `nullable: true` or 3.1 `type` unions that include `null`. */\nexport function isNullableSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== 'object') {\n return false;\n }\n\n const { type, nullable } = schema as {\n type?: unknown;\n nullable?: unknown;\n };\n\n return nullable === true || (Array.isArray(type) && type.includes('null'));\n}\n\n/** When `nonNullableOption` is true (`override.mock.nonNullable`), omit the null branch. */\nexport function getNullable(\n value: string,\n nullable?: boolean,\n nonNullableOption?: boolean,\n) {\n if (!nullable || nonNullableOption) {\n return value;\n }\n\n return `faker.helpers.arrayElement([${value}, null])`;\n}\n\n/**\n * True when the active faker generator entry asks for consolidated schema\n * mock factories and the output is configured to host them (i.e. there is a\n * dedicated schemas directory we can import `index.faker` from). Used to\n * decide whether an operation factory should inline a `$ref`'d schema or\n * delegate to its `get<X>Mock` factory.\n */\nfunction shouldDelegateToSchemaFactories(context: ContextSpec): boolean {\n if (!context.output.schemas) return false;\n // The duplicate-type guard in `normalizeMocksOption` (see\n // `packages/orval/src/utils/options.ts`) ensures at most one faker entry\n // exists per output, so finding the first one that opted into schemas is\n // unambiguous today and remains correct if that guard ever loosens.\n const fakerEntry = context.output.mock.generators.find(\n (g) =>\n !isFunction(g) && g.type === OutputMockType.FAKER && g.schemas === true,\n );\n return !!fakerEntry;\n}\n\n/**\n * Predicate: this `$ref` points at a top-level `#/components/schemas/<Name>`\n * (vs. a parameter, response, or inline schema). Only those have a\n * corresponding `get<Name>Mock` factory in the consolidated faker file.\n */\nfunction isComponentsSchemaRef(refPaths: string[] | undefined): boolean {\n return (\n Array.isArray(refPaths) &&\n refPaths[0] === 'components' &&\n refPaths[1] === 'schemas'\n );\n}\n\n/**\n * Returns true when an operation- or tag-level mock override touches any\n * property declared on the referenced schema. In that case we must inline\n * the schema body so the override actually applies; the shared\n * `get<X>Mock` factory has no knowledge of operation-scoped overrides.\n *\n * Schema-scoped overrides (`override.mock.schemas`) need no special handling\n * here: they target a schema's *own* properties, so the schema's `get<X>Mock`\n * factory — built with the same mock options — already bakes them in, and\n * delegating to it preserves the override.\n *\n * Reuses `resolveMockOverride` so the same matching rules apply as for\n * regular property mocks — bare name, regex (`/.../`), and exact-path\n * (`#.foo.bar`). The parent's `path` (where the `$ref` appears in the\n * surrounding schema) gets composed into each synthetic property item so\n * exact-path overrides like `#.color.value` resolve correctly.\n */\nfunction hasOverrideTouchingSchema(\n schemaProperties: Record<string, unknown> | undefined,\n mockOptions: MockOptions | undefined,\n operationId: string,\n tags: string[],\n parentPath: string | undefined,\n): boolean {\n if (!schemaProperties) return false;\n const propertyNames = Object.keys(schemaProperties);\n if (propertyNames.length === 0) return false;\n\n const overrideBuckets: (Record<string, unknown> | undefined)[] = [\n mockOptions?.operations?.[operationId]?.properties,\n ];\n for (const tag of tags) {\n overrideBuckets.push(mockOptions?.tags?.[tag]?.properties);\n }\n\n return overrideBuckets.some((bucket) => {\n if (!bucket) return false;\n return propertyNames.some((propertyName) => {\n const synthetic = {\n name: propertyName,\n path: parentPath ? `${parentPath}.${propertyName}` : propertyName,\n } as OpenApiSchemaObject & { name: string; path?: string };\n return !!resolveMockOverride(bucket, synthetic);\n });\n });\n}\n\ninterface ResolveMockValueOptions {\n schema: MockSchema;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Tracks the current contiguous `allOf` composition to break cyclic\n // inheritance; threaded through to `combineSchemasMock`.\n // See `existingReferencedAllOfRefs` docs in getters/combine.ts.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n allowOverride?: boolean;\n}\n\nexport function resolveMockValue({\n schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n allowOverride,\n}: ResolveMockValueOptions): MockDefinition & { type?: string } {\n if (isReference(schema)) {\n const schemaReference = schema as MockSchema & {\n path?: string;\n required?: string[];\n nullable?: boolean;\n };\n const schemaRefPath = typeof schema.$ref === 'string' ? schema.$ref : '';\n const { name, refPaths } = getRefInfo(schemaRefPath, context);\n\n const schemaRef = resolveRefTarget(schemaRefPath, context);\n\n const newSchema = {\n ...schemaRef,\n name,\n path: schemaReference.path,\n isRef: true,\n required: [\n ...((schemaRef?.required as string[] | undefined) ?? []),\n ...getRequiredKeys(schemaReference, name),\n ],\n ...(schemaReference.nullable === undefined\n ? {}\n : { nullable: schemaReference.nullable }),\n } as MockSchemaObject;\n\n // When a discriminator parent ($ref-loaded schema with both `discriminator`\n // and `oneOf`) is being expanded inside an `allOf` chain AND the chain\n // is rooted at one of that parent's mapping targets (i.e. the current\n // schema *is* a variant via `allOf: [parent, ...extras]`), the parent's\n // `oneOf` is descriptive of the union, not additive to this specific\n // variant. Re-expanding it inlines sibling factory calls into the derived\n // variant's mock body (#2155). Drop the `oneOf` side here; the parent\n // still contributes its own `properties` and other base attributes\n // through the remaining schema fields.\n //\n // The mapping-target check guards against cases like\n // `someField: allOf: [<discriminator parent>]` (e.g. #one-of-nested\n // `Example2.expiry`), where the surrounding schema is NOT a variant of\n // the parent and we still need the full union to randomize over.\n //\n // Symmetrically with the oneOf-side fix in `combineSchemasMock` (#3429),\n // also drop the discriminator key from the parent's `properties`: each\n // variant already carries a constrained discriminator value via\n // `resolveDiscriminators`, so leaving the parent's free-choice enum in\n // would just emit dead code (immediately shadowed by the variant's\n // constrained value through spread merge).\n if (\n combine?.separator === 'allOf' &&\n newSchema.discriminator &&\n newSchema.oneOf\n ) {\n const parentDiscriminator = newSchema.discriminator as {\n propertyName?: string;\n mapping?: Record<string, string>;\n };\n const mappingTargetNames = parentDiscriminator.mapping\n ? Object.values(parentDiscriminator.mapping).map((ref) =>\n pascal(ref.split('/').pop() ?? ''),\n )\n : [];\n const expandingAsVariant = existingReferencedProperties.some((refName) =>\n mappingTargetNames.includes(refName),\n );\n\n if (expandingAsVariant) {\n const mutableSchema = newSchema as Record<string, unknown>;\n delete mutableSchema.oneOf;\n const parentProperties = newSchema.properties as\n | Record<string, unknown>\n | undefined;\n if (\n parentDiscriminator.propertyName &&\n parentProperties &&\n parentDiscriminator.propertyName in parentProperties\n ) {\n const remainingProperties = Object.fromEntries(\n Object.entries(parentProperties).filter(\n ([key]) => key !== parentDiscriminator.propertyName,\n ),\n );\n if (Object.keys(remainingProperties).length === 0) {\n delete mutableSchema.properties;\n } else {\n mutableSchema.properties = remainingProperties;\n }\n const parentRequired = newSchema.required as string[] | undefined;\n if (Array.isArray(parentRequired)) {\n const filteredRequired = parentRequired.filter(\n (key) => key !== parentDiscriminator.propertyName,\n );\n if (filteredRequired.length === 0) {\n delete mutableSchema.required;\n } else {\n mutableSchema.required = filteredRequired;\n }\n }\n }\n }\n }\n\n const newSeparator = newSchema.allOf\n ? 'allOf'\n : newSchema.oneOf\n ? 'oneOf'\n : 'anyOf';\n\n // A shared factory only encodes the referenced schema's OWN optionality.\n // When this $ref sits inside an allOf composition, combineSchemasMock\n // attaches the composition-wide `required` union (schemaReference.required),\n // e.g. a constraint-only sibling `{ required: [id] }` makes the base's\n // optional `id` required. Delegating would keep the factory's\n // `arrayElement([..., undefined])` branch for that property and emit a\n // mock the composed type rejects, so inline the schema body instead.\n // The target's effective shape is computed recursively: its properties\n // and required may themselves live behind the target's own allOf chain.\n const targetEffective = schemaRef\n ? collectAllOfRequiredWithDeclared(\n [schemaRef as MockSchema],\n context,\n new Set(),\n )\n : undefined;\n const delegationDropsRequired = (schemaReference.required ?? []).some(\n (requiredName) =>\n targetEffective?.declared.has(requiredName) &&\n !targetEffective.required.includes(requiredName),\n );\n\n // When schema-level faker factories are being emitted (`schemas: true`),\n // delegate to `get<X>Mock()` instead of inlining the body. The factory\n // already encodes the same fields, so this both deduplicates the output\n // and lets a single source of truth drive shared mocks.\n const canDelegate =\n shouldDelegateToSchemaFactories(context) &&\n isComponentsSchemaRef(refPaths) &&\n // A ref already on the resolution path is recursive: delegating would\n // emit a factory call that re-enters itself at runtime. Inline it so\n // the recursion terminators can cut the cycle instead.\n !existingReferencedProperties.includes(name) &&\n !delegationDropsRequired &&\n !hasOverrideTouchingSchema(\n schemaRef?.properties as Record<string, unknown> | undefined,\n mockOptions,\n operationId,\n tags,\n schemaReference.path,\n );\n\n if (canDelegate) {\n const factoryName = `get${pascal(name)}Mock`;\n const factoryImport: GeneratorImport = {\n name: factoryName,\n values: true,\n schemaFactory: true,\n };\n const isObjectLike =\n newSchema.type === 'object' ||\n !!newSchema.allOf ||\n resolvesToObjectLike(newSchema, context);\n const mockTypeName = getStrictMockTypeName(pascal(name));\n const strictMockTypeImport: GeneratorImport | undefined =\n isStrictMock(mockOptions) && isObjectLike\n ? {\n name: mockTypeName,\n values: false,\n schemaFactory: true,\n }\n : undefined;\n // For object-like refs the historical inline output is `{ ...body }`\n // so the spread form keeps callers (combineSchemasMock, object\n // properties) working without other changes. For everything else\n // (scalars, arrays, nullables) emit the bare call.\n //\n // A `oneOf`/`anyOf` is only object-like when *every* branch resolves to\n // an object. A composition of primitives (e.g. `number | string`) makes\n // the factory return a primitive union, which is not spreadable: emitting\n // `{ ...get<X>Mock() }` is invalid TypeScript (TS2698) and would discard\n // the value as `{}` at runtime, so it must use the bare call (#3200).\n const strictObjectCast =\n isStrictMock(mockOptions) && isObjectLike ? ` as ${mockTypeName}` : '';\n const callValue = isObjectLike\n ? `{ ...${factoryName}()${strictObjectCast} }`\n : `${factoryName}()`;\n\n return {\n value: getNullable(\n callValue,\n Boolean(newSchema.nullable),\n mockOptions?.nonNullable,\n ),\n imports: strictMockTypeImport\n ? [factoryImport, strictMockTypeImport]\n : [factoryImport],\n name: newSchema.name,\n type: getType(newSchema),\n nullWrapped: Boolean(newSchema.nullable) && !mockOptions?.nonNullable,\n };\n }\n\n const importsBefore = imports.length;\n const scalar = getMockScalar({\n item: newSchema,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator:\n combine.separator === 'anyOf' ? newSeparator : combine.separator,\n includedProperties:\n newSeparator === 'allOf' ? [] : combine.includedProperties,\n }\n : undefined,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n if (\n scalar.value &&\n (newSchema.type === 'object' || newSchema.allOf) &&\n combine?.separator === 'oneOf'\n ) {\n const funcName = `get${pascal(operationId)}Response${pascal(newSchema.name)}Mock`;\n if (\n !splitMockImplementations.some((f) =>\n f.includes(`export const ${funcName}`),\n )\n ) {\n const discriminator = newSchema.discriminator as\n | { propertyName?: string }\n | undefined;\n const discriminatedProperty = discriminator?.propertyName;\n\n let overrideType = `Partial<${newSchema.name}>`;\n if (discriminatedProperty) {\n overrideType = `Omit<${overrideType}, '${discriminatedProperty}'>`;\n }\n\n const { param, returnType, returnCast } = getMockFactorySignatureParts(\n newSchema.name,\n mockOptions,\n {\n isOverridable: true,\n overrideType,\n },\n );\n const func = formatMockFactoryDeclaration(\n funcName,\n param,\n returnType,\n `{${scalar.value.startsWith('...') ? '' : '...'}${scalar.value}, ...${overrideVarName}}`,\n returnCast,\n { terminateStatement: true },\n );\n splitMockImplementations.push(func);\n }\n\n scalar.value = newSchema.nullable\n ? `${funcName}()`\n : `{...${funcName}()}`;\n\n const typeImport: GeneratorImport = {\n name: newSchema.name,\n values: false,\n };\n scalar.imports.push(typeImport);\n if (scalar.imports !== imports) {\n // Forward the helper's whole import set, not just the type import.\n // Pushing only `typeImport` mutates `imports`, which suppresses the\n // `mergeReturnedMockImports` call below and drops the imports the\n // helper body needs at runtime — e.g. an enum referenced through\n // `Object.values(...)` (#3656).\n appendImportsDelta(imports, scalar.imports, 0);\n }\n }\n\n mergeReturnedMockImports(imports, importsBefore, scalar.imports);\n\n return {\n ...scalar,\n type: getType(newSchema),\n };\n }\n\n const importsBefore = imports.length;\n const scalar = getMockScalar({\n item: schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n allowOverride,\n });\n mergeReturnedMockImports(imports, importsBefore, scalar.imports);\n return {\n ...scalar,\n type: getType(schema),\n };\n}\n\nfunction getType(schema: MockSchema) {\n if (isReference(schema)) {\n return;\n }\n\n return (\n (schema.type as string | undefined) ??\n (schema.properties ? 'object' : schema.items ? 'array' : undefined)\n );\n}\n\n// Whether a schema (or a `$ref` to one) ultimately produces an object mock.\n// Used to decide if a delegated `get<X>Mock()` call may be spread into an\n// object literal. Object-like schemas are `type: 'object'`, `properties`,\n// `additionalProperties` and `allOf`; a `oneOf`/`anyOf` qualifies only when\n// every branch resolves to an object. A union containing a primitive\n// (e.g. `number | string`) does not, since spreading that union is invalid\n// TypeScript. `seen` carries the `$ref`s on the current resolution path to\n// guard against self-referential compositions. A fresh copy is taken at each\n// `$ref` hop so sibling branches sharing a `$ref` don't falsely trip the guard.\nfunction resolvesToObjectLike(\n schema: MockSchema,\n context: ContextSpec,\n seen = new Set<string>(),\n): boolean {\n let resolved: Partial<OpenApiSchemaObject> | undefined;\n\n if (isReference(schema)) {\n // A non-string or already-visited `$ref` can't be resolved further here.\n if (typeof schema.$ref !== 'string' || seen.has(schema.$ref)) {\n return false;\n }\n seen = new Set(seen).add(schema.$ref);\n resolved = resolveRefTarget(schema.$ref, context);\n } else {\n resolved = schema as Partial<OpenApiSchemaObject>;\n }\n\n if (!resolved) {\n return false;\n }\n\n if (\n resolved.type === 'object' ||\n resolved.properties ||\n resolved.additionalProperties ||\n resolved.allOf\n ) {\n return true;\n }\n\n const branches = (resolved.oneOf ?? resolved.anyOf) as\n | MockSchema[]\n | undefined;\n if (branches && branches.length > 0) {\n return branches.every((branch) =>\n resolvesToObjectLike(branch, context, seen),\n );\n }\n\n return false;\n}\n","import {\n type ContextSpec,\n type GeneratorImport,\n getRefInfo,\n isReference,\n type MockOptions,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { resolveMockValue } from '../resolvers';\nimport { collectAllOfRequired } from './all-of-required';\n\nfunction getReferenceName(\n ref: string | undefined,\n context: ContextSpec,\n): string {\n if (!ref) return '';\n\n return getRefInfo(ref, context).name;\n}\n\ninterface CombineSchemasMockOptions {\n item: MockSchemaObject;\n separator: 'allOf' | 'oneOf' | 'anyOf';\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpec;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n // Schemas on the *current contiguous `allOf` composition* — the chain of\n // `allOf` bases entered to reach the schema being expanded right now. This is\n // the canonical doc for this field; other sites just point here.\n //\n // Why it exists: to break cycles built purely from top-level named schemas\n // that extend each other (`A: allOf[B]`, `B: allOf[A]`). There every hop is a\n // `$ref`, so `item.isRef` is always true and the `!item.isRef` clause in\n // `shouldSkipRef` never fires; this chain catches the repeat instead. (It is\n // narrower than `existingReferencedProperties`, which records every visited\n // `$ref` — variants and properties included.)\n //\n // Invariant: it grows only on a direct `allOf` -> `allOf` base descent, and\n // resets to `[]` when crossing into a `oneOf`/`anyOf` variant or a property\n // value. Those boundaries begin a fresh mock instance whose own `allOf` base\n // is legitimate and must still be pulled in, so keeping the chain across them\n // would wrongly skip that base. Such re-entry can't loop forever anyway —\n // `existingReferencedProperties` already bounds it.\n existingReferencedAllOfRefs?: string[];\n splitMockImplementations: string[];\n}\n\nexport function combineSchemasMock({\n item,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs = [],\n splitMockImplementations,\n}: CombineSchemasMockOptions): MockDefinition {\n const combineImports: GeneratorImport[] = [];\n const includedProperties: string[] = [...(combine?.includedProperties ?? [])];\n const separatorItems = (item[separator] ?? []) as MockSchema[];\n const itemRequired = item.required as string[] | undefined;\n\n const isRefAndNotExisting =\n isReference(item) && !existingReferencedProperties.includes(item.name);\n\n // When a oneOf schema declares a discriminator with a mapping AND the\n // discriminator property is also declared on the parent's `properties`,\n // skip that property here. Each variant already encodes a constrained value\n // for it via `resolveDiscriminators`; emitting the parent's free-choice enum\n // alongside the picked variant would override the constrained value and\n // guarantee a discriminator mismatch (#2155).\n const discriminator = item.discriminator as\n | { propertyName?: string; mapping?: Record<string, string> }\n | undefined;\n const itemProperties = item.properties as Record<string, unknown> | undefined;\n const discriminatorPropertyName =\n separator === 'oneOf' &&\n discriminator?.mapping &&\n discriminator.propertyName &&\n itemProperties &&\n discriminator.propertyName in itemProperties\n ? discriminator.propertyName\n : undefined;\n\n const itemEntriesForResolve = Object.entries(item).filter(\n ([key]) => key !== separator,\n );\n if (discriminatorPropertyName && itemProperties) {\n const propertiesIdx = itemEntriesForResolve.findIndex(\n ([key]) => key === 'properties',\n );\n if (propertiesIdx !== -1) {\n const filteredProperties = Object.fromEntries(\n Object.entries(itemProperties).filter(\n ([key]) => key !== discriminatorPropertyName,\n ),\n );\n if (Object.keys(filteredProperties).length === 0) {\n itemEntriesForResolve.splice(propertiesIdx, 1);\n } else {\n itemEntriesForResolve[propertiesIdx] = [\n 'properties',\n filteredProperties,\n ];\n }\n }\n // Keep `required` in sync with the filtered properties — leaving the\n // discriminator key in `required` would describe a schema whose required\n // field is missing from `properties`.\n const requiredIdx = itemEntriesForResolve.findIndex(\n ([key]) => key === 'required',\n );\n if (requiredIdx !== -1 && Array.isArray(itemRequired)) {\n const filteredRequired = itemRequired.filter(\n (key) => key !== discriminatorPropertyName,\n );\n if (filteredRequired.length === 0) {\n itemEntriesForResolve.splice(requiredIdx, 1);\n } else {\n itemEntriesForResolve[requiredIdx] = ['required', filteredRequired];\n }\n }\n }\n\n const hasResolvableProperties = itemEntriesForResolve.some(\n ([key]) => key === 'properties',\n );\n\n const allRequiredFields: string[] = [];\n if (separator === 'allOf') {\n if (itemRequired) {\n allRequiredFields.push(...itemRequired);\n }\n allRequiredFields.push(...collectAllOfRequired(separatorItems, context));\n }\n\n // The composed schema's own sibling `properties` (declared next to the\n // `allOf`) are one more member of the composition, and their emission is\n // appended last, so it wins the spread merge. Resolve them with the same\n // `required` union as the members, otherwise a property required by a base\n // would be emitted here with an undefined branch the type rejects.\n const itemSchemaForResolve = Object.fromEntries(\n itemEntriesForResolve,\n ) as MockSchemaObject;\n if (separator === 'allOf' && allRequiredFields.length > 0) {\n const itemResolveRequired = itemSchemaForResolve.required as\n | string[]\n | undefined;\n itemSchemaForResolve.required = [\n ...new Set([...allRequiredFields, ...(itemResolveRequired ?? [])]),\n ];\n }\n\n const itemResolvedValue =\n isRefAndNotExisting || hasResolvableProperties\n ? resolveMockValue({\n schema: itemSchemaForResolve,\n combine: {\n separator: 'allOf',\n includedProperties: [],\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n existingReferencedAllOfRefs,\n splitMockImplementations,\n })\n : undefined;\n\n includedProperties.push(...(itemResolvedValue?.includedProperties ?? []));\n combineImports.push(...(itemResolvedValue?.imports ?? []));\n let containsOnlyPrimitiveValues = true;\n\n let value = separator === 'allOf' ? '' : 'faker.helpers.arrayElement([';\n\n for (const val of separatorItems) {\n const refName = isReference(val) ? getReferenceName(val.$ref, context) : '';\n // For allOf: skip a base that would otherwise re-expand forever, in any of:\n // - `refName === item.name`: the schema lists itself as its own base;\n // - an already-seen *inline* base (`!item.isRef`): a circular inline allOf;\n // - a ref already on the contiguous allOf chain\n // (`existingReferencedAllOfRefs`): a top-level allOf cycle — see that\n // field's docs above.\n // Top-level refs (`item.isRef`) are otherwise allowed through so a schema\n // still inherits its base properties.\n // For oneOf/anyOf: skip a variant pointing back to an already-visited schema,\n // otherwise polymorphic recursion re-expands forever\n // (e.g. Base.Parent → oneOf [Derived → allOf [Base]]).\n const shouldSkipRef =\n separator === 'allOf'\n ? refName &&\n (refName === item.name ||\n (existingReferencedProperties.includes(refName) && !item.isRef) ||\n existingReferencedAllOfRefs.includes(refName))\n : refName && existingReferencedProperties.includes(refName);\n\n if (shouldSkipRef) {\n if (separatorItems.length === 1) {\n value = 'undefined';\n }\n continue;\n }\n\n // the required fields in this schema need to be considered\n // in the sub schema under the allOf key\n const schema = (() => {\n if (separator !== 'allOf' || allRequiredFields.length === 0) {\n return {\n ...val,\n name: item.name,\n path: item.path ?? '#',\n };\n }\n\n const valWithRequired = val as MockSchema & { required?: string[] };\n const valRequired = valWithRequired.required;\n const combinedRequired = valRequired\n ? [...allRequiredFields, ...valRequired]\n : allRequiredFields;\n\n return {\n ...val,\n name: item.name,\n path: item.path ?? '#',\n required: [...new Set(combinedRequired)],\n };\n })();\n\n const resolvedValue = resolveMockValue({\n schema,\n combine: {\n separator,\n includedProperties:\n separator === 'oneOf'\n ? (itemResolvedValue?.includedProperties ?? [])\n : includedProperties,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n // Grow the chain on an allOf base hop; reset it on a oneOf/anyOf variant\n // (a fresh instance). See `existingReferencedAllOfRefs` docs above.\n existingReferencedAllOfRefs:\n separator === 'allOf' && refName\n ? [...existingReferencedAllOfRefs, refName]\n : [],\n splitMockImplementations,\n });\n\n combineImports.push(...resolvedValue.imports);\n includedProperties.push(...(resolvedValue.includedProperties ?? []));\n\n if (resolvedValue.value === '{}') {\n containsOnlyPrimitiveValues = false;\n continue;\n }\n\n if (separator === 'allOf') {\n if (resolvedValue.value.startsWith('{') || !resolvedValue.type) {\n containsOnlyPrimitiveValues = false;\n value += `...${resolvedValue.value},`;\n continue;\n }\n\n if (resolvedValue.type === 'object') {\n containsOnlyPrimitiveValues = false;\n value += resolvedValue.value.startsWith('faker')\n ? `...${resolvedValue.value},`\n : `...{${resolvedValue.value}},`;\n continue;\n }\n }\n\n value += `${resolvedValue.value},`;\n }\n // When every oneOf/anyOf variant was skipped (e.g. all $refs were already on\n // the resolution stack) the loop leaves `value` at its initial opener. Emit\n // `undefined` instead of closing it as `faker.helpers.arrayElement([])`,\n // which throws at runtime.\n const isEmptyArrayElement =\n separator !== 'allOf' && value === 'faker.helpers.arrayElement([';\n\n let finalValue =\n value === 'undefined' || isEmptyArrayElement\n ? 'undefined'\n : // containsOnlyPrimitiveValues isn't just true, it's being set to false inside the above reduce and the type system doesn't detect it\n `${separator === 'allOf' && !containsOnlyPrimitiveValues ? '{' : ''}${value}${separator === 'allOf' ? (containsOnlyPrimitiveValues ? '' : '}') : '])'}`;\n if (itemResolvedValue) {\n finalValue = finalValue.startsWith('...')\n ? `...{${finalValue}, ${itemResolvedValue.value}}`\n : `{...${finalValue}, ${itemResolvedValue.value}}`;\n }\n if (finalValue.endsWith(',')) {\n finalValue = finalValue.slice(0, Math.max(0, finalValue.length - 1));\n }\n\n return {\n value: finalValue,\n imports: combineImports,\n name: item.name,\n includedProperties,\n };\n}\n","import {\n camelPathParamName,\n jsStringLiteralEscape,\n toColonRoutePath,\n} from '@orval/core';\n\n// MSW route params are camelized to match the generated mock function args.\n//\n// The result is a *source fragment*, not a plain value: the `\\\\:` below is two\n// literal backslashes so the emitted single-quoted literal compiles to MSW's\n// `\\:` escape for a colon that is not a param. Because of that, the spec text\n// has to be escaped for the literal here — before the colon escape is spliced\n// in — rather than at the emit site, where escaping again would double these\n// intentional backslashes.\nexport const getRouteMSW = (route: string, baseUrl = '*') =>\n `${jsStringLiteralEscape(baseUrl)}${toColonRoutePath(\n jsStringLiteralEscape(route).replaceAll(':', String.raw`\\\\:`),\n camelPathParamName,\n )}`;\n","import {\n type ContextSpec,\n generalJSTypesWithArray,\n type GeneratorImport,\n type GlobalMockOptions,\n isFunction,\n type MockOptions,\n type NormalizedOverrideOutput,\n type OpenApiDocument,\n resolveRef,\n type ResReqTypesValue,\n stringify,\n} from '@orval/core';\n\nimport { formatSchemaExampleValue } from '../faker/format-example-value';\nimport { getMockScalar } from '../faker/getters';\nimport {\n appendImportsDelta,\n collectSplitMockTypeImports,\n} from '../faker/imports';\n\nfunction getMockPropertiesWithoutFunc(\n properties:\n | Record<string, unknown>\n | ((spec: OpenApiDocument) => Record<string, unknown>),\n spec: OpenApiDocument,\n) {\n const resolvedProperties =\n typeof properties === 'function' ? properties(spec) : properties;\n const mockProperties: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(resolvedProperties)) {\n const implementation = isFunction(value)\n ? `(${String(value)})()`\n : (stringify(value) ?? 'undefined');\n\n mockProperties[key] = implementation.replaceAll(\n /import_faker\\.defaults|import_faker\\.faker|_faker\\.faker/g,\n 'faker',\n );\n }\n\n return mockProperties;\n}\n\nexport function getMockWithoutFunc(\n spec: OpenApiDocument,\n override?: NormalizedOverrideOutput,\n): MockOptions {\n const operations = override?.operations\n ? (() => {\n const operationMocks: Exclude<MockOptions['operations'], undefined> =\n {};\n\n for (const [key, value] of Object.entries(override.operations)) {\n if (!value?.mock?.properties) {\n continue;\n }\n\n operationMocks[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return operationMocks;\n })()\n : undefined;\n const tags = override?.tags\n ? (() => {\n const tagMocks: Exclude<MockOptions['tags'], undefined> = {};\n\n for (const [key, value] of Object.entries(override.tags)) {\n if (!value?.mock?.properties) {\n continue;\n }\n\n tagMocks[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return tagMocks;\n })()\n : undefined;\n const schemas = override?.mock?.schemas\n ? (() => {\n const schemaMocks: Exclude<MockOptions['schemas'], undefined> = {};\n\n for (const [key, value] of Object.entries(override.mock.schemas)) {\n if (!value?.properties) {\n continue;\n }\n\n schemaMocks[key] = {\n properties: getMockPropertiesWithoutFunc(value.properties, spec),\n };\n }\n\n return schemaMocks;\n })()\n : undefined;\n\n return {\n arrayMin: override?.mock?.arrayMin,\n arrayMax: override?.mock?.arrayMax,\n stringMin: override?.mock?.stringMin,\n stringMax: override?.mock?.stringMax,\n numberMin: override?.mock?.numberMin,\n numberMax: override?.mock?.numberMax,\n required: override?.mock?.required,\n nonNullable: override?.mock?.nonNullable,\n fractionDigits: override?.mock?.fractionDigits,\n ...(override?.mock?.properties\n ? {\n properties: getMockPropertiesWithoutFunc(\n override.mock.properties,\n spec,\n ),\n }\n : {}),\n ...(override?.mock?.format\n ? {\n format: getMockPropertiesWithoutFunc(override.mock.format, spec),\n }\n : {}),\n ...(operations ? { operations } : {}),\n ...(tags ? { tags } : {}),\n ...(schemas ? { schemas } : {}),\n };\n}\n\nfunction getMockNumberOption(\n mockOptionsWithoutFunc: Record<string, unknown>,\n key: 'arrayMin' | 'arrayMax',\n) {\n const value = mockOptionsWithoutFunc[key];\n return typeof value === 'number' ? value : undefined;\n}\n\nfunction getMockScalarJsTypes(\n definition: string,\n mockOptionsWithoutFunc: Record<string, unknown>,\n) {\n const isArray = definition.endsWith('[]');\n const type = isArray ? definition.slice(0, -2) : definition;\n const arrayMin = getMockNumberOption(mockOptionsWithoutFunc, 'arrayMin');\n const arrayMax = getMockNumberOption(mockOptionsWithoutFunc, 'arrayMax');\n\n switch (type) {\n case 'number': {\n const numArrParts: string[] = [];\n if (arrayMin !== undefined) numArrParts.push(`min: ${arrayMin}`);\n if (arrayMax !== undefined) numArrParts.push(`max: ${arrayMax}`);\n const numArrArg =\n numArrParts.length > 0 ? `{${numArrParts.join(', ')}}` : '';\n return isArray\n ? `Array.from({length: faker.number.int(${numArrArg})}, () => faker.number.int())`\n : 'faker.number.int()';\n }\n case 'string': {\n const strArrParts: string[] = [];\n if (arrayMin !== undefined) strArrParts.push(`min: ${arrayMin}`);\n if (arrayMax !== undefined) strArrParts.push(`max: ${arrayMax}`);\n const strArrArg =\n strArrParts.length > 0 ? `{${strArrParts.join(', ')}}` : '';\n return isArray\n ? `Array.from({length: faker.number.int(${strArrArg})}, () => faker.word.sample())`\n : 'faker.word.sample()';\n }\n default: {\n return 'undefined';\n }\n }\n}\n\ninterface GetResponsesMockDefinitionOptions {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n mockOptionsWithoutFunc: Record<string, unknown>;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpec;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}\n\nfunction getExampleEntries(examples: unknown): unknown[] {\n if (Array.isArray(examples)) {\n return examples;\n }\n\n if (examples && typeof examples === 'object') {\n return Object.values(examples as Record<string, unknown>);\n }\n\n return [];\n}\n\nfunction unwrapExampleValue(example: unknown): unknown {\n if (example && typeof example === 'object' && 'value' in example) {\n return (example as { value?: unknown }).value;\n }\n\n return example;\n}\n\nexport function getResponsesMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: GetResponsesMockDefinitionOptions) {\n const result = {\n definitions: [] as string[],\n imports: [] as GeneratorImport[],\n };\n const scalarMockOptions =\n mockOptions?.useExamples === undefined\n ? mockOptionsWithoutFunc\n : {\n ...mockOptionsWithoutFunc,\n useExamples: mockOptions.useExamples,\n };\n\n for (const response of responses) {\n const { value: definition, example, examples, imports, isRef } = response;\n let { originalSchema } = response;\n\n if (context.output.override.mock?.useExamples || mockOptions?.useExamples) {\n const exampleValue = unwrapExampleValue(\n example ??\n originalSchema?.example ??\n getExampleEntries(examples)[0] ??\n getExampleEntries(originalSchema?.examples)[0],\n );\n\n if (exampleValue !== undefined) {\n const formatted = formatSchemaExampleValue(\n exampleValue,\n originalSchema,\n context,\n );\n result.definitions.push(\n transformer ? transformer(formatted, returnType) : formatted,\n );\n continue;\n }\n }\n\n if (!definition || generalJSTypesWithArray.includes(definition)) {\n const value = getMockScalarJsTypes(definition, mockOptionsWithoutFunc);\n\n result.definitions.push(\n transformer ? transformer(value, returnType) : value,\n );\n continue;\n }\n\n if (!originalSchema && definition === 'Blob') {\n originalSchema = { type: 'string', format: 'binary' };\n } else if (!originalSchema) {\n continue;\n }\n\n const resolvedSchema = resolveRef(originalSchema, context).schema;\n\n // `imports` belongs to the response type entry, which core shares across\n // operations that resolve the same schema. Mock resolution appends the\n // value imports it needs (`Object.values(Enum)`), and only the delta is\n // reported below, so work on a copy: mutating the shared array would leak\n // mock-only value imports into every later client that imports the same\n // schema, turning its `import type` into a value import (#3931).\n const responseImports = imports ? [...imports] : [];\n const importsBefore = responseImports.length;\n const scalar = getMockScalar({\n item: {\n ...(resolvedSchema as Record<string, unknown>),\n name: definition,\n ...(context.output.override.enumGenerationType === 'enum' && isRef\n ? { isRef: true }\n : {}),\n },\n imports: responseImports,\n mockOptions: scalarMockOptions,\n operationId,\n tags,\n context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n });\n\n appendImportsDelta(result.imports, responseImports, importsBefore);\n if (scalar.imports !== responseImports) {\n appendImportsDelta(result.imports, scalar.imports, 0);\n }\n result.definitions.push(\n transformer ? transformer(scalar.value, returnType) : scalar.value,\n );\n }\n\n appendImportsDelta(\n result.imports,\n collectSplitMockTypeImports(splitMockImplementations),\n 0,\n );\n\n return result;\n}\n\ninterface GetMockDefinitionOptions {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n imports: GeneratorImport[];\n override: NormalizedOverrideOutput;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpec;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}\n\nexport function getMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n override,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: GetMockDefinitionOptions) {\n const mockOptionsWithoutFunc = getMockWithoutFunc(context.spec, override);\n\n const { definitions, imports } = getResponsesMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n });\n\n return {\n definition: '[' + definitions.join(', ') + ']',\n definitions,\n imports,\n };\n}\n\nexport function getMockOptionsDataOverride(\n operationTags: string[],\n operationId: string,\n override: NormalizedOverrideOutput,\n) {\n const responseOverride =\n override.operations[operationId]?.mock?.data ??\n operationTags\n .map((operationTag) => override.tags[operationTag]?.mock?.data)\n .find((e) => e !== undefined);\n const implementation = isFunction(responseOverride)\n ? `(${String(responseOverride)})()`\n : stringify(responseOverride);\n\n return implementation?.replaceAll(\n /import_faker\\.defaults|import_faker\\.faker|_faker\\.faker/g,\n 'faker',\n );\n}\n","import {\n type ClientMockGeneratorBuilder,\n escapeRegExp,\n generateDependencyImports,\n type GenerateMockImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GlobalMockOptions,\n isFunction,\n isMswMock,\n isObject,\n jsStringLiteralEscape,\n pascal,\n type ResReqTypesValue,\n type StrictMockSchemaKind,\n} from '@orval/core';\n\nimport { getDelay } from '../delay';\nimport { getRouteMSW, overrideVarName } from '../faker/getters';\nimport {\n applyStrictMockReturnType,\n collectStrictMockSchemaTypeNamesFromImplementation,\n formatMockFactoryDeclaration,\n getMockFactorySignatureParts,\n getSchemaTypeNamesFromResponses,\n getSimpleSchemaReturnType,\n getStrictMockSchemaKindsFromResponses,\n isStrictMock,\n mergeStrictMockSchemaKinds,\n mergeStrictMockSchemaTypeNames,\n} from '../mock-types';\nimport { getMockDefinition, getMockOptionsDataOverride } from './mocks';\n\n/**\n * Resolves an OpenAPI response key to the numeric status the generated handler\n * emits.\n *\n * The key comes straight from the document and lands in an unquoted expression\n * position (`{ status: 200 }`), so there is no quote to escape and no way to\n * make a non-numeric value safe there — a key like\n * `2,x:(<expression>)` would splice live code into the handler. Parse it, and\n * refuse the document rather than emitting whatever it says.\n *\n * `default` maps to 200 and a `NXX` wildcard to `N00`, matching what the\n * handler previously emitted for those keys.\n */\nfunction assertSafeStatusCode(status: string): number {\n // Map only the two forms the spec actually defines — `default` and a\n // single-digit `NXX` wildcard — and leave everything else to fail the check\n // below as-is. Rewriting a trailing `XX` before validating would work out\n // the same (`20XX` becomes the four-digit `2000` and is still rejected), but\n // this way the accepted shapes are stated rather than inferred.\n const normalized =\n status === 'default'\n ? '200'\n : /^\\dXX$/.test(status)\n ? `${status[0]}00`\n : status;\n\n if (!/^\\d{3}$/.test(normalized)) {\n throw new Error(\n `orval: refusing to generate a mock handler for an OpenAPI response key that is not a status code (got \"${status}\"). This value would otherwise be emitted verbatim into generated source.`,\n );\n }\n\n return Number(normalized);\n}\n\nfunction getMSWDependencies(\n options?: GlobalMockOptions,\n): GeneratorDependency[] {\n const locale = options?.locale;\n\n const fakerDependency: GeneratorDependency = {\n exports: [{ name: 'faker', values: true }],\n dependency: locale ? `@faker-js/faker/locale/${locale}` : '@faker-js/faker',\n };\n\n const hasDelay =\n options && isMswMock(options) ? options.delay !== false : true;\n\n const exports = [\n { name: 'http', values: true },\n { name: 'HttpResponse', values: true },\n { name: 'RequestHandlerOptions', values: false },\n ];\n\n if (hasDelay) {\n exports.push({ name: 'delay', values: true });\n }\n\n return [{ exports, dependency: 'msw' }, fakerDependency];\n}\n\nexport const generateMSWImports: GenerateMockImports = ({\n implementation,\n imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n options,\n}) => {\n return generateDependencyImports(\n implementation,\n [...getMSWDependencies(options), ...imports],\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\nfunction generateDefinition(\n name: string,\n route: string,\n getResponseMockFunctionNameBase: string,\n handlerNameBase: string,\n { operationId, response, verb, tags }: GeneratorVerbOptions,\n { override, context, mock }: GeneratorOptions,\n returnType: string,\n status: string,\n responseImports: GeneratorImport[],\n responses: ResReqTypesValue[],\n contentTypes: string[],\n splitMockImplementations: string[],\n) {\n const oldSplitMockImplementations = [...splitMockImplementations];\n const { definitions, definition, imports } = getMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n override,\n context,\n mockOptions: isFunction(mock) ? undefined : mock,\n splitMockImplementations,\n });\n\n const mockData = getMockOptionsDataOverride(tags, operationId, override);\n\n let value = '';\n\n if (mockData) {\n value = mockData;\n } else if (definitions.length > 1) {\n value = `faker.helpers.arrayElement(${definition})`;\n } else if (definitions[0]) {\n value = definitions[0];\n }\n\n const isResponseOverridable = value.includes(overrideVarName);\n const isTextLikeContentType = (ct: string) =>\n ct.startsWith('text/') || ct === 'application/xml' || ct.endsWith('+xml');\n const isTypeExactlyString = (typeExpr: string) =>\n typeExpr.trim().replaceAll(/^\\(+|\\)+$/g, '') === 'string';\n const isUnionContainingString = (typeExpr: string) =>\n typeExpr\n .split('|')\n .map((part) => part.trim().replaceAll(/^\\(+|\\)+$/g, ''))\n .includes('string');\n const isBinaryLikeContentType = (ct: string) =>\n ct === 'application/octet-stream' ||\n ct === 'application/pdf' ||\n ct.startsWith('image/') ||\n ct.startsWith('audio/') ||\n ct.startsWith('video/') ||\n ct.startsWith('font/');\n\n const preferredContentType = isFunction(mock)\n ? undefined\n : (\n mock as { preferredContentType?: string } | undefined\n )?.preferredContentType?.toLowerCase();\n // match preferredContentType against `responses` (not the wider `contentTypes` which mixes success and error MIMEs).\n const preferredContentTypeMatch = preferredContentType\n ? responses.find(\n (r) => r.contentType.toLowerCase() === preferredContentType,\n )?.contentType\n : undefined;\n const contentTypesByPreference = preferredContentTypeMatch\n ? [preferredContentTypeMatch]\n : contentTypes;\n const responsesByPreference = preferredContentTypeMatch\n ? responses.filter((r) => r.contentType === preferredContentTypeMatch)\n : responses;\n\n const hasTextLikeContentType = contentTypes.some((ct) =>\n isTextLikeContentType(ct),\n );\n const isExactlyStringReturnType = isTypeExactlyString(returnType);\n\n // Keep text helpers for exact string success return types whenever a text-like\n // media type is available in the declared content types. This prevents a\n // preferredContentType that matches an error media type from forcing\n // HttpResponse.json() for text/plain success responses.\n const isTextResponse =\n (isExactlyStringReturnType && hasTextLikeContentType) ||\n contentTypesByPreference.some((ct) => isTextLikeContentType(ct));\n const isSchemaBinary = (r: ResReqTypesValue) =>\n r.originalSchema?.format === 'binary' ||\n (r.originalSchema?.contentMediaType === 'application/octet-stream' &&\n !r.originalSchema.contentEncoding);\n // When preferredContentType matched, only use schema-binary metadata to decide\n // the binary path — don't let the content-type name alone force it (issue #2962).\n // A structured schema (e.g. Pet) paired with application/octet-stream via\n // preference should not discard the body as new ArrayBuffer(0).\n // When no preference matched, keep the content-type heuristic so binary-like\n // types with no schema metadata still get the correct helper.\n const isBinaryResponse = preferredContentTypeMatch\n ? responsesByPreference.some((r) => isSchemaBinary(r))\n : contentTypesByPreference.some((ct) => isBinaryLikeContentType(ct)) ||\n responsesByPreference.some((r) => isSchemaBinary(r));\n // Bare ref names of schema-binary responses (include alias for collision-renamed imports).\n const binaryRefNames = responsesByPreference\n .filter((r) => isSchemaBinary(r))\n .flatMap((r) =>\n r.imports.flatMap((imp) =>\n imp.alias ? [imp.name, imp.alias] : [imp.name],\n ),\n );\n const isReturnHttpResponse = value && value !== 'undefined';\n\n const getResponseMockFunctionName = `${getResponseMockFunctionNameBase}${pascal(\n name,\n )}`;\n const handlerName = `${handlerNameBase}${pascal(name)}`;\n\n const addedSplitMockImplementations = splitMockImplementations.slice(\n oldSplitMockImplementations.length,\n );\n splitMockImplementations.push(...addedSplitMockImplementations);\n const mockImplementations =\n addedSplitMockImplementations.length > 0\n ? `${addedSplitMockImplementations.join('\\n\\n')}\\n\\n`\n : '';\n\n const binaryTypeRewriteRegex = new RegExp(\n String.raw`\\b(?:${['Blob', ...binaryRefNames].map((n) => escapeRegExp(n)).join('|')})\\b`,\n 'g',\n );\n const mockReturnType = isBinaryResponse\n ? returnType.replaceAll(binaryTypeRewriteRegex, 'ArrayBuffer')\n : returnType;\n\n // Detect when the return type is a union containing void (e.g. \"Resource | void\"\n // from endpoints with both 200 JSON and 204 No Content responses). In this case\n // we need runtime branching so that void responses use `new HttpResponse(null)`\n // instead of `HttpResponse.json()` which does not accept void/undefined.\n const isVoidUnionType =\n mockReturnType !== 'void' &&\n mockReturnType.split('|').some((part) => part.trim() === 'void');\n // Also a raw response key, emitted unquoted in the void-union branch below.\n const noContentStatusCode = isVoidUnionType\n ? assertSafeStatusCode(\n responses.find((r) => r.value === 'void')?.key ?? '204',\n )\n : undefined;\n const nonVoidMockReturnType = isVoidUnionType\n ? mockReturnType\n .split('|')\n .filter((part) => part.trim() !== 'void')\n .join(' | ')\n .trim()\n : mockReturnType;\n\n const hasJsonContentType = contentTypesByPreference.some(\n (ct) => ct.includes('json') || ct.includes('+json'),\n );\n const hasStringReturnType =\n isTypeExactlyString(mockReturnType) ||\n isUnionContainingString(mockReturnType);\n const overrideResponseType = `Partial<Extract<${nonVoidMockReturnType}, object>>`;\n const shouldPreferJsonResponse = hasJsonContentType && !hasStringReturnType;\n\n // When the return type is a union containing both string and structured types\n // (e.g. `string | Pet`) AND both text-like and JSON content types are available,\n // we need runtime branching to pick the correct HttpResponse helper based on\n // the actual resolved value type. Without this, objects could be JSON.stringify'd\n // and served under a text-like Content-Type (e.g. xml/html/plain), which is\n // semantically incorrect for structured JSON data.\n const needsRuntimeContentTypeSwitch =\n isTextResponse &&\n hasJsonContentType &&\n hasStringReturnType &&\n mockReturnType !== 'string';\n\n const mockOptionsFromOverride = override.mock;\n const strictMock = isStrictMock(mockOptionsFromOverride);\n const schemaTypeNames = strictMock\n ? getSchemaTypeNamesFromResponses(responses)\n : [];\n const strictMockReturnType = strictMock\n ? applyStrictMockReturnType(nonVoidMockReturnType, schemaTypeNames)\n : nonVoidMockReturnType;\n const simpleSchemaReturnType = strictMock\n ? getSimpleSchemaReturnType(nonVoidMockReturnType, schemaTypeNames)\n : undefined;\n\n let mockFactoryParam = '';\n let mockFactoryReturnType = nonVoidMockReturnType;\n let mockFactoryReturnCast = '';\n\n if (isResponseOverridable) {\n if (strictMock && simpleSchemaReturnType) {\n const signature = getMockFactorySignatureParts(\n simpleSchemaReturnType,\n mockOptionsFromOverride,\n {\n isOverridable: true,\n overrideType: overrideResponseType,\n },\n );\n mockFactoryParam = signature.param;\n mockFactoryReturnType = signature.returnType;\n mockFactoryReturnCast = signature.returnCast;\n } else {\n mockFactoryParam = `overrideResponse: ${overrideResponseType} = {}`;\n mockFactoryReturnType = strictMock\n ? strictMockReturnType\n : nonVoidMockReturnType;\n }\n } else if (strictMock) {\n mockFactoryReturnType = strictMockReturnType;\n }\n\n const mockImplementation = isReturnHttpResponse\n ? `${mockImplementations}${formatMockFactoryDeclaration(\n getResponseMockFunctionName,\n mockFactoryParam,\n mockFactoryReturnType,\n value,\n mockFactoryReturnCast,\n { omitReturnType: Boolean(mockData) },\n )}\\n\\n`\n : mockImplementations;\n\n const delay = getDelay(override, isFunction(mock) ? undefined : mock);\n const infoParam = 'info';\n const resolvedResponseExpr = `overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(${infoParam}) : overrideResponse)\n : ${getResponseMockFunctionName}()`;\n\n const statusCode = assertSafeStatusCode(status);\n\n // Determine the preferred non-JSON content type for binary responses\n const binaryContentType =\n (preferredContentTypeMatch &&\n isBinaryLikeContentType(preferredContentTypeMatch)\n ? preferredContentTypeMatch\n : contentTypes.find((ct) => isBinaryLikeContentType(ct))) ??\n 'application/octet-stream';\n\n // Pick the most specific MSW response helper based on the first\n // text-like content type so the correct Content-Type header is set.\n // MSW provides HttpResponse.xml() for application/xml and +xml,\n // HttpResponse.html() for text/html, and HttpResponse.text() for\n // all other text/* types.\n const shouldIgnorePreferredForTextHelper =\n isExactlyStringReturnType &&\n !!preferredContentTypeMatch &&\n !isTextLikeContentType(preferredContentTypeMatch) &&\n hasTextLikeContentType;\n const firstTextCt = shouldIgnorePreferredForTextHelper\n ? contentTypes.find((ct) => isTextLikeContentType(ct))\n : contentTypesByPreference.find((ct) => isTextLikeContentType(ct));\n const textHelper =\n firstTextCt === 'application/xml' || firstTextCt?.endsWith('+xml')\n ? 'xml'\n : firstTextCt === 'text/html'\n ? 'html'\n : 'text';\n\n // MSW's HttpResponse helpers set a default Content-Type that may differ\n // from the OpenAPI-declared media type (e.g. application/problem+json is\n // served as application/json by HttpResponse.json(), application/xml is\n // served as text/xml by HttpResponse.xml()). Emit an explicit\n // Content-Type header whenever the resolved media type diverges from the\n // helper default so vendor/problem-details contracts survive the mock.\n const firstJsonCt = contentTypesByPreference.find((ct) =>\n ct.includes('json'),\n );\n const textHelperDefaultContentType =\n textHelper === 'xml'\n ? 'text/xml'\n : textHelper === 'html'\n ? 'text/html'\n : 'text/plain';\n const jsonCtHeaderSuffix =\n firstJsonCt && firstJsonCt !== 'application/json'\n ? `, headers: { 'Content-Type': '${jsStringLiteralEscape(firstJsonCt)}' }`\n : // When preferredContentType matched a non-JSON type (e.g. application/octet-stream)\n // and the structured schema falls through to HttpResponse.json(), emit the\n // selected media type as the Content-Type so the contract survives.\n preferredContentTypeMatch && !preferredContentTypeMatch.includes('json')\n ? `, headers: { 'Content-Type': '${jsStringLiteralEscape(\n preferredContentTypeMatch,\n )}' }`\n : '';\n const textCtHeaderSuffix =\n firstTextCt && firstTextCt !== textHelperDefaultContentType\n ? `, headers: { 'Content-Type': '${jsStringLiteralEscape(firstTextCt)}' }`\n : '';\n\n let responseBody: string;\n // Use a prelude to evaluate the override expression once into a temp variable\n // (the expression contains `await` so must not be duplicated). Only emit it\n // when we actually generate a `*ResponseMock()` helper — otherwise the\n // prelude would reference a function that doesn't exist (issue #3270).\n let responsePrelude = '';\n if (isReturnHttpResponse) {\n if (isBinaryResponse) {\n responsePrelude = `const binaryBody = ${resolvedResponseExpr};`;\n } else if (isVoidUnionType || needsRuntimeContentTypeSwitch) {\n responsePrelude = `const resolvedBody = ${resolvedResponseExpr};`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n responsePrelude = `const resolvedBody = ${resolvedResponseExpr};\n const textBody = typeof resolvedBody === 'string' ? resolvedBody : JSON.stringify(resolvedBody ?? null);`;\n }\n }\n if (!isReturnHttpResponse) {\n responseBody = `new HttpResponse(null,\n { status: ${statusCode}\n })`;\n } else if (isBinaryResponse) {\n responseBody = `HttpResponse.arrayBuffer(\n binaryBody instanceof ArrayBuffer\n ? binaryBody\n : new ArrayBuffer(0),\n { status: ${statusCode},\n headers: { 'Content-Type': '${jsStringLiteralEscape(binaryContentType)}' }\n })`;\n } else if (isVoidUnionType) {\n // Runtime branching for void union types (e.g. 200 JSON + 204 No Content).\n // When the resolved body is undefined, return an empty response with the\n // no-content status code; otherwise use the appropriate response helper.\n let nonVoidBody: string;\n if (needsRuntimeContentTypeSwitch) {\n nonVoidBody = `typeof resolvedBody === 'string'\n ? HttpResponse.${textHelper}(resolvedBody, { status: ${statusCode}${textCtHeaderSuffix} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode}${jsonCtHeaderSuffix} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n nonVoidBody = `HttpResponse.${textHelper}(\n typeof resolvedBody === 'string' ? resolvedBody : JSON.stringify(resolvedBody ?? null),\n { status: ${statusCode}${textCtHeaderSuffix} })`;\n } else {\n nonVoidBody = `HttpResponse.json(resolvedBody, { status: ${statusCode}${jsonCtHeaderSuffix} })`;\n }\n responseBody = `resolvedBody === undefined\n ? new HttpResponse(null, { status: ${noContentStatusCode} })\n : ${nonVoidBody}`;\n } else if (needsRuntimeContentTypeSwitch) {\n // Runtime branching: when the resolved value is a string, use the\n // appropriate text helper; otherwise fall back to HttpResponse.json()\n // so objects are never JSON.stringify'd under a text/xml Content-Type.\n responseBody = `typeof resolvedBody === 'string'\n ? HttpResponse.${textHelper}(resolvedBody, { status: ${statusCode}${textCtHeaderSuffix} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode}${jsonCtHeaderSuffix} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n responseBody = `HttpResponse.${textHelper}(textBody,\n { status: ${statusCode}${textCtHeaderSuffix}\n })`;\n } else {\n responseBody = `HttpResponse.json(${resolvedResponseExpr},\n { status: ${statusCode}${jsonCtHeaderSuffix}\n })`;\n }\n\n const infoType = `Parameters<Parameters<typeof http.${verb}>[1]>[0]`;\n\n const handlerImplementation = `\nexport const ${handlerName} = (overrideResponse?: ${mockReturnType} | ((${infoParam}: ${infoType}) => Promise<${mockReturnType}> | ${mockReturnType}), options?: RequestHandlerOptions) => {\n return http.${verb}('${route}', async (${infoParam}: ${infoType}) => {${\n delay === false\n ? ''\n : `await delay(${isFunction(delay) ? `(${String(delay)})()` : String(delay)});`\n }\n ${isReturnHttpResponse ? '' : `if (typeof overrideResponse === 'function') {await overrideResponse(info); }`}\n ${responsePrelude}\n return ${responseBody}\n }, options)\n}\\n`;\n\n const includeResponseImports = [\n ...imports,\n ...response.imports.filter((r) => {\n // Only keep imports referenced in the mock. Aliased imports\n // (`Foo as __Foo`) reference the alias rather than the bare name, so\n // match against either. Mirrors `addDependency` in core/generators/imports.ts (#3269).\n const searchWords = [r.alias, r.name]\n .filter((p): p is string => Boolean(p?.length))\n .map((part) => escapeRegExp(part))\n .join('|');\n if (!searchWords) {\n return false;\n }\n const reg = new RegExp(String.raw`\\b(${searchWords})\\b`);\n return reg.test(handlerImplementation) || reg.test(mockImplementation);\n }),\n ];\n\n return {\n implementation: {\n function: mockImplementation,\n handlerName: handlerName,\n handler: handlerImplementation,\n },\n imports: includeResponseImports,\n strictMockSchemaTypeNames: strictMock\n ? mergeStrictMockSchemaTypeNames(\n schemaTypeNames,\n // Nested split factories: see collectStrictMockSchemaTypeNamesFromImplementation\n // re regex-coupling note — prefer threading names from getters long-term.\n collectStrictMockSchemaTypeNamesFromImplementation(\n mockImplementation,\n ),\n )\n : undefined,\n strictMockSchemaKinds: strictMock\n ? mergeStrictMockSchemaKinds(\n getStrictMockSchemaKindsFromResponses(responses, context),\n Object.fromEntries(\n (\n collectStrictMockSchemaTypeNamesFromImplementation(\n mockImplementation,\n ) ?? []\n ).map((name) => [name, 'object' satisfies StrictMockSchemaKind]),\n ),\n )\n : undefined,\n };\n}\n\nexport function generateMSW(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder {\n const { pathRoute, override, mock } = generatorOptions;\n const { operationName, response } = generatorVerbOptions;\n\n const overrideBaseUrl =\n override.mock && 'baseUrl' in override.mock\n ? (override.mock as { baseUrl?: string }).baseUrl\n : undefined;\n const mockBaseUrl = mock && isMswMock(mock) ? mock.baseUrl : undefined;\n const route = getRouteMSW(pathRoute, overrideBaseUrl ?? mockBaseUrl);\n\n // Derive names from operationName (not operationId): splitByContentType keeps\n // one operationId across variants but suffixes operationName (e.g. *WithJson /\n // *WithFormData), and the client side already names functions from it. Using\n // operationId here would emit duplicate handler names and break tsc. See #3342.\n const handlerName = `get${pascal(operationName)}MockHandler`;\n const getResponseMockFunctionName = `get${pascal(operationName)}ResponseMock`;\n\n const splitMockImplementations: string[] = [];\n\n const baseDefinition = generateDefinition(\n '',\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n response.definition.success,\n response.types.success[0]?.key ?? '200',\n response.imports,\n response.types.success,\n response.contentTypes,\n splitMockImplementations,\n );\n\n const mockImplementations = [baseDefinition.implementation.function];\n const handlerImplementations = [baseDefinition.implementation.handler];\n const imports = [...baseDefinition.imports];\n const strictMockSchemaTypeNames = new Set(\n baseDefinition.strictMockSchemaTypeNames,\n );\n const strictMockSchemaKinds: Record<string, StrictMockSchemaKind> = {\n ...baseDefinition.strictMockSchemaKinds,\n };\n\n if (\n generatorOptions.mock &&\n isObject(generatorOptions.mock) &&\n generatorOptions.mock.generateEachHttpStatus\n ) {\n for (const statusResponse of [\n ...response.types.success,\n ...response.types.errors,\n ]) {\n const definition = generateDefinition(\n statusResponse.key,\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n statusResponse.value,\n statusResponse.key,\n response.imports,\n [statusResponse],\n [statusResponse.contentType],\n splitMockImplementations,\n );\n mockImplementations.push(definition.implementation.function);\n handlerImplementations.push(definition.implementation.handler);\n imports.push(...definition.imports);\n for (const name of definition.strictMockSchemaTypeNames ?? []) {\n strictMockSchemaTypeNames.add(name);\n }\n if (definition.strictMockSchemaKinds) {\n for (const [name, kind] of Object.entries(\n definition.strictMockSchemaKinds,\n )) {\n strictMockSchemaKinds[name] ??= kind;\n }\n }\n }\n }\n\n const aggregatedStrictNames = [...strictMockSchemaTypeNames];\n\n return {\n implementation: {\n function: mockImplementations.join('\\n'),\n handlerName,\n handler: handlerImplementations.join('\\n'),\n },\n imports: imports,\n strictMockSchemaTypeNames:\n aggregatedStrictNames.length > 0 ? aggregatedStrictNames : undefined,\n strictMockSchemaKinds: mergeStrictMockSchemaKinds(strictMockSchemaKinds),\n };\n}\n","import {\n type ClientMockGeneratorBuilder,\n type ContextSpec,\n generateDependencyImports,\n type GenerateMockImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorOptions,\n type GeneratorSchema,\n type GeneratorVerbOptions,\n type GlobalMockOptions,\n pascal,\n type StrictMockSchemaKind,\n} from '@orval/core';\n\nimport {\n formatMockFactoryDeclaration,\n classifyStrictMockSchemaType,\n collectStrictMockSchemaTypeNamesFromImplementation,\n getMockFactorySignatureParts,\n getStrictMockTypeName,\n isStrictMock,\n mergeStrictMockSchemaKinds,\n} from '../mock-types';\nimport { appendImportsDelta } from './imports';\nimport { generateMSW } from '../msw';\nimport { getMockWithoutFunc } from '../msw/mocks';\nimport { getMockScalar } from './getters';\n\nfunction getFakerDependencies(\n options?: GlobalMockOptions,\n): GeneratorDependency[] {\n const locale = options?.locale;\n\n return [\n {\n exports: [{ name: 'faker', values: true }],\n dependency: locale\n ? `@faker-js/faker/locale/${locale}`\n : '@faker-js/faker',\n },\n ];\n}\n\n/**\n * Emits the import header for a faker-only mock file. Faker output never\n * imports from `msw`, so this only emits `import { faker } from '@faker-js/faker'`\n * (or the locale-scoped variant) plus any operation-specific imports.\n */\nexport const generateFakerImports: GenerateMockImports = ({\n implementation,\n imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n options,\n}) => {\n return generateDependencyImports(\n implementation,\n [...getFakerDependencies(options), ...imports],\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\n/**\n * Generates the faker-only mock output for a single operation. This reuses\n * the response-factory portion of {@link generateMSW} and strips out the\n * handler and aggregator entries so callers can write a standalone\n * `<file>.faker.ts` with no `msw` dependency.\n */\nexport function generateFaker(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder {\n const result = generateMSW(generatorVerbOptions, generatorOptions);\n return {\n implementation: {\n function: result.implementation.function,\n handler: '',\n handlerName: '',\n },\n imports: result.imports,\n strictMockSchemaTypeNames: result.strictMockSchemaTypeNames,\n strictMockSchemaKinds: result.strictMockSchemaKinds,\n };\n}\n\nexport interface GenerateFakerForSchemasResult {\n implementation: string;\n imports: GeneratorImport[];\n strictMockSchemaTypeNames?: string[];\n strictMockSchemaKinds?: Record<string, StrictMockSchemaKind>;\n}\n\n/**\n * Builds the contents of a consolidated faker mock file for every entry under\n * `components/schemas`. Each schema produces a `get<SchemaName>Mock(overrides)`\n * factory in the spirit of the existing per-operation `get<Op>ResponseMock`\n * helpers. Opt in via `mock.generators: [{ type: 'faker', schemas: true }]`.\n *\n * Returns the function bodies plus any `GeneratorImport` references the\n * factories need so the writer can hoist them into the file header.\n */\nexport function generateFakerForSchemas(\n schemas: GeneratorSchema[],\n context: ContextSpec,\n options: GlobalMockOptions,\n): GenerateFakerForSchemasResult {\n const factories: string[] = [];\n const strictMockTypeNames = new Set<string>();\n const strictMockSchemaKinds: Record<string, StrictMockSchemaKind> = {};\n const allImports: GeneratorImport[] = [];\n // Shared across schemas so we emit each helper (e.g. an `allOf`-discriminator\n // sub-factory) once even when several schemas reference the same union arm.\n const splitMockImplementations: string[] = [];\n\n // Names of the factories we're about to emit in this file. When the\n // delegation logic in `resolveMockValue` produces a `getXMock()` call for\n // a `components/schemas` ref, it pushes a `{ schemaFactory: true }` import\n // — but if `X` is itself one of the schemas being generated here, the\n // factory lives in this very file and must not be imported.\n const localFactoryNames = new Set(\n schemas.filter((s) => !!s.schema).map((s) => `get${pascal(s.name)}Mock`),\n );\n const localMockTypeNames = new Set(\n schemas\n .filter((s) => !!s.schema)\n .map((s) => getStrictMockTypeName(pascal(s.name))),\n );\n\n // Serialize override.mock.properties functions the same way operation\n // response mocks do (IIFE expressions), not raw function references.\n const mockOptions = getMockWithoutFunc(context.spec, context.output.override);\n\n for (const generatorSchema of schemas) {\n const { name, schema } = generatorSchema;\n if (!schema) continue;\n\n const factoryName = `get${pascal(name)}Mock`;\n const factoryImports: GeneratorImport[] = [];\n const factoryImportsBefore = factoryImports.length;\n const schemaName = pascal(name);\n\n const result = getMockScalar({\n item: {\n ...(schema as Record<string, unknown>),\n name: schemaName,\n } as Parameters<typeof getMockScalar>[0]['item'],\n imports: factoryImports,\n mockOptions,\n operationId: name,\n tags: [],\n context,\n // Seed the schema under generation on both stacks so allOf/oneOf cycles\n // (e.g. System.Xml.Linq-style inheritance) terminate instead of overflowing\n // the stack while building consolidated schema factories (#3590).\n existingReferencedProperties: [schemaName],\n existingReferencedAllOfRefs: [schemaName],\n splitMockImplementations,\n allowOverride: true,\n isRef: false,\n } as Parameters<typeof getMockScalar>[0]);\n\n appendImportsDelta(allImports, factoryImports, factoryImportsBefore);\n if (result.imports !== factoryImports) {\n appendImportsDelta(allImports, result.imports, 0);\n }\n\n // Match the behavior of operation-response factories: only declare the\n // `overrideResponse` parameter when the generated expression actually\n // references it (top-level object schemas). Array / scalar / enum\n // schemas don't splice an override, so we omit the parameter rather than\n // emit a `Partial<Pet[]>` signature TS can't satisfy.\n const typeName = pascal(name);\n const isOverridable = result.value.includes('overrideResponse');\n const { param, returnType, returnCast } = getMockFactorySignatureParts(\n typeName,\n mockOptions,\n {\n isOverridable,\n overrideType: `Partial<${typeName}>`,\n },\n );\n const factory = formatMockFactoryDeclaration(\n factoryName,\n param,\n returnType,\n result.value,\n returnCast,\n );\n\n if (isStrictMock(mockOptions)) {\n strictMockTypeNames.add(typeName);\n strictMockSchemaKinds[typeName] = classifyStrictMockSchemaType(schema);\n }\n\n factories.push(factory);\n\n // Track the schema type itself as an import so writers can reference it\n // from the generated factory file.\n allImports.push({\n name: pascal(name),\n values: false,\n });\n }\n\n // De-duplicate imports by name+alias so the header doesn't list the same\n // schema twice when multiple factories reference it. \"Any value wins\":\n // if the same name is pushed both as a type-only import and as a value\n // import (e.g. an enum used both in an `as Foo` cast and an\n // `Object.values(Foo)` call), we keep the value form. A plain\n // `import { Foo }` works in both annotation and runtime positions, so\n // emitting the value form avoids `TS1361: 'X' cannot be used as a value\n // because it was imported using 'import type'`.\n const mergedImports = new Map<string, GeneratorImport>();\n for (const imp of allImports) {\n // Drop self-references: `get<Schema>Mock` factories generated in this\n // very file (pushed when delegation in `resolveMockValue` produced a\n // local factory call). Without this we'd emit\n // `import { getPetMock } from '.'` next to its own `export const`.\n if (imp.schemaFactory && localFactoryNames.has(imp.name)) continue;\n if (imp.schemaFactory && !imp.values && localMockTypeNames.has(imp.name)) {\n continue;\n }\n\n const key = `${imp.name}::${imp.alias ?? ''}`;\n const existing = mergedImports.get(key);\n if (!existing) {\n mergedImports.set(key, imp);\n continue;\n }\n if (!existing.values && imp.values) {\n mergedImports.set(key, imp);\n }\n }\n const uniqueImports = [...mergedImports.values()];\n\n // Reference `options` so unused-parameter rules don't complain; future\n // schema-specific behavior (e.g. naming convention) will read from it.\n void options;\n\n // Helper factories from union/discriminator handling (`splitMockImplementations`)\n // are emitted before the public `get<Schema>Mock` factories so call sites\n // declared after them resolve cleanly without TS hoisting concerns.\n const implementation = [...splitMockImplementations, ...factories]\n .filter(Boolean)\n .join('\\n\\n');\n\n for (const name of collectStrictMockSchemaTypeNamesFromImplementation(\n implementation,\n )) {\n strictMockTypeNames.add(name);\n strictMockSchemaKinds[name] ??= 'object';\n }\n\n const aggregatedStrictNames = [...strictMockTypeNames];\n\n return {\n implementation,\n imports: uniqueImports,\n strictMockSchemaTypeNames:\n aggregatedStrictNames.length > 0 ? aggregatedStrictNames : undefined,\n strictMockSchemaKinds: mergeStrictMockSchemaKinds(strictMockSchemaKinds),\n };\n}\n","import type {\n FakerMockOptions,\n GenerateMockImports,\n GeneratorOptions,\n GeneratorVerbOptions,\n GlobalMockOptions,\n MswMockOptions,\n} from '@orval/core';\nimport { OutputMockType } from '@orval/core';\n\nimport { generateFaker, generateFakerImports } from './faker';\nimport { generateMSW, generateMSWImports } from './msw';\n\nexport const DEFAULT_MSW_OPTIONS: MswMockOptions = {\n type: OutputMockType.MSW,\n useExamples: false,\n};\n\nexport const DEFAULT_FAKER_OPTIONS: FakerMockOptions = {\n type: OutputMockType.FAKER,\n useExamples: false,\n schemas: false,\n operationResponses: true,\n};\n\n/**\n * Returns the default GlobalMockOptions for a given mock type. Used when\n * normalizing user-provided entries in `output.mock.generators` so callers\n * can omit the per-type defaults.\n */\nexport const getDefaultMockOptionsForType = (\n type: GlobalMockOptions['type'],\n): GlobalMockOptions => {\n switch (type) {\n case OutputMockType.FAKER: {\n return DEFAULT_FAKER_OPTIONS;\n }\n case OutputMockType.MSW: {\n return DEFAULT_MSW_OPTIONS;\n }\n }\n};\n\n/**\n * Dispatches mock-file imports generation to the appropriate generator based\n * on the `OutputMockType` discriminator on the mock options.\n */\nexport const generateMockImports: GenerateMockImports = (importOptions) => {\n switch (importOptions.options?.type) {\n case OutputMockType.FAKER: {\n return generateFakerImports(importOptions);\n }\n default: {\n return generateMSWImports(importOptions);\n }\n }\n};\n\n/**\n * Dispatches per-operation mock generation to the appropriate generator\n * based on the `OutputMockType` discriminator. Each entry in\n * `output.mock.generators` is dispatched here individually.\n */\nexport function generateMock(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: Omit<GeneratorOptions, 'mock'> & {\n mock: GlobalMockOptions;\n },\n) {\n const { context } = generatorOptions;\n const previousActiveMockOutputType = context.activeMockOutputType;\n context.activeMockOutputType = generatorOptions.mock.type;\n\n try {\n switch (generatorOptions.mock.type) {\n case OutputMockType.FAKER: {\n return generateFaker(generatorVerbOptions, generatorOptions);\n }\n default: {\n return generateMSW(generatorVerbOptions, generatorOptions);\n }\n }\n } finally {\n context.activeMockOutputType = previousActiveMockOutputType;\n }\n}\n\nexport type { GenerateFakerForSchemasResult } from './faker';\nexport {\n generateFaker,\n generateFakerForSchemas,\n generateFakerImports,\n} from './faker';\nexport {\n buildStrictMockTypeFileHeader,\n dedupeStrictMockTypeDeclarations,\n} from './mock-types';\nexport { generateMSW, generateMSWImports } from './msw';\n"],"mappings":";;;AAcA,SAAgB,aACd,aACS;CACT,OAAO,QACL,eAAe,YAAY,YAAY,YAAY,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CAAC,CACf,KAAK,MAAM;CAEd,KAAK,MAAM,QAAQ,mDACjB,cACF,GAAG;EACD,oBAAoB,IAAI,IAAI;EAC5B,sBAAsB,UAAU;CAClC;CAEA,MAAM,wBAAwB,CAAC,GAAG,mBAAmB;CAErD,OAAO;EACL;EACA,SAAS;EACT,2BACE,sBAAsB,SAAS,IAAI,wBAAwB,KAAA;EAC7D,uBAAuB,2BAA2B,qBAAqB;CACzE;AACF;;;AC7PA,MAAa,sBAAsC;CACjD,MAAM,eAAe;CACrB,aAAa;AACf;AAEA,MAAa,wBAA0C;CACrD,MAAM,eAAe;CACrB,aAAa;CACb,SAAS;CACT,oBAAoB;AACtB;;;;;;AAOA,MAAa,gCACX,SACsB;CACtB,QAAQ,MAAR;EACE,KAAK,eAAe,OAClB,OAAO;EAET,KAAK,eAAe,KAClB,OAAO;CAEX;AACF;;;;;AAMA,MAAa,uBAA4C,kBAAkB;CACzE,QAAQ,cAAc,SAAS,MAA/B;EACE,KAAK,eAAe,OAClB,OAAO,qBAAqB,aAAa;EAE3C,SACE,OAAO,mBAAmB,aAAa;CAE3C;AACF;;;;;;AAOA,SAAgB,aACd,sBACA,kBAGA;CACA,MAAM,EAAE,YAAY;CACpB,MAAM,+BAA+B,QAAQ;CAC7C,QAAQ,uBAAuB,iBAAiB,KAAK;CAErD,IAAI;EACF,QAAQ,iBAAiB,KAAK,MAA9B;GACE,KAAK,eAAe,OAClB,OAAO,cAAc,sBAAsB,gBAAgB;GAE7D,SACE,OAAO,YAAY,sBAAsB,gBAAgB;EAE7D;CACF,UAAU;EACR,QAAQ,uBAAuB;CACjC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orval/mock",
3
- "version": "8.29.0",
3
+ "version": "8.30.0",
4
4
  "homepage": "https://orval.dev/docs/guides/msw",
5
5
  "bugs": {
6
6
  "url": "https://github.com/orval-labs/orval/issues"
@@ -23,7 +23,7 @@
23
23
  "./package.json": "./package.json"
24
24
  },
25
25
  "dependencies": {
26
- "@orval/core": "8.29.0",
26
+ "@orval/core": "8.30.0",
27
27
  "remeda": "^2.33.6"
28
28
  },
29
29
  "devDependencies": {