@orval/mock 8.12.3 → 8.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +16 -2
- package/dist/index.mjs +239 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _$_orval_core0 from "@orval/core";
|
|
2
|
-
import { ClientMockGeneratorBuilder, FakerMockOptions, GenerateMockImports, GeneratorOptions, GeneratorVerbOptions, GlobalMockOptions, MswMockOptions } from "@orval/core";
|
|
2
|
+
import { ClientMockGeneratorBuilder, ContextSpec, FakerMockOptions, GenerateMockImports, GeneratorImport, GeneratorOptions, GeneratorSchema, GeneratorVerbOptions, GlobalMockOptions, MswMockOptions } from "@orval/core";
|
|
3
3
|
|
|
4
4
|
//#region src/faker/index.d.ts
|
|
5
5
|
/**
|
|
@@ -15,6 +15,20 @@ declare const generateFakerImports: GenerateMockImports;
|
|
|
15
15
|
* `<file>.faker.ts` with no `msw` dependency.
|
|
16
16
|
*/
|
|
17
17
|
declare function generateFaker(generatorVerbOptions: GeneratorVerbOptions, generatorOptions: GeneratorOptions): ClientMockGeneratorBuilder;
|
|
18
|
+
interface GenerateFakerForSchemasResult {
|
|
19
|
+
implementation: string;
|
|
20
|
+
imports: GeneratorImport[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds the contents of a consolidated faker mock file for every entry under
|
|
24
|
+
* `components/schemas`. Each schema produces a `get<SchemaName>Mock(overrides)`
|
|
25
|
+
* factory in the spirit of the existing per-operation `get<Op>ResponseMock`
|
|
26
|
+
* helpers. Opt in via `mock.generators: [{ type: 'faker', schemas: true }]`.
|
|
27
|
+
*
|
|
28
|
+
* Returns the function bodies plus any `GeneratorImport` references the
|
|
29
|
+
* factories need so the writer can hoist them into the file header.
|
|
30
|
+
*/
|
|
31
|
+
declare function generateFakerForSchemas(schemas: GeneratorSchema[], context: ContextSpec, options: GlobalMockOptions): GenerateFakerForSchemasResult;
|
|
18
32
|
//#endregion
|
|
19
33
|
//#region src/msw/index.d.ts
|
|
20
34
|
declare const generateMSWImports: GenerateMockImports;
|
|
@@ -43,5 +57,5 @@ declare function generateMock(generatorVerbOptions: GeneratorVerbOptions, genera
|
|
|
43
57
|
mock: GlobalMockOptions;
|
|
44
58
|
}): _$_orval_core0.ClientMockGeneratorBuilder;
|
|
45
59
|
//#endregion
|
|
46
|
-
export { DEFAULT_FAKER_OPTIONS, DEFAULT_MSW_OPTIONS, generateFaker, generateFakerImports, generateMSW, generateMSWImports, generateMock, generateMockImports, getDefaultMockOptionsForType };
|
|
60
|
+
export { DEFAULT_FAKER_OPTIONS, DEFAULT_MSW_OPTIONS, type GenerateFakerForSchemasResult, generateFaker, generateFakerForSchemas, generateFakerImports, generateMSW, generateMSWImports, generateMock, generateMockImports, getDefaultMockOptionsForType };
|
|
47
61
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -51,9 +51,9 @@ const DEFAULT_OBJECT_KEY_MOCK = "faker.string.alphanumeric(5)";
|
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/faker/getters/object.ts
|
|
53
53
|
const overrideVarName = "overrideResponse";
|
|
54
|
-
function getReferenceName$1(ref) {
|
|
54
|
+
function getReferenceName$1(ref, context) {
|
|
55
55
|
if (!ref) return "";
|
|
56
|
-
return
|
|
56
|
+
return getRefInfo(ref, context).name;
|
|
57
57
|
}
|
|
58
58
|
function getMockObject({ item, mockOptions, operationId, tags, combine, context, imports, existingReferencedProperties, splitMockImplementations, allowOverride = false }) {
|
|
59
59
|
if (isReference(item)) return resolveMockValue({
|
|
@@ -123,7 +123,7 @@ function getMockObject({ item, mockOptions, operationId, tags, combine, context,
|
|
|
123
123
|
if (combine?.includedProperties.includes(key)) return;
|
|
124
124
|
const isRequired = mockOptions?.required ?? (Array.isArray(itemRequired) ? itemRequired : []).includes(key);
|
|
125
125
|
const hasNullable = "nullable" in prop && prop.nullable === true;
|
|
126
|
-
if (isReference(prop) && existingReferencedProperties.includes(getReferenceName$1(prop.$ref))) {
|
|
126
|
+
if (isReference(prop) && existingReferencedProperties.includes(getReferenceName$1(prop.$ref, context))) {
|
|
127
127
|
if (isRequired) return `${getKey(key)}: null`;
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
@@ -146,10 +146,10 @@ function getMockObject({ item, mockOptions, operationId, tags, combine, context,
|
|
|
146
146
|
const keyDefinition = getKey(key);
|
|
147
147
|
const hasDefault = "default" in prop && prop.default !== void 0;
|
|
148
148
|
if (!isRequired && !resolvedValue.overrided && !hasDefault) {
|
|
149
|
-
const
|
|
150
|
-
return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, ${
|
|
149
|
+
const omitValue = mockOptions?.nonNullable || !hasNullable ? "undefined" : "null";
|
|
150
|
+
return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, ${omitValue}])`;
|
|
151
151
|
}
|
|
152
|
-
if (Array.isArray(prop.type) && prop.type.includes("null") && !resolvedValue.overrided) return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, null])`;
|
|
152
|
+
if (Array.isArray(prop.type) && prop.type.includes("null") && !resolvedValue.overrided && !mockOptions?.nonNullable) return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, null])`;
|
|
153
153
|
return `${keyDefinition}: ${resolvedValue.value}`;
|
|
154
154
|
}).filter(Boolean);
|
|
155
155
|
if (allowOverride) propertyScalars.push(`...${overrideVarName}`);
|
|
@@ -169,7 +169,7 @@ function getMockObject({ item, mockOptions, operationId, tags, combine, context,
|
|
|
169
169
|
name: schemaItem.name
|
|
170
170
|
};
|
|
171
171
|
const additionalProperties = itemAdditionalProperties;
|
|
172
|
-
if (isReference(additionalProperties) && existingReferencedProperties.includes(getReferenceName$1(additionalProperties.$ref))) return {
|
|
172
|
+
if (isReference(additionalProperties) && existingReferencedProperties.includes(getReferenceName$1(additionalProperties.$ref, context))) return {
|
|
173
173
|
value: `{}`,
|
|
174
174
|
imports: [],
|
|
175
175
|
name: schemaItem.name
|
|
@@ -205,8 +205,9 @@ function getMockObject({ item, mockOptions, operationId, tags, combine, context,
|
|
|
205
205
|
//#region src/faker/getters/scalar.ts
|
|
206
206
|
function getMockScalar({ item, imports, mockOptions, operationId, tags, combine, context, existingReferencedProperties, splitMockImplementations, allowOverride = false }) {
|
|
207
207
|
const safeMockOptions = mockOptions ?? {};
|
|
208
|
+
const nonNullableOption = safeMockOptions.nonNullable;
|
|
208
209
|
if (item.isRef) existingReferencedProperties = [...existingReferencedProperties, item.name];
|
|
209
|
-
const operationProperty = resolveMockOverride(safeMockOptions.operations?.[operationId]?.properties, item);
|
|
210
|
+
const operationProperty = resolveMockOverride(safeMockOptions.operations?.[operationId]?.properties, item, nonNullableOption);
|
|
210
211
|
if (operationProperty) return operationProperty;
|
|
211
212
|
let overrideTag = { properties: {} };
|
|
212
213
|
const sortedTags = Object.entries(safeMockOptions.tags ?? {}).toSorted((a, b) => a[0].localeCompare(b[0], "en", { numeric: true }));
|
|
@@ -214,9 +215,9 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
214
215
|
if (!tags.includes(tag)) continue;
|
|
215
216
|
overrideTag = mergeDeep(overrideTag, options);
|
|
216
217
|
}
|
|
217
|
-
const tagProperty = resolveMockOverride(overrideTag.properties, item);
|
|
218
|
+
const tagProperty = resolveMockOverride(overrideTag.properties, item, nonNullableOption);
|
|
218
219
|
if (tagProperty) return tagProperty;
|
|
219
|
-
const property = resolveMockOverride(safeMockOptions.properties, item);
|
|
220
|
+
const property = resolveMockOverride(safeMockOptions.properties, item, nonNullableOption);
|
|
220
221
|
if (property) return property;
|
|
221
222
|
if (context.output.override.mock?.useExamples || safeMockOptions.useExamples) {
|
|
222
223
|
const propertyExample = item.example === void 0 ? Array.isArray(item.examples) && item.examples.length > 0 ? item.examples[0] : void 0 : item.example;
|
|
@@ -235,7 +236,7 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
235
236
|
const isNullable = Array.isArray(item.type) && item.type.includes("null");
|
|
236
237
|
const schemaContentMediaType = item.contentMediaType;
|
|
237
238
|
if (!item.format && schemaContentMediaType === "application/octet-stream" && ALL_FORMAT.binary) return {
|
|
238
|
-
value: getNullable(ALL_FORMAT.binary, isNullable),
|
|
239
|
+
value: getNullable(ALL_FORMAT.binary, isNullable, nonNullableOption),
|
|
239
240
|
imports: [],
|
|
240
241
|
name: item.name,
|
|
241
242
|
overrided: false
|
|
@@ -244,7 +245,7 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
244
245
|
let value = ALL_FORMAT[item.format];
|
|
245
246
|
if (["date", "date-time"].includes(item.format) && context.output.override.useDates) value = `new Date(${value})`;
|
|
246
247
|
return {
|
|
247
|
-
value: getNullable(value, isNullable),
|
|
248
|
+
value: getNullable(value, isNullable, nonNullableOption),
|
|
248
249
|
imports: [],
|
|
249
250
|
name: item.name,
|
|
250
251
|
overrided: false
|
|
@@ -262,14 +263,14 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
262
263
|
if (numMin !== void 0) intParts.push(`min: ${numMin}`);
|
|
263
264
|
if (numMax !== void 0) intParts.push(`max: ${numMax}`);
|
|
264
265
|
if (isFakerV9 && item.multipleOf !== void 0) intParts.push(`multipleOf: ${item.multipleOf}`);
|
|
265
|
-
let value = getNullable(`faker.number.${intFunction}(${intParts.length > 0 ? `{${intParts.join(", ")}}` : ""})`, isNullable);
|
|
266
|
+
let value = getNullable(`faker.number.${intFunction}(${intParts.length > 0 ? `{${intParts.join(", ")}}` : ""})`, isNullable, nonNullableOption);
|
|
266
267
|
if (type === "number") {
|
|
267
268
|
const floatParts = [];
|
|
268
269
|
if (numMin !== void 0) floatParts.push(`min: ${numMin}`);
|
|
269
270
|
if (numMax !== void 0) floatParts.push(`max: ${numMax}`);
|
|
270
271
|
if (isFakerV9 && item.multipleOf !== void 0) floatParts.push(`multipleOf: ${item.multipleOf}`);
|
|
271
272
|
else if (safeMockOptions.fractionDigits !== void 0) floatParts.push(`fractionDigits: ${safeMockOptions.fractionDigits}`);
|
|
272
|
-
value = getNullable(`faker.number.float(${floatParts.length > 0 ? `{${floatParts.join(", ")}}` : ""})`, isNullable);
|
|
273
|
+
value = getNullable(`faker.number.float(${floatParts.length > 0 ? `{${floatParts.join(", ")}}` : ""})`, isNullable, nonNullableOption);
|
|
273
274
|
}
|
|
274
275
|
const numberImports = [];
|
|
275
276
|
if (item.enum) value = getEnum(item, numberImports, context, existingReferencedProperties, "number");
|
|
@@ -283,10 +284,13 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
283
284
|
}
|
|
284
285
|
case "boolean": {
|
|
285
286
|
let value = "faker.datatype.boolean()";
|
|
286
|
-
|
|
287
|
+
const booleanImports = [];
|
|
288
|
+
if (item.enum) value = getEnum(item, booleanImports, context, existingReferencedProperties, "boolean");
|
|
289
|
+
else if ("const" in item) value = JSON.stringify(item.const);
|
|
287
290
|
return {
|
|
288
291
|
value,
|
|
289
|
-
|
|
292
|
+
enums: item.enum,
|
|
293
|
+
imports: booleanImports,
|
|
290
294
|
name: item.name
|
|
291
295
|
};
|
|
292
296
|
}
|
|
@@ -297,7 +301,7 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
297
301
|
name: item.name
|
|
298
302
|
};
|
|
299
303
|
const itemsRef = extractItemsRef(item.items);
|
|
300
|
-
if (itemsRef && existingReferencedProperties.includes(
|
|
304
|
+
if (itemsRef && existingReferencedProperties.includes(getRefInfo(itemsRef, context).name)) return {
|
|
301
305
|
value: "[]",
|
|
302
306
|
imports: [],
|
|
303
307
|
name: item.name
|
|
@@ -324,8 +328,20 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
324
328
|
};
|
|
325
329
|
let mapValue = value;
|
|
326
330
|
if (combine && !value.startsWith("faker") && !value.startsWith("{") && !value.startsWith("Array.from")) mapValue = `{${value}}`;
|
|
327
|
-
const
|
|
328
|
-
const
|
|
331
|
+
const arrSchemaMin = item.minItems;
|
|
332
|
+
const arrSchemaMax = item.maxItems;
|
|
333
|
+
const arrGlobalMin = safeMockOptions.arrayMin;
|
|
334
|
+
const arrGlobalMax = safeMockOptions.arrayMax;
|
|
335
|
+
let arrMin;
|
|
336
|
+
if (arrSchemaMin !== void 0) arrMin = arrSchemaMin;
|
|
337
|
+
else if (arrSchemaMax === void 0) arrMin = arrGlobalMin;
|
|
338
|
+
else if (arrGlobalMin === void 0 || arrGlobalMin > arrSchemaMax) arrMin = arrSchemaMax;
|
|
339
|
+
else arrMin = arrGlobalMin;
|
|
340
|
+
let arrMax;
|
|
341
|
+
if (arrSchemaMax !== void 0) arrMax = arrSchemaMax;
|
|
342
|
+
else if (arrSchemaMin === void 0) arrMax = arrGlobalMax;
|
|
343
|
+
else if (arrGlobalMax === void 0 || arrGlobalMax < arrSchemaMin) arrMax = arrSchemaMin;
|
|
344
|
+
else arrMax = arrGlobalMax;
|
|
329
345
|
const arrParts = [];
|
|
330
346
|
if (arrMin !== void 0) arrParts.push(`min: ${arrMin}`);
|
|
331
347
|
if (arrMax !== void 0) arrParts.push(`max: ${arrMax}`);
|
|
@@ -336,18 +352,29 @@ function getMockScalar({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
336
352
|
};
|
|
337
353
|
}
|
|
338
354
|
case "string": {
|
|
339
|
-
const
|
|
340
|
-
const
|
|
355
|
+
const schemaMin = item.minLength;
|
|
356
|
+
const schemaMax = item.maxLength;
|
|
357
|
+
const globalMin = safeMockOptions.stringMin;
|
|
358
|
+
const globalMax = safeMockOptions.stringMax;
|
|
359
|
+
let strMin;
|
|
360
|
+
if (schemaMin !== void 0) strMin = schemaMin;
|
|
361
|
+
else if (schemaMax === void 0) strMin = globalMin;
|
|
362
|
+
else if (globalMin === void 0 || globalMin > schemaMax) strMin = schemaMax;
|
|
363
|
+
else strMin = globalMin;
|
|
364
|
+
let strMax;
|
|
365
|
+
if (schemaMax !== void 0) strMax = schemaMax;
|
|
366
|
+
else if (schemaMin === void 0) strMax = globalMax;
|
|
367
|
+
else if (globalMax === void 0 || globalMax < schemaMin) strMax = schemaMin;
|
|
368
|
+
else strMax = globalMax;
|
|
341
369
|
const strLenParts = [];
|
|
342
|
-
if (strMin !== void 0) strLenParts.push(`min: ${strMin}`);
|
|
343
|
-
if (strMax !== void 0) strLenParts.push(`max: ${strMax}`);
|
|
370
|
+
if (strMin !== void 0 && strMax !== void 0) strLenParts.push(`min: ${strMin}`, `max: ${strMax}`);
|
|
344
371
|
let value = `faker.string.alpha(${strLenParts.length > 0 ? `{length: {${strLenParts.join(", ")}}}` : ""})`;
|
|
345
372
|
const stringImports = [];
|
|
346
373
|
if (item.enum) value = getEnum(item, stringImports, context, existingReferencedProperties, "string");
|
|
347
374
|
else if (item.pattern) value = `faker.helpers.fromRegExp(${JSON.stringify(item.pattern)})`;
|
|
348
375
|
else if ("const" in item) value = JSON.stringify(item.const);
|
|
349
376
|
return {
|
|
350
|
-
value: getNullable(value, isNullable),
|
|
377
|
+
value: getNullable(value, isNullable, nonNullableOption),
|
|
351
378
|
enums: item.enum,
|
|
352
379
|
name: item.name,
|
|
353
380
|
imports: stringImports
|
|
@@ -437,27 +464,85 @@ function getEnum(item, imports, context, existingReferencedProperties, type) {
|
|
|
437
464
|
function isRegex(key) {
|
|
438
465
|
return key.startsWith("/") && key.endsWith("/");
|
|
439
466
|
}
|
|
440
|
-
function
|
|
467
|
+
function stripArrayMarkerSegments(s) {
|
|
468
|
+
return s.split(".").filter((seg) => seg !== "[]").join(".");
|
|
469
|
+
}
|
|
470
|
+
function resolveMockOverride(properties = {}, item, nonNullableOption) {
|
|
441
471
|
const path = item.path ?? `#.${item.name}`;
|
|
472
|
+
const normalizedPath = stripArrayMarkerSegments(path);
|
|
442
473
|
const property = Object.entries(properties).find(([key]) => {
|
|
443
474
|
if (isRegex(key)) {
|
|
444
475
|
const regex = new RegExp(key.slice(1, -1));
|
|
445
476
|
if (regex.test(item.name) || regex.test(path)) return true;
|
|
446
477
|
}
|
|
447
|
-
if (`#.${key}` ===
|
|
478
|
+
if (`#.${stripArrayMarkerSegments(key)}` === normalizedPath) return true;
|
|
448
479
|
return false;
|
|
449
480
|
});
|
|
450
481
|
if (!property) return;
|
|
451
|
-
const isNullable = Array.isArray(item.type) && item.type.includes("null");
|
|
452
482
|
return {
|
|
453
|
-
value: getNullable(property[1],
|
|
483
|
+
value: getNullable(property[1], isNullableSchema(item), nonNullableOption),
|
|
454
484
|
imports: [],
|
|
455
485
|
name: item.name,
|
|
456
486
|
overrided: true
|
|
457
487
|
};
|
|
458
488
|
}
|
|
459
|
-
|
|
460
|
-
|
|
489
|
+
/** OpenAPI 3.0 `nullable: true` or 3.1 `type` unions that include `null`. */
|
|
490
|
+
function isNullableSchema(schema) {
|
|
491
|
+
if (!schema || typeof schema !== "object") return false;
|
|
492
|
+
const { type, nullable } = schema;
|
|
493
|
+
return nullable === true || Array.isArray(type) && type.includes("null");
|
|
494
|
+
}
|
|
495
|
+
/** When `nonNullableOption` is true (`override.mock.nonNullable`), omit the null branch. */
|
|
496
|
+
function getNullable(value, nullable, nonNullableOption) {
|
|
497
|
+
if (!nullable || nonNullableOption) return value;
|
|
498
|
+
return `faker.helpers.arrayElement([${value}, null])`;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* True when the active faker generator entry asks for consolidated schema
|
|
502
|
+
* mock factories and the output is configured to host them (i.e. there is a
|
|
503
|
+
* dedicated schemas directory we can import `index.faker` from). Used to
|
|
504
|
+
* decide whether an operation factory should inline a `$ref`'d schema or
|
|
505
|
+
* delegate to its `get<X>Mock` factory.
|
|
506
|
+
*/
|
|
507
|
+
function shouldDelegateToSchemaFactories(context) {
|
|
508
|
+
if (!context.output.schemas) return false;
|
|
509
|
+
return !!context.output.mock.generators.find((g) => !isFunction(g) && g.type === OutputMockType.FAKER && g.schemas === true);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Predicate: this `$ref` points at a top-level `#/components/schemas/<Name>`
|
|
513
|
+
* (vs. a parameter, response, or inline schema). Only those have a
|
|
514
|
+
* corresponding `get<Name>Mock` factory in the consolidated faker file.
|
|
515
|
+
*/
|
|
516
|
+
function isComponentsSchemaRef(refPaths) {
|
|
517
|
+
return Array.isArray(refPaths) && refPaths[0] === "components" && refPaths[1] === "schemas";
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Returns true when an operation- or tag-level mock override touches any
|
|
521
|
+
* property declared on the referenced schema. In that case we must inline
|
|
522
|
+
* the schema body so the override actually applies; the shared
|
|
523
|
+
* `get<X>Mock` factory has no knowledge of operation-scoped overrides.
|
|
524
|
+
*
|
|
525
|
+
* Reuses `resolveMockOverride` so the same matching rules apply as for
|
|
526
|
+
* regular property mocks — bare name, regex (`/.../`), and exact-path
|
|
527
|
+
* (`#.foo.bar`). The parent's `path` (where the `$ref` appears in the
|
|
528
|
+
* surrounding schema) gets composed into each synthetic property item so
|
|
529
|
+
* exact-path overrides like `#.color.value` resolve correctly.
|
|
530
|
+
*/
|
|
531
|
+
function hasOverrideTouchingSchema(schemaProperties, mockOptions, operationId, tags, parentPath) {
|
|
532
|
+
if (!schemaProperties) return false;
|
|
533
|
+
const propertyNames = Object.keys(schemaProperties);
|
|
534
|
+
if (propertyNames.length === 0) return false;
|
|
535
|
+
const overrideBuckets = [mockOptions?.operations?.[operationId]?.properties];
|
|
536
|
+
for (const tag of tags) overrideBuckets.push(mockOptions?.tags?.[tag]?.properties);
|
|
537
|
+
return overrideBuckets.some((bucket) => {
|
|
538
|
+
if (!bucket) return false;
|
|
539
|
+
return propertyNames.some((propertyName) => {
|
|
540
|
+
return !!resolveMockOverride(bucket, {
|
|
541
|
+
name: propertyName,
|
|
542
|
+
path: parentPath ? `${parentPath}.${propertyName}` : propertyName
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
});
|
|
461
546
|
}
|
|
462
547
|
function resolveMockValue({ schema, mockOptions, operationId, tags, combine, context, imports, existingReferencedProperties, splitMockImplementations, allowOverride }) {
|
|
463
548
|
if (isReference(schema)) {
|
|
@@ -472,7 +557,41 @@ function resolveMockValue({ schema, mockOptions, operationId, tags, combine, con
|
|
|
472
557
|
required: [...schemaRef?.required ?? [], ...schemaReference.required ?? []],
|
|
473
558
|
...schemaReference.nullable === void 0 ? {} : { nullable: schemaReference.nullable }
|
|
474
559
|
};
|
|
560
|
+
if (combine?.separator === "allOf" && newSchema.discriminator && newSchema.oneOf) {
|
|
561
|
+
const parentDiscriminator = newSchema.discriminator;
|
|
562
|
+
const mappingTargetNames = parentDiscriminator.mapping ? Object.values(parentDiscriminator.mapping).map((ref) => pascal(ref.split("/").pop() ?? "")) : [];
|
|
563
|
+
if (existingReferencedProperties.some((refName) => mappingTargetNames.includes(refName))) {
|
|
564
|
+
const mutableSchema = newSchema;
|
|
565
|
+
delete mutableSchema.oneOf;
|
|
566
|
+
const parentProperties = newSchema.properties;
|
|
567
|
+
if (parentDiscriminator.propertyName && parentProperties && parentDiscriminator.propertyName in parentProperties) {
|
|
568
|
+
const remainingProperties = Object.fromEntries(Object.entries(parentProperties).filter(([key]) => key !== parentDiscriminator.propertyName));
|
|
569
|
+
if (Object.keys(remainingProperties).length === 0) delete mutableSchema.properties;
|
|
570
|
+
else mutableSchema.properties = remainingProperties;
|
|
571
|
+
const parentRequired = newSchema.required;
|
|
572
|
+
if (Array.isArray(parentRequired)) {
|
|
573
|
+
const filteredRequired = parentRequired.filter((key) => key !== parentDiscriminator.propertyName);
|
|
574
|
+
if (filteredRequired.length === 0) delete mutableSchema.required;
|
|
575
|
+
else mutableSchema.required = filteredRequired;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
475
580
|
const newSeparator = newSchema.allOf ? "allOf" : newSchema.oneOf ? "oneOf" : "anyOf";
|
|
581
|
+
if (shouldDelegateToSchemaFactories(context) && isComponentsSchemaRef(refPaths) && !hasOverrideTouchingSchema(schemaRef?.properties, mockOptions, operationId, tags, schemaReference.path)) {
|
|
582
|
+
const factoryName = `get${pascal(name)}Mock`;
|
|
583
|
+
imports.push({
|
|
584
|
+
name: factoryName,
|
|
585
|
+
values: true,
|
|
586
|
+
schemaFactory: true
|
|
587
|
+
});
|
|
588
|
+
return {
|
|
589
|
+
value: getNullable(newSchema.type === "object" || !!newSchema.allOf || !!newSchema.oneOf || !!newSchema.anyOf ? `{ ...${factoryName}() }` : `${factoryName}()`, Boolean(newSchema.nullable), mockOptions?.nonNullable),
|
|
590
|
+
imports,
|
|
591
|
+
name: newSchema.name,
|
|
592
|
+
type: getType(newSchema)
|
|
593
|
+
};
|
|
594
|
+
}
|
|
476
595
|
const scalar = getMockScalar({
|
|
477
596
|
item: newSchema,
|
|
478
597
|
mockOptions,
|
|
@@ -527,17 +646,37 @@ function getType(schema) {
|
|
|
527
646
|
}
|
|
528
647
|
//#endregion
|
|
529
648
|
//#region src/faker/getters/combine.ts
|
|
530
|
-
function getReferenceName(ref) {
|
|
649
|
+
function getReferenceName(ref, context) {
|
|
531
650
|
if (!ref) return "";
|
|
532
|
-
return
|
|
651
|
+
return getRefInfo(ref, context).name;
|
|
533
652
|
}
|
|
534
653
|
function combineSchemasMock({ item, separator, mockOptions, operationId, tags, combine, context, imports, existingReferencedProperties, splitMockImplementations }) {
|
|
535
654
|
const combineImports = [];
|
|
536
655
|
const includedProperties = [...combine?.includedProperties ?? []];
|
|
537
656
|
const separatorItems = item[separator] ?? [];
|
|
538
657
|
const itemRequired = item.required;
|
|
539
|
-
const
|
|
540
|
-
|
|
658
|
+
const isRefAndNotExisting = isReference(item) && !existingReferencedProperties.includes(item.name);
|
|
659
|
+
const discriminator = item.discriminator;
|
|
660
|
+
const itemProperties = item.properties;
|
|
661
|
+
const discriminatorPropertyName = separator === "oneOf" && discriminator?.mapping && discriminator.propertyName && itemProperties && discriminator.propertyName in itemProperties ? discriminator.propertyName : void 0;
|
|
662
|
+
const itemEntriesForResolve = Object.entries(item).filter(([key]) => key !== separator);
|
|
663
|
+
if (discriminatorPropertyName && itemProperties) {
|
|
664
|
+
const propertiesIdx = itemEntriesForResolve.findIndex(([key]) => key === "properties");
|
|
665
|
+
if (propertiesIdx !== -1) {
|
|
666
|
+
const filteredProperties = Object.fromEntries(Object.entries(itemProperties).filter(([key]) => key !== discriminatorPropertyName));
|
|
667
|
+
if (Object.keys(filteredProperties).length === 0) itemEntriesForResolve.splice(propertiesIdx, 1);
|
|
668
|
+
else itemEntriesForResolve[propertiesIdx] = ["properties", filteredProperties];
|
|
669
|
+
}
|
|
670
|
+
const requiredIdx = itemEntriesForResolve.findIndex(([key]) => key === "required");
|
|
671
|
+
if (requiredIdx !== -1 && Array.isArray(itemRequired)) {
|
|
672
|
+
const filteredRequired = itemRequired.filter((key) => key !== discriminatorPropertyName);
|
|
673
|
+
if (filteredRequired.length === 0) itemEntriesForResolve.splice(requiredIdx, 1);
|
|
674
|
+
else itemEntriesForResolve[requiredIdx] = ["required", filteredRequired];
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
const hasResolvableProperties = itemEntriesForResolve.some(([key]) => key === "properties");
|
|
678
|
+
const itemResolvedValue = isRefAndNotExisting || hasResolvableProperties ? resolveMockValue({
|
|
679
|
+
schema: Object.fromEntries(itemEntriesForResolve),
|
|
541
680
|
combine: {
|
|
542
681
|
separator: "allOf",
|
|
543
682
|
includedProperties: []
|
|
@@ -560,7 +699,7 @@ function combineSchemasMock({ item, separator, mockOptions, operationId, tags, c
|
|
|
560
699
|
}
|
|
561
700
|
let value = separator === "allOf" ? "" : "faker.helpers.arrayElement([";
|
|
562
701
|
for (const val of separatorItems) {
|
|
563
|
-
const refName = isReference(val) ? getReferenceName(val.$ref) : "";
|
|
702
|
+
const refName = isReference(val) ? getReferenceName(val.$ref, context) : "";
|
|
564
703
|
if (separator === "allOf" ? refName && (refName === item.name || existingReferencedProperties.includes(refName) && !item.isRef) : refName && existingReferencedProperties.includes(refName)) {
|
|
565
704
|
if (separatorItems.length === 1) value = "undefined";
|
|
566
705
|
continue;
|
|
@@ -1022,6 +1161,67 @@ function generateFaker(generatorVerbOptions, generatorOptions) {
|
|
|
1022
1161
|
imports: result.imports
|
|
1023
1162
|
};
|
|
1024
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Builds the contents of a consolidated faker mock file for every entry under
|
|
1166
|
+
* `components/schemas`. Each schema produces a `get<SchemaName>Mock(overrides)`
|
|
1167
|
+
* factory in the spirit of the existing per-operation `get<Op>ResponseMock`
|
|
1168
|
+
* helpers. Opt in via `mock.generators: [{ type: 'faker', schemas: true }]`.
|
|
1169
|
+
*
|
|
1170
|
+
* Returns the function bodies plus any `GeneratorImport` references the
|
|
1171
|
+
* factories need so the writer can hoist them into the file header.
|
|
1172
|
+
*/
|
|
1173
|
+
function generateFakerForSchemas(schemas, context, options) {
|
|
1174
|
+
const factories = [];
|
|
1175
|
+
const allImports = [];
|
|
1176
|
+
const splitMockImplementations = [];
|
|
1177
|
+
const localFactoryNames = new Set(schemas.filter((s) => !!s.schema).map((s) => `get${pascal(s.name)}Mock`));
|
|
1178
|
+
const mockOptions = context.output.override.mock;
|
|
1179
|
+
for (const generatorSchema of schemas) {
|
|
1180
|
+
const { name, schema } = generatorSchema;
|
|
1181
|
+
if (!schema) continue;
|
|
1182
|
+
const factoryName = `get${pascal(name)}Mock`;
|
|
1183
|
+
const factoryImports = [];
|
|
1184
|
+
const result = getMockScalar({
|
|
1185
|
+
item: {
|
|
1186
|
+
...schema,
|
|
1187
|
+
name
|
|
1188
|
+
},
|
|
1189
|
+
imports: factoryImports,
|
|
1190
|
+
mockOptions,
|
|
1191
|
+
operationId: name,
|
|
1192
|
+
tags: [],
|
|
1193
|
+
context,
|
|
1194
|
+
existingReferencedProperties: [],
|
|
1195
|
+
splitMockImplementations,
|
|
1196
|
+
allowOverride: true,
|
|
1197
|
+
isRef: false
|
|
1198
|
+
});
|
|
1199
|
+
allImports.push(...result.imports, ...factoryImports);
|
|
1200
|
+
const typeName = pascal(name);
|
|
1201
|
+
const factory = `export const ${factoryName} = (${result.value.includes("overrideResponse") ? `overrideResponse: Partial<${typeName}> = {}` : ""}): ${typeName} => (${result.value});\n`;
|
|
1202
|
+
factories.push(factory);
|
|
1203
|
+
allImports.push({
|
|
1204
|
+
name: pascal(name),
|
|
1205
|
+
values: false
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
const mergedImports = /* @__PURE__ */ new Map();
|
|
1209
|
+
for (const imp of allImports) {
|
|
1210
|
+
if (imp.schemaFactory && localFactoryNames.has(imp.name)) continue;
|
|
1211
|
+
const key = `${imp.name}::${imp.alias ?? ""}`;
|
|
1212
|
+
const existing = mergedImports.get(key);
|
|
1213
|
+
if (!existing) {
|
|
1214
|
+
mergedImports.set(key, imp);
|
|
1215
|
+
continue;
|
|
1216
|
+
}
|
|
1217
|
+
if (!existing.values && imp.values) mergedImports.set(key, imp);
|
|
1218
|
+
}
|
|
1219
|
+
const uniqueImports = [...mergedImports.values()];
|
|
1220
|
+
return {
|
|
1221
|
+
implementation: [...splitMockImplementations, ...factories].join("\n"),
|
|
1222
|
+
imports: uniqueImports
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1025
1225
|
//#endregion
|
|
1026
1226
|
//#region src/index.ts
|
|
1027
1227
|
const DEFAULT_MSW_OPTIONS = {
|
|
@@ -1030,7 +1230,9 @@ const DEFAULT_MSW_OPTIONS = {
|
|
|
1030
1230
|
};
|
|
1031
1231
|
const DEFAULT_FAKER_OPTIONS = {
|
|
1032
1232
|
type: OutputMockType.FAKER,
|
|
1033
|
-
useExamples: false
|
|
1233
|
+
useExamples: false,
|
|
1234
|
+
schemas: false,
|
|
1235
|
+
operationResponses: true
|
|
1034
1236
|
};
|
|
1035
1237
|
/**
|
|
1036
1238
|
* Returns the default GlobalMockOptions for a given mock type. Used when
|
|
@@ -1065,6 +1267,6 @@ function generateMock(generatorVerbOptions, generatorOptions) {
|
|
|
1065
1267
|
}
|
|
1066
1268
|
}
|
|
1067
1269
|
//#endregion
|
|
1068
|
-
export { DEFAULT_FAKER_OPTIONS, DEFAULT_MSW_OPTIONS, generateFaker, generateFakerImports, generateMSW, generateMSWImports, generateMock, generateMockImports, getDefaultMockOptionsForType };
|
|
1270
|
+
export { DEFAULT_FAKER_OPTIONS, DEFAULT_MSW_OPTIONS, generateFaker, generateFakerForSchemas, generateFakerImports, generateMSW, generateMSWImports, generateMock, generateMockImports, getDefaultMockOptionsForType };
|
|
1069
1271
|
|
|
1070
1272
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["getReferenceName"],"sources":["../src/delay.ts","../src/faker/compatible-v9.ts","../src/faker/constants.ts","../src/faker/getters/object.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 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 { 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 type ContextSpec,\n type GeneratorImport,\n getKey,\n isReference,\n type MockOptions,\n type OpenApiReferenceObject,\n type OpenApiSchemaObject,\n pascal,\n PropertySortOrder,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { DEFAULT_OBJECT_KEY_MOCK } from '../constants';\nimport { resolveMockValue } from '../resolvers/value';\nimport { combineSchemasMock } from './combine';\n\nexport const overrideVarName = 'overrideResponse';\n\nfunction getReferenceName(ref?: string): string {\n if (!ref) return '';\n\n return pascal(ref.split('/').pop() ?? '');\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 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 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 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 splitMockImplementations,\n });\n }\n\n if (Array.isArray(itemType)) {\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 baseItem = schemaItem as Record<string, unknown>;\n return combineSchemasMock({\n item: {\n anyOf: itemType.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 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 a[0].localeCompare(b[0], 'en', { numeric: true });\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 // Check to see if the property is a reference to an existing property\n // Fixes issue #910\n if (\n isReference(prop) &&\n existingReferencedProperties.includes(getReferenceName(prop.$ref))\n ) {\n if (isRequired) {\n const keyDefinition = getKey(key);\n return `${keyDefinition}: null`;\n }\n return;\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...(prop as Record<string, unknown>),\n name: key,\n path: schemaItem.path ? `${schemaItem.path}.${key}` : `#.${key}`,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n imports.push(...resolvedValue.imports);\n includedProperties.push(key);\n\n const keyDefinition = getKey(key);\n\n const hasDefault = 'default' in prop && prop.default !== undefined;\n\n if (!isRequired && !resolvedValue.overrided && !hasDefault) {\n const nullValue = hasNullable ? 'null' : 'undefined';\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, ${nullValue}])`;\n }\n\n const isNullable =\n Array.isArray(prop.type) && prop.type.includes('null');\n if (isNullable && !resolvedValue.overrided) {\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 return {\n value,\n imports,\n name: schemaItem.name,\n includedProperties,\n };\n }\n\n if (itemAdditionalProperties) {\n if (itemAdditionalProperties === true) {\n return { value: `{}`, imports: [], name: schemaItem.name };\n }\n const additionalProperties = itemAdditionalProperties;\n if (\n isReference(additionalProperties) &&\n existingReferencedProperties.includes(\n getReferenceName(additionalProperties.$ref),\n )\n ) {\n return { value: `{}`, imports: [], name: schemaItem.name };\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 splitMockImplementations,\n });\n\n return {\n ...resolvedValue,\n value: `{\n [${DEFAULT_OBJECT_KEY_MOCK}]: ${resolvedValue.value}\n }`,\n };\n }\n\n return { value: '{}', imports: [], name: schemaItem.name };\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 type ContextSpec,\n EnumGeneration,\n escape,\n type GeneratorImport,\n isReference,\n isString,\n mergeDeep,\n type MockOptions,\n type OpenApiSchemaObject,\n pascal,\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 { 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 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 splitMockImplementations,\n allowOverride = false,\n}: GetMockScalarOptions): MockDefinition {\n const safeMockOptions: MockOptions = mockOptions ?? {};\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 );\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) => a[0].localeCompare(b[0], 'en', { numeric: true }),\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(overrideTag.properties, item);\n\n if (tagProperty) {\n return tagProperty;\n }\n\n const property = resolveMockOverride(safeMockOptions.properties, item);\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: JSON.stringify(propertyExample),\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 const isNullable = Array.isArray(item.type) && item.type.includes('null');\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),\n imports: [],\n name: item.name,\n overrided: false,\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),\n imports: [],\n name: item.name,\n overrided: false,\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 );\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 );\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 };\n }\n\n case 'boolean': {\n let value = 'faker.datatype.boolean()';\n if ('const' in item) {\n value = JSON.stringify(item.const);\n }\n return {\n value,\n imports: [],\n name: item.name,\n };\n }\n\n case 'array': {\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 pascal(itemsRef.split('/').pop() ?? ''),\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 path: item.path ? `${item.path}.[]` : '#.[]',\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\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 if (\n combine &&\n !value.startsWith('faker') &&\n !value.startsWith('{') &&\n !value.startsWith('Array.from')\n ) {\n mapValue = `{${value}}`;\n }\n\n const arrMin = (item.minItems ?? safeMockOptions.arrayMin) as\n | number\n | undefined;\n const arrMax = (item.maxItems ?? safeMockOptions.arrayMax) as\n | number\n | undefined;\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 const strMin = (item.minLength ?? safeMockOptions.stringMin) as\n | number\n | undefined;\n const strMax = (item.maxLength ?? safeMockOptions.stringMax) as\n | number\n | undefined;\n const strLenParts: string[] = [];\n if (strMin !== undefined) strLenParts.push(`min: ${strMin}`);\n if (strMax !== undefined) strLenParts.push(`max: ${strMax}`);\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),\n enums: item.enum,\n name: item.name,\n imports: stringImports,\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 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.\nfunction 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\nfunction getEnum(\n item: MockSchemaObject,\n imports: GeneratorImport[],\n context: ContextSpec,\n existingReferencedProperties: string[],\n type?: 'string' | 'number',\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) =>\n type === 'string' || (type === undefined && isString(e))\n ? `'${escape(e)}'`\n : e,\n )\n .join(',');\n\n let enumValue = `[${joinedEnumValues}]`;\n if (context.output.override.enumGenerationType === EnumGeneration.ENUM) {\n if (item.isRef || existingReferencedProperties.length === 0) {\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, we can use the object directly via the imports and using Object.values.\n if (item.isRef && type === 'string') {\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 isReference,\n type MockOptions,\n type OpenApiSchemaObject,\n pascal,\n} from '@orval/core';\nimport { prop } from 'remeda';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { overrideVarName } from '../getters';\nimport { getMockScalar } from '../getters/scalar';\n\nfunction isRegex(key: string) {\n return key.startsWith('/') && key.endsWith('/');\n}\n\nexport function resolveMockOverride(\n properties: Record<string, unknown> | undefined = {},\n item: OpenApiSchemaObject & { name: string; path?: string },\n) {\n const path = item.path ?? `#.${item.name}`;\n const property = Object.entries(properties).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 (`#.${key}` === path) {\n return true;\n }\n\n return false;\n });\n\n if (!property) {\n return;\n }\n\n const isNullable = Array.isArray(item.type) && item.type.includes('null');\n\n return {\n value: getNullable(property[1] as string, isNullable),\n imports: [],\n name: item.name,\n overrided: true,\n };\n}\n\nexport function getNullable(value: string, nullable?: boolean) {\n return nullable ? `faker.helpers.arrayElement([${value}, null])` : value;\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 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 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 = Array.isArray(refPaths)\n ? (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>)\n : undefined;\n\n const newSchema = {\n ...schemaRef,\n name,\n path: schemaReference.path,\n isRef: true,\n required: [\n ...((schemaRef?.required as string[] | undefined) ?? []),\n ...(schemaReference.required ?? []),\n ],\n ...(schemaReference.nullable === undefined\n ? {}\n : { nullable: schemaReference.nullable }),\n } as MockSchemaObject;\n\n const newSeparator = newSchema.allOf\n ? 'allOf'\n : newSchema.oneOf\n ? 'oneOf'\n : 'anyOf';\n\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 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 type = `Partial<${newSchema.name}>`;\n if (discriminatedProperty) {\n type = `Omit<${type}, '${discriminatedProperty}'>`;\n }\n\n const args = `${overrideVarName}: ${type} = {}`;\n const func = `export const ${funcName} = (${args}): ${newSchema.name} => ({${scalar.value.startsWith('...') ? '' : '...'}${scalar.value}, ...${overrideVarName}});`;\n splitMockImplementations.push(func);\n }\n\n scalar.value = newSchema.nullable\n ? `${funcName}()`\n : `{...${funcName}()}`;\n\n scalar.imports.push({ name: newSchema.name });\n }\n\n return {\n ...scalar,\n type: getType(newSchema),\n };\n }\n\n const scalar = getMockScalar({\n item: schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\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","import {\n type ContextSpec,\n type GeneratorImport,\n isReference,\n isSchema,\n type MockOptions,\n pascal,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { resolveMockValue } from '../resolvers';\n\nfunction getReferenceName(ref?: string): string {\n if (!ref) return '';\n\n return pascal(ref.split('/').pop() ?? '');\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 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 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 const itemResolvedValue =\n isRefAndNotExisting || item.properties\n ? resolveMockValue({\n schema: Object.fromEntries(\n Object.entries(item).filter(([key]) => key !== separator),\n ) as MockSchemaObject,\n combine: {\n separator: 'allOf',\n includedProperties: [],\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n })\n : undefined;\n\n includedProperties.push(...(itemResolvedValue?.includedProperties ?? []));\n combineImports.push(...(itemResolvedValue?.imports ?? []));\n let containsOnlyPrimitiveValues = true;\n\n const allRequiredFields: string[] = [];\n if (separator === 'allOf') {\n if (itemRequired) {\n allRequiredFields.push(...itemRequired);\n }\n for (const val of separatorItems) {\n if (isSchema(val) && val.required) {\n allRequiredFields.push(...(val.required as string[]));\n }\n }\n }\n\n let value = separator === 'allOf' ? '' : 'faker.helpers.arrayElement([';\n\n for (const val of separatorItems) {\n const refName = isReference(val) ? getReferenceName(val.$ref) : '';\n // For allOf: skip if refName is in existingRefs AND this is an inline schema (not a top-level ref)\n // This allows top-level schemas (item.isRef=true) to get base properties from allOf\n // while preventing circular allOf chains in inline property schemas.\n // For oneOf/anyOf: skip variants that point back to an already-visited schema,\n // otherwise polymorphic recursion (e.g. Base.Parent → oneOf [Derived → allOf [Base]])\n // would infinitely re-expand.\n const shouldSkipRef =\n separator === 'allOf'\n ? refName &&\n (refName === item.name ||\n (existingReferencedProperties.includes(refName) && !item.isRef))\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 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 { camel, sanitize } from '@orval/core';\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(camel(matches[2]), {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path) ? `${prev}:${param}${next}` : `${prev}${param}${next}`;\n};\n\nexport const getRouteMSW = (route: string, baseUrl = '*') => {\n route = route.replaceAll(':', String.raw`\\\\:`);\n const splittedRoute = route.split('/');\n let resolvedRoute = baseUrl;\n\n for (const [index, path] of splittedRoute.entries()) {\n if (!path && !index) {\n continue;\n }\n\n if (!path.includes('{')) {\n resolvedRoute = `${resolvedRoute}/${path}`;\n continue;\n }\n\n resolvedRoute = `${resolvedRoute}/${getRoutePath(path)}`;\n }\n\n return resolvedRoute;\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 { getMockScalar } from '../faker/getters';\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\nfunction 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\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 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 };\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\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 result.definitions.push(\n transformer\n ? transformer(exampleValue, returnType)\n : JSON.stringify(exampleValue),\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 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,\n mockOptions: mockOptionsWithoutFunc,\n operationId,\n tags,\n context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n });\n\n result.imports.push(...scalar.imports);\n result.definitions.push(\n transformer ? transformer(scalar.value, returnType) : scalar.value,\n );\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 pascal,\n type ResReqTypesValue,\n} from '@orval/core';\n\nimport { getDelay } from '../delay';\nimport { getRouteMSW, overrideVarName } from '../faker/getters';\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 const isBinaryResponse =\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 mockImplementation = isReturnHttpResponse\n ? `${mockImplementations}export const ${getResponseMockFunctionName} = (${\n isResponseOverridable\n ? `overrideResponse: ${overrideResponseType} = {}`\n : ''\n })${mockData ? '' : `: ${nonVoidMockReturnType}`} => (${value})\\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 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': '${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} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n nonVoidBody = `HttpResponse.${textHelper}(\n typeof resolvedBody === 'string' ? resolvedBody : JSON.stringify(resolvedBody ?? null),\n { status: ${statusCode} })`;\n } else {\n nonVoidBody = `HttpResponse.json(resolvedBody, { status: ${statusCode} })`;\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} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n responseBody = `HttpResponse.${textHelper}(textBody,\n { status: ${statusCode}\n })`;\n } else {\n responseBody = `HttpResponse.json(${resolvedResponseExpr},\n { status: ${statusCode}\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 };\n}\n\nexport function generateMSW(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder {\n const { pathRoute, override, mock } = generatorOptions;\n const { operationId, 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 const handlerName = `get${pascal(operationId)}MockHandler`;\n const getResponseMockFunctionName = `get${pascal(operationId)}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\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 }\n }\n\n return {\n implementation: {\n function: mockImplementations.join('\\n'),\n handlerName,\n handler: handlerImplementations.join('\\n'),\n },\n imports: imports,\n };\n}\n","import {\n type ClientMockGeneratorBuilder,\n generateDependencyImports,\n type GenerateMockImports,\n type GeneratorDependency,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GlobalMockOptions,\n} from '@orval/core';\n\nimport { generateMSW } from '../msw';\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 };\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};\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 switch (generatorOptions.mock.type) {\n case OutputMockType.FAKER: {\n return generateFaker(generatorVerbOptions, generatorOptions);\n }\n default: {\n return generateMSW(generatorVerbOptions, generatorOptions);\n }\n }\n}\n\nexport { generateFaker, generateFakerImports } from './faker';\nexport { generateMSW, generateMSWImports } from './msw';\n"],"mappings":";;;AAUA,MAAa,YACX,UACA,YAC4B;CAI5B,MAAM,aAAa,WAAW,UAAU,QAAQ,GAAG,UAAU,KAAA;CAC7D,MAAM,eAAe,UAAU;CAC/B,MAAM,gBAAgB,cAAc,SAAS,YAAY;CACzD,MAAM,2BACJ,cAAc,4BACd,YAAY;AACd,KAAI,WAAW,cAAc,CAC3B,QAAO,2BAA2B,gBAAgB,eAAe;AAEnE,KAAI,SAAS,cAAc,IAAI,UAAU,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GAChC,SAAS;GACT,aAAa;GACd;EACD,SAAS,OAAO;EACjB;;;;ACtDH,MAAa,sBAAsC;CACjD,MAAM,eAAe;CACrB,aAAa;CACd;AAED,MAAa,wBAA0C;CACrD,MAAM,eAAe;CACrB,aAAa;CACd;;;;;;AAOD,MAAa,gCACX,SACsB;AACtB,SAAQ,MAAR;EACE,KAAK,eAAe,MAClB,QAAO;EAET,KAAK,eAAe,IAClB,QAAO;;;;;;;AASb,MAAa,uBAA4C,kBAAkB;AACzE,SAAQ,cAAc,SAAS,MAA/B;EACE,KAAK,eAAe,MAClB,QAAO,qBAAqB,cAAc;EAE5C,QACE,QAAO,mBAAmB,cAAc;;;;;;;;AAU9C,SAAgB,aACd,sBACA,kBAGA;AACA,SAAQ,iBAAiB,KAAK,MAA9B;EACE,KAAK,eAAe,MAClB,QAAO,cAAc,sBAAsB,iBAAiB;EAE9D,QACE,QAAO,YAAY,sBAAsB,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["getReferenceName"],"sources":["../src/delay.ts","../src/faker/compatible-v9.ts","../src/faker/constants.ts","../src/faker/getters/object.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 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 { 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 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 { resolveMockValue } from '../resolvers/value';\nimport { combineSchemasMock } from './combine';\n\nexport const overrideVarName = 'overrideResponse';\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 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 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 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 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 splitMockImplementations,\n });\n }\n\n if (Array.isArray(itemType)) {\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 baseItem = schemaItem as Record<string, unknown>;\n return combineSchemasMock({\n item: {\n anyOf: itemType.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 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 a[0].localeCompare(b[0], 'en', { numeric: true });\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 // Check to see if the property is a reference to an existing property\n // Fixes issue #910\n if (\n isReference(prop) &&\n existingReferencedProperties.includes(\n getReferenceName(prop.$ref, context),\n )\n ) {\n if (isRequired) {\n const keyDefinition = getKey(key);\n return `${keyDefinition}: null`;\n }\n return;\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...(prop as Record<string, unknown>),\n name: key,\n path: schemaItem.path ? `${schemaItem.path}.${key}` : `#.${key}`,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n imports.push(...resolvedValue.imports);\n includedProperties.push(key);\n\n const keyDefinition = getKey(key);\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.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 return {\n value,\n imports,\n name: schemaItem.name,\n includedProperties,\n };\n }\n\n if (itemAdditionalProperties) {\n if (itemAdditionalProperties === true) {\n return { value: `{}`, imports: [], name: schemaItem.name };\n }\n const additionalProperties = itemAdditionalProperties;\n if (\n isReference(additionalProperties) &&\n existingReferencedProperties.includes(\n getReferenceName(additionalProperties.$ref, context),\n )\n ) {\n return { value: `{}`, imports: [], name: schemaItem.name };\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 splitMockImplementations,\n });\n\n return {\n ...resolvedValue,\n value: `{\n [${DEFAULT_OBJECT_KEY_MOCK}]: ${resolvedValue.value}\n }`,\n };\n }\n\n return { value: '{}', imports: [], name: schemaItem.name };\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 type ContextSpec,\n EnumGeneration,\n escape,\n type GeneratorImport,\n getRefInfo,\n isReference,\n isString,\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 { 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 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 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) => a[0].localeCompare(b[0], 'en', { numeric: true }),\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 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: JSON.stringify(propertyExample),\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 // OpenAPI 3.1 null unions only — 3.0 `nullable: true` is handled in object.ts\n // to avoid double-wrapping scalar values that object.ts already null-randomizes.\n const isNullable = Array.isArray(item.type) && item.type.includes('null');\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 };\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 };\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 };\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 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 path: item.path ? `${item.path}.[]` : '#.[]',\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\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 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 };\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 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.\nfunction 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\nfunction getEnum(\n item: MockSchemaObject,\n imports: GeneratorImport[],\n context: ContextSpec,\n existingReferencedProperties: string[],\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) =>\n type === 'string' || (type === undefined && isString(e))\n ? `'${escape(e)}'`\n : e,\n )\n .join(',');\n\n let enumValue = `[${joinedEnumValues}]`;\n if (context.output.override.enumGenerationType === EnumGeneration.ENUM) {\n if (item.isRef || existingReferencedProperties.length === 0) {\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, we can use the object directly via the imports and using Object.values.\n if (item.isRef && type === 'string') {\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 isFunction,\n isReference,\n type MockOptions,\n type OpenApiSchemaObject,\n OutputMockType,\n pascal,\n} from '@orval/core';\nimport { prop } from 'remeda';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { overrideVarName } from '../getters';\nimport { getMockScalar } from '../getters/scalar';\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 property = Object.entries(properties).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 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/** 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 * 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 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 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 = Array.isArray(refPaths)\n ? (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>)\n : undefined;\n\n const newSchema = {\n ...schemaRef,\n name,\n path: schemaReference.path,\n isRef: true,\n required: [\n ...((schemaRef?.required as string[] | undefined) ?? []),\n ...(schemaReference.required ?? []),\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 // 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 !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 imports.push({\n name: factoryName,\n values: true,\n schemaFactory: true,\n });\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 const isObjectLike =\n newSchema.type === 'object' ||\n !!newSchema.allOf ||\n !!newSchema.oneOf ||\n !!newSchema.anyOf;\n const callValue = isObjectLike\n ? `{ ...${factoryName}() }`\n : `${factoryName}()`;\n\n return {\n value: getNullable(\n callValue,\n Boolean(newSchema.nullable),\n mockOptions?.nonNullable,\n ),\n imports,\n name: newSchema.name,\n type: getType(newSchema),\n };\n }\n\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 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 type = `Partial<${newSchema.name}>`;\n if (discriminatedProperty) {\n type = `Omit<${type}, '${discriminatedProperty}'>`;\n }\n\n const args = `${overrideVarName}: ${type} = {}`;\n const func = `export const ${funcName} = (${args}): ${newSchema.name} => ({${scalar.value.startsWith('...') ? '' : '...'}${scalar.value}, ...${overrideVarName}});`;\n splitMockImplementations.push(func);\n }\n\n scalar.value = newSchema.nullable\n ? `${funcName}()`\n : `{...${funcName}()}`;\n\n scalar.imports.push({ name: newSchema.name });\n }\n\n return {\n ...scalar,\n type: getType(newSchema),\n };\n }\n\n const scalar = getMockScalar({\n item: schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\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","import {\n type ContextSpec,\n type GeneratorImport,\n getRefInfo,\n isReference,\n isSchema,\n type MockOptions,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchema, MockSchemaObject } from '../../types';\nimport { resolveMockValue } from '../resolvers';\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 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 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 itemResolvedValue =\n isRefAndNotExisting || hasResolvableProperties\n ? resolveMockValue({\n schema: Object.fromEntries(itemEntriesForResolve) as MockSchemaObject,\n combine: {\n separator: 'allOf',\n includedProperties: [],\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n })\n : undefined;\n\n includedProperties.push(...(itemResolvedValue?.includedProperties ?? []));\n combineImports.push(...(itemResolvedValue?.imports ?? []));\n let containsOnlyPrimitiveValues = true;\n\n const allRequiredFields: string[] = [];\n if (separator === 'allOf') {\n if (itemRequired) {\n allRequiredFields.push(...itemRequired);\n }\n for (const val of separatorItems) {\n if (isSchema(val) && val.required) {\n allRequiredFields.push(...(val.required as string[]));\n }\n }\n }\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 if refName is in existingRefs AND this is an inline schema (not a top-level ref)\n // This allows top-level schemas (item.isRef=true) to get base properties from allOf\n // while preventing circular allOf chains in inline property schemas.\n // For oneOf/anyOf: skip variants that point back to an already-visited schema,\n // otherwise polymorphic recursion (e.g. Base.Parent → oneOf [Derived → allOf [Base]])\n // would infinitely re-expand.\n const shouldSkipRef =\n separator === 'allOf'\n ? refName &&\n (refName === item.name ||\n (existingReferencedProperties.includes(refName) && !item.isRef))\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 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 { camel, sanitize } from '@orval/core';\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(camel(matches[2]), {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path) ? `${prev}:${param}${next}` : `${prev}${param}${next}`;\n};\n\nexport const getRouteMSW = (route: string, baseUrl = '*') => {\n route = route.replaceAll(':', String.raw`\\\\:`);\n const splittedRoute = route.split('/');\n let resolvedRoute = baseUrl;\n\n for (const [index, path] of splittedRoute.entries()) {\n if (!path && !index) {\n continue;\n }\n\n if (!path.includes('{')) {\n resolvedRoute = `${resolvedRoute}/${path}`;\n continue;\n }\n\n resolvedRoute = `${resolvedRoute}/${getRoutePath(path)}`;\n }\n\n return resolvedRoute;\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 { getMockScalar } from '../faker/getters';\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\nfunction 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\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 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 };\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\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 result.definitions.push(\n transformer\n ? transformer(exampleValue, returnType)\n : JSON.stringify(exampleValue),\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 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,\n mockOptions: mockOptionsWithoutFunc,\n operationId,\n tags,\n context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n });\n\n result.imports.push(...scalar.imports);\n result.definitions.push(\n transformer ? transformer(scalar.value, returnType) : scalar.value,\n );\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 pascal,\n type ResReqTypesValue,\n} from '@orval/core';\n\nimport { getDelay } from '../delay';\nimport { getRouteMSW, overrideVarName } from '../faker/getters';\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 const isBinaryResponse =\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 mockImplementation = isReturnHttpResponse\n ? `${mockImplementations}export const ${getResponseMockFunctionName} = (${\n isResponseOverridable\n ? `overrideResponse: ${overrideResponseType} = {}`\n : ''\n })${mockData ? '' : `: ${nonVoidMockReturnType}`} => (${value})\\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 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': '${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} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n nonVoidBody = `HttpResponse.${textHelper}(\n typeof resolvedBody === 'string' ? resolvedBody : JSON.stringify(resolvedBody ?? null),\n { status: ${statusCode} })`;\n } else {\n nonVoidBody = `HttpResponse.json(resolvedBody, { status: ${statusCode} })`;\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} })\n : HttpResponse.json(resolvedBody, { status: ${statusCode} })`;\n } else if (isTextResponse && !shouldPreferJsonResponse) {\n responseBody = `HttpResponse.${textHelper}(textBody,\n { status: ${statusCode}\n })`;\n } else {\n responseBody = `HttpResponse.json(${resolvedResponseExpr},\n { status: ${statusCode}\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 };\n}\n\nexport function generateMSW(\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder {\n const { pathRoute, override, mock } = generatorOptions;\n const { operationId, 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 const handlerName = `get${pascal(operationId)}MockHandler`;\n const getResponseMockFunctionName = `get${pascal(operationId)}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\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 }\n }\n\n return {\n implementation: {\n function: mockImplementations.join('\\n'),\n handlerName,\n handler: handlerImplementations.join('\\n'),\n },\n imports: imports,\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} from '@orval/core';\n\nimport { generateMSW } from '../msw';\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 };\n}\n\nexport interface GenerateFakerForSchemasResult {\n implementation: string;\n imports: GeneratorImport[];\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 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\n const mockOptions = context.output.override.mock;\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\n const result = getMockScalar({\n item: {\n ...(schema as Record<string, unknown>),\n name,\n } as Parameters<typeof getMockScalar>[0]['item'],\n imports: factoryImports,\n mockOptions,\n operationId: name,\n tags: [],\n context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n isRef: false,\n } as Parameters<typeof getMockScalar>[0]);\n\n allImports.push(...result.imports, ...factoryImports);\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 = isOverridable\n ? `overrideResponse: Partial<${typeName}> = {}`\n : '';\n const factory = `export const ${factoryName} = (${param}): ${typeName} => (${result.value});\\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\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].join('\\n');\n\n return {\n implementation,\n imports: uniqueImports,\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 switch (generatorOptions.mock.type) {\n case OutputMockType.FAKER: {\n return generateFaker(generatorVerbOptions, generatorOptions);\n }\n default: {\n return generateMSW(generatorVerbOptions, generatorOptions);\n }\n }\n}\n\nexport type { GenerateFakerForSchemasResult } from './faker';\nexport {\n generateFaker,\n generateFakerForSchemas,\n generateFakerImports,\n} from './faker';\nexport { generateMSW, generateMSWImports } from './msw';\n"],"mappings":";;;AAUA,MAAa,YACX,UACA,YAC4B;CAI5B,MAAM,aAAa,WAAW,UAAU,QAAQ,GAAG,UAAU,KAAA;CAC7D,MAAM,eAAe,UAAU;CAC/B,MAAM,gBAAgB,cAAc,SAAS,YAAY;CACzD,MAAM,2BACJ,cAAc,4BACd,YAAY;AACd,KAAI,WAAW,cAAc,CAC3B,QAAO,2BAA2B,gBAAgB,eAAe;AAEnE,KAAI,SAAS,cAAc,IAAI,UAAU,cAAc,CACrD,QAAO;AAET,QAAO;;;;AC3BT,MAAM,0BAA0B,gBAA6B;AAC3D,QACE,YAAY,mBAAmB,sBAC/B,YAAY,eAAe,sBAC3B,YAAY,kBAAkB,sBAC9B,YAAY,mBAAmB;;AAInC,MAAa,oBAAoB,gBAA6B;CAC5D,MAAM,UAAU,uBAAuB,YAAY;AAEnD,KAAI,CAAC,QACH,QAAO;CAGT,MAAM,YAAY,QAAQ,MAAM,IAAI,CAAC;AAErC,QAAO,gBAAgB,WAAW,QAAQ;;;;AClB5C,MAAa,sBAGT;CACF,KAAK;CACL,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,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AQ,CAAC;AAWjD,QAAO;EACL,gBAHqB,CAAC,GAAG,0BAA0B,GAAG,UAAU,CAAC,KAAK,KAAK;EAI3E,SAAS;EACV;;;;ACzLH,MAAa,sBAAsC;CACjD,MAAM,eAAe;CACrB,aAAa;CACd;AAED,MAAa,wBAA0C;CACrD,MAAM,eAAe;CACrB,aAAa;CACb,SAAS;CACT,oBAAoB;CACrB;;;;;;AAOD,MAAa,gCACX,SACsB;AACtB,SAAQ,MAAR;EACE,KAAK,eAAe,MAClB,QAAO;EAET,KAAK,eAAe,IAClB,QAAO;;;;;;;AASb,MAAa,uBAA4C,kBAAkB;AACzE,SAAQ,cAAc,SAAS,MAA/B;EACE,KAAK,eAAe,MAClB,QAAO,qBAAqB,cAAc;EAE5C,QACE,QAAO,mBAAmB,cAAc;;;;;;;;AAU9C,SAAgB,aACd,sBACA,kBAGA;AACA,SAAQ,iBAAiB,KAAK,MAA9B;EACE,KAAK,eAAe,MAClB,QAAO,cAAc,sBAAsB,iBAAiB;EAE9D,QACE,QAAO,YAAY,sBAAsB,iBAAiB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/mock",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"nuke": "rimraf .turbo dist node_modules"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@orval/core": "8.
|
|
38
|
+
"@orval/core": "8.14.0",
|
|
39
39
|
"remeda": "^2.33.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|