@redocly/cli 2.71.0 → 2.71.2

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.
Files changed (158) hide show
  1. package/THIRD_PARTY_NOTICES +3 -3
  2. package/lib/chunks/{V6VNRABV.js → 2TG3DP4I.js} +1 -1
  3. package/lib/chunks/{BU4AMVHN.js → 2ZEKFWJQ.js} +1 -1
  4. package/lib/chunks/{LS3G7CUH.js → 3EQNI6CT.js} +1 -1
  5. package/lib/chunks/{TXSBWL3Y.js → 3FR3456Q.js} +1 -1
  6. package/lib/chunks/{VXD5O25A.js → 3VOQMXIZ.js} +1 -1
  7. package/lib/chunks/4H3DPQDW.js +7 -0
  8. package/lib/chunks/4S6LRPCX.js +20 -0
  9. package/lib/chunks/{QB6CQ2CV.js → 5AVTCY6F.js} +1 -1
  10. package/lib/chunks/{JCP37EY3.js → 5CR6AOLY.js} +59 -25
  11. package/lib/chunks/{G2M6SQCS.js → 5HPO77VR.js} +2 -2
  12. package/lib/chunks/6X42UQ3O.js +20 -0
  13. package/lib/chunks/{QTGTCBFK.js → 7GADNOVY.js} +1 -1
  14. package/lib/chunks/{SXIMN47K.js → 7JS7JGWP.js} +1 -1
  15. package/lib/chunks/{EH6VW7JO.js → ADACRYTN.js} +1 -1
  16. package/lib/chunks/{PF43QQZA.js → AXGFQS75.js} +2 -2
  17. package/lib/chunks/{BCRM4BTA.js → AZ5LIJEO.js} +1 -1
  18. package/lib/chunks/{QMS4UKIK.js → BH4FA7AH.js} +5 -5
  19. package/lib/chunks/{MQUZ5IJ2.js → BIS2ZFGS.js} +1 -1
  20. package/lib/chunks/{IULINGO6.js → BOTTA3HA.js} +1 -1
  21. package/lib/chunks/{L4F2ERUL.js → BPJTNQBC.js} +1 -1
  22. package/lib/chunks/CER2D6ZD.js +20 -0
  23. package/lib/chunks/{NZE22F7Q.js → CR5TYFBN.js} +2 -2
  24. package/lib/chunks/{NCDX4IGX.js → CRJEY7P3.js} +1 -1
  25. package/lib/chunks/CZX7WE2R.js +7 -0
  26. package/lib/chunks/{EFB2YVY2.js → DM4EUYBB.js} +2 -2
  27. package/lib/chunks/{NBMSBQEL.js → DWXDCKZ7.js} +1 -1
  28. package/lib/chunks/DZT5NLUB.js +22 -0
  29. package/lib/chunks/{STAMDB3P.js → EHJ3FMW6.js} +1 -1
  30. package/lib/chunks/{O37B7ABT.js → FAFMGLT6.js} +1 -1
  31. package/lib/chunks/{YDQCJP4F.js → FDKY4PGX.js} +1 -1
  32. package/lib/chunks/FRQHCFKP.js +199 -0
  33. package/lib/chunks/{SBHCUK5I.js → GFSMOHUE.js} +1 -1
  34. package/lib/chunks/{YUEIHUPX.js → HMYFTLS7.js} +1 -1
  35. package/lib/chunks/{LNEXTJNF.js → HP7UD4BA.js} +1 -1
  36. package/lib/chunks/{YLRH4RVF.js → HRZLSSOF.js} +2 -2
  37. package/lib/chunks/{TR67FYLT.js → HTFKP5HH.js} +1 -1
  38. package/lib/chunks/{E3FBSKNS.js → I4TK6NG7.js} +1 -1
  39. package/lib/chunks/{VJHJJBVN.js → IQLQH23V.js} +1 -1
  40. package/lib/chunks/{DHP4BBTH.js → J2EPFEBO.js} +1 -1
  41. package/lib/chunks/{RIGQPR2I.js → JO76DPXR.js} +1 -1
  42. package/lib/chunks/{2UAA6O26.js → JOUEVI3E.js} +1 -1
  43. package/lib/chunks/{B5KSRXXW.js → JRVXIEVC.js} +1 -1
  44. package/lib/chunks/{MV3ZJ5HR.js → JZATGVUO.js} +5 -5
  45. package/lib/chunks/KFQC57GK.js +145 -0
  46. package/lib/chunks/{N37OGNC4.js → KJNBOXDI.js} +3 -3
  47. package/lib/chunks/{CN2ZOHYL.js → KLGUZBJO.js} +1 -1
  48. package/lib/chunks/KNMNSDHR.js +7 -0
  49. package/lib/chunks/{3DMXMP4K.js → L325HIGK.js} +1 -1
  50. package/lib/chunks/{MT4W54PL.js → LET2MPMU.js} +1 -1
  51. package/lib/chunks/{2CMKIFTE.js → LKNL5LEV.js} +1 -1
  52. package/lib/chunks/LY6BDOEF.js +7 -0
  53. package/lib/chunks/MJ2NI6MR.js +20 -0
  54. package/lib/chunks/N4GCIKY4.js +8 -0
  55. package/lib/chunks/NXREEI2S.js +98 -0
  56. package/lib/chunks/{6TE6AFQ3.js → OFIQ2EST.js} +1 -1
  57. package/lib/chunks/{CZS2ZXJ7.js → ORWIUECT.js} +1 -1
  58. package/lib/chunks/{T55LQK2H.js → P5T6BIKW.js} +1 -1
  59. package/lib/chunks/{2NVGTELR.js → QTSECOQB.js} +1 -1
  60. package/lib/chunks/{HHCU6T2V.js → QXBSAWH3.js} +1 -1
  61. package/lib/chunks/{EHQY7ZOF.js → QXXAC25O.js} +1 -1
  62. package/lib/chunks/{LD5MEXEL.js → R32HBYOH.js} +1 -1
  63. package/lib/chunks/SSEMMWPY.js +7 -0
  64. package/lib/chunks/T77BOGYV.js +14 -0
  65. package/lib/chunks/{QAPQYNI3.js → TH44RKLO.js} +1 -1
  66. package/lib/chunks/{FKKC7G6X.js → U2F3JOT2.js} +1 -1
  67. package/lib/chunks/{P7LM57HK.js → U4MI7HDM.js} +1 -1
  68. package/lib/chunks/{MYSYBBIO.js → UTEOWLD5.js} +1 -1
  69. package/lib/chunks/{B3GE7EIX.js → UVKUPD4U.js} +1 -1
  70. package/lib/chunks/{HAOBCQWB.js → VJZDR6KS.js} +84 -20
  71. package/lib/chunks/VPTYPV6P.js +7 -0
  72. package/lib/chunks/{E4MPGN3Z.js → W7TN2XCW.js} +1 -1
  73. package/lib/chunks/{2R2CXBRH.js → WO6IIVA3.js} +1 -1
  74. package/lib/chunks/{RLJVKAOL.js → XQEXWC5L.js} +1 -1
  75. package/lib/chunks/{YDGFDJ2K.js → XVS7B4RZ.js} +1 -1
  76. package/lib/chunks/{5ECOOGVW.js → YF4FMOTE.js} +1 -1
  77. package/lib/chunks/{WKDC6LN3.js → YWRFPTTI.js} +1 -1
  78. package/lib/chunks/{MYOQDPQZ.js → Z6GFQV2Y.js} +1 -1
  79. package/lib/chunks/{O6NMXFEP.js → ZXOX7NF2.js} +1 -1
  80. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  81. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  82. package/lib/eject-assets/generators/cli/index.ts +2 -2
  83. package/lib/eject-assets/generators/cli/render.ts +1 -1
  84. package/lib/eject-assets/generators/go/client.ts +1 -1
  85. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  86. package/lib/eject-assets/generators/go/index.ts +2 -2
  87. package/lib/eject-assets/generators/go/models.ts +7 -2
  88. package/lib/eject-assets/generators/go/naming.ts +1 -1
  89. package/lib/eject-assets/generators/go/operations.ts +1 -1
  90. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  91. package/lib/eject-assets/generators/go/types.ts +1 -1
  92. package/lib/eject-assets/generators/mock/faker.ts +17 -9
  93. package/lib/eject-assets/generators/mock/index.ts +4 -3
  94. package/lib/eject-assets/generators/mock/render.ts +128 -9
  95. package/lib/eject-assets/generators/mock/sample.ts +87 -4
  96. package/lib/eject-assets/generators/mock/values.ts +1 -1
  97. package/lib/eject-assets/generators/php/client.ts +1 -1
  98. package/lib/eject-assets/generators/php/descriptor.ts +10 -1
  99. package/lib/eject-assets/generators/php/index.ts +2 -2
  100. package/lib/eject-assets/generators/php/models.ts +8 -3
  101. package/lib/eject-assets/generators/php/naming.ts +1 -1
  102. package/lib/eject-assets/generators/php/operations.ts +11 -6
  103. package/lib/eject-assets/generators/php/pagination.ts +3 -2
  104. package/lib/eject-assets/generators/php/types.ts +12 -2
  105. package/lib/eject-assets/generators/python/client.ts +1 -1
  106. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  107. package/lib/eject-assets/generators/python/index.ts +3 -3
  108. package/lib/eject-assets/generators/python/models.ts +9 -3
  109. package/lib/eject-assets/generators/python/naming.ts +1 -1
  110. package/lib/eject-assets/generators/python/operations.ts +6 -5
  111. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  112. package/lib/eject-assets/generators/python/types.ts +1 -1
  113. package/lib/eject-assets/generators/swr/index.ts +2 -2
  114. package/lib/eject-assets/generators/swr/render.ts +1 -1
  115. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  116. package/lib/eject-assets/generators/tanstack-query/render.ts +6 -5
  117. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  118. package/lib/eject-assets/generators/transformers/render.ts +34 -7
  119. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  120. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  121. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  122. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  123. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  124. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  125. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  126. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  127. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  128. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  129. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  130. package/lib/eject-assets/generators/zod/index.ts +2 -2
  131. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  132. package/lib/eject-assets/skills/go-generator/SKILL.md +3 -0
  133. package/lib/eject-assets/skills/mock-generator/SKILL.md +22 -0
  134. package/lib/eject-assets/skills/php-generator/SKILL.md +9 -2
  135. package/lib/eject-assets/skills/python-generator/SKILL.md +6 -0
  136. package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +2 -1
  137. package/lib/eject-assets/skills/transformers-generator/SKILL.md +4 -0
  138. package/lib/eject-assets/skills/typescript-generator/SKILL.md +5 -0
  139. package/lib/index.js +5 -5
  140. package/lib/skills/redocly-cli/SKILL.md +20 -1
  141. package/package.json +1 -1
  142. package/lib/chunks/2Y7MGFQS.js +0 -105
  143. package/lib/chunks/BPDHBW3N.js +0 -7
  144. package/lib/chunks/EWU57NBY.js +0 -20
  145. package/lib/chunks/GKXY6U4S.js +0 -145
  146. package/lib/chunks/GMGZQR6Q.js +0 -7
  147. package/lib/chunks/JM7BMZLD.js +0 -13
  148. package/lib/chunks/K6VR5YNF.js +0 -22
  149. package/lib/chunks/LRMOPAZ4.js +0 -8
  150. package/lib/chunks/M6UVHV6D.js +0 -7
  151. package/lib/chunks/O72R3AD4.js +0 -20
  152. package/lib/chunks/RZ3FGCBT.js +0 -20
  153. package/lib/chunks/SBT63VHF.js +0 -7
  154. package/lib/chunks/UW4UC7ZI.js +0 -9
  155. package/lib/chunks/VQRJE4I2.js +0 -7
  156. package/lib/chunks/WACZWFKN.js +0 -19
  157. package/lib/chunks/WBWCX3LS.js +0 -199
  158. package/lib/chunks/WJXIZZA6.js +0 -7
@@ -1606,7 +1606,7 @@ from typing import Any, Dict, Tuple, get_args, get_origin, get_type_hints
1606
1606
  DISCRIMINATORS: Dict[Any, Tuple[str, Dict[str, Any]]] = {}
1607
1607
 
1608
1608
 
1609
- def decode(type_: Any, data: Any):
1609
+ def decode(type_: Any, data: Any) -> Any:
1610
1610
  """Best-effort hydration: wire data -> the annotated Python shape. Unknown or
1611
1611
  mismatched shapes pass through unchanged (the server is the source of truth)."""
1612
1612
  if data is None or type_ is Any or type_ is None:
@@ -1620,7 +1620,8 @@ def decode(type_: Any, data: Any):
1620
1620
  discriminator = DISCRIMINATORS.get(type_)
1621
1621
  if discriminator is not None and isinstance(data, dict):
1622
1622
  wire_property, mapping = discriminator
1623
- target = mapping.get(data.get(wire_property))
1623
+ value = data.get(wire_property)
1624
+ target = mapping.get(value) if isinstance(value, str) else None
1624
1625
  if target is not None:
1625
1626
  try:
1626
1627
  return decode(target, data)
@@ -1663,10 +1664,10 @@ def decode(type_: Any, data: Any):
1663
1664
  # subclasses \`ValueError\`, so union member probing above still works.
1664
1665
  if isinstance(type_, type) and hasattr(type_, "model_validate"):
1665
1666
  return type_.model_validate(data)
1666
- if dataclasses.is_dataclass(type_):
1667
+ if dataclasses.is_dataclass(type_) and isinstance(type_, type):
1667
1668
  hints = get_type_hints(type_)
1668
1669
  field_map = getattr(type_, "_field_map", {})
1669
- kwargs = {}
1670
+ kwargs: Dict[str, Any] = {}
1670
1671
  for field in dataclasses.fields(type_):
1671
1672
  wire = field_map.get(field.name, field.name)
1672
1673
  if isinstance(data, dict) and wire in data:
@@ -1675,7 +1676,7 @@ def decode(type_: Any, data: Any):
1675
1676
  return data
1676
1677
 
1677
1678
 
1678
- def encode(value: Any):
1679
+ def encode(value: Any) -> Any:
1679
1680
  """Python shape -> wire (JSON) shape; inverse of decode for request bodies."""
1680
1681
  # \`mode="json"\` resolves datetimes and enums the same way the branches below do,
1681
1682
  # and \`exclude_none\` matches the dataclass path: an unset optional is not sent.
@@ -1721,14 +1722,15 @@ import httpx
1721
1722
 
1722
1723
  from ._errors import ApiTimeoutError
1723
1724
 
1724
- T = TypeVar("T")
1725
+ # Not \`T\`: the runtime modules share one generated file, where \`_errors.py\` defines \`T\`.
1726
+ TData = TypeVar("TData")
1725
1727
 
1726
1728
 
1727
1729
  @dataclass
1728
- class Envelope(Generic[T]):
1730
+ class Envelope(Generic[TData]):
1729
1731
  """A *_with_headers() result: decoded body + coerced declared headers + raw response."""
1730
1732
 
1731
- data: T
1733
+ data: TData
1732
1734
  headers: Dict[str, Any]
1733
1735
  response: httpx.Response
1734
1736
 
@@ -2455,7 +2457,9 @@ type ProcessLike = {
2455
2457
  on?: (event: 'beforeExit', listener: () => void) => void;
2456
2458
  };
2457
2459
 
2458
- const activeWindows = new Set<() => Promise<void>>();
2460
+ type OnFailedSend = 'keep' | 'drop';
2461
+
2462
+ const activeWindows = new Set<(onFailedSend: OnFailedSend) => Promise<void>>();
2459
2463
  const pendingSends = new Set<Promise<void>>();
2460
2464
  let exitHookInstalled = false;
2461
2465
 
@@ -2474,8 +2478,12 @@ function telemetryDisabled(): boolean {
2474
2478
  return false;
2475
2479
  }
2476
2480
 
2477
- export async function flush(): Promise<void> {
2478
- for (const flushWindow of activeWindows) void flushWindow();
2481
+ export function flush(): Promise<void> {
2482
+ return flushWindows('keep');
2483
+ }
2484
+
2485
+ async function flushWindows(onFailedSend: OnFailedSend): Promise<void> {
2486
+ for (const flushWindow of activeWindows) void flushWindow(onFailedSend);
2479
2487
  await Promise.all(pendingSends);
2480
2488
  }
2481
2489
 
@@ -2507,32 +2515,51 @@ export function telemetry(options: TelemetryOptions): Middleware {
2507
2515
  let windowStart = 0;
2508
2516
  let timer: ReturnType<typeof setTimeout> | undefined;
2509
2517
 
2510
- async function flushWindow(): Promise<void> {
2518
+ function openWindow(): void {
2519
+ windowStart = Date.now();
2520
+ timer = setTimeout(() => void flushWindow('keep'), intervalMs);
2521
+ unrefTimer(timer);
2522
+ activeWindows.add(flushWindow);
2523
+ }
2524
+
2525
+ async function flushWindow(onFailedSend: OnFailedSend): Promise<void> {
2511
2526
  if (counts.size === 0) return;
2512
2527
  if (timer !== undefined) clearTimeout(timer);
2513
2528
  timer = undefined;
2514
2529
  activeWindows.delete(flushWindow);
2515
2530
  const events = toEvents(counts, windowStart, Date.now() - windowStart, options.sdkName, sdk);
2531
+ const sentCounts = counts;
2532
+ const sentWindowStart = windowStart;
2516
2533
  counts = new Map();
2517
2534
  if (telemetryDisabled()) return;
2535
+ let action: OnFailedSend | undefined;
2518
2536
  const send = Promise.resolve()
2519
2537
  .then(() => sink(events))
2520
- .catch(() => undefined);
2538
+ .catch((error: unknown) => {
2539
+ action = actionForFailedSend(error);
2540
+ });
2521
2541
  pendingSends.add(send);
2522
2542
  await send;
2523
2543
  pendingSends.delete(send);
2544
+ if (action !== 'keep' || onFailedSend === 'drop') return;
2545
+
2546
+ if (counts.size === 0) openWindow();
2547
+ if (sentWindowStart < windowStart) windowStart = sentWindowStart;
2548
+ for (const [operationId, sentOperation] of sentCounts) {
2549
+ const operation = counts.get(operationId);
2550
+ if (operation === undefined) {
2551
+ counts.set(operationId, sentOperation);
2552
+ } else {
2553
+ addCounts(operation, sentOperation);
2554
+ }
2555
+ }
2524
2556
  }
2525
2557
 
2526
2558
  installExitHook();
2527
2559
 
2528
2560
  return {
2529
2561
  onSettled: (ctx, call) => {
2530
- if (counts.size === 0) {
2531
- windowStart = Date.now();
2532
- timer = setTimeout(() => void flushWindow(), intervalMs);
2533
- unrefTimer(timer);
2534
- activeWindows.add(flushWindow);
2535
- }
2562
+ if (counts.size === 0) openWindow();
2536
2563
  let operation = counts.get(ctx.operation.id);
2537
2564
  if (operation === undefined) {
2538
2565
  operation = emptyCounts();
@@ -2546,7 +2573,9 @@ export function telemetry(options: TelemetryOptions): Middleware {
2546
2573
  function installExitHook(): void {
2547
2574
  if (exitHookInstalled) return;
2548
2575
  exitHookInstalled = true;
2549
- nodeProcess()?.on?.('beforeExit', () => void flush());
2576
+ // Node emits \`beforeExit\` again after each send at exit.
2577
+ // Kept counts then cause one more send each time, so a failed send here drops its counts.
2578
+ nodeProcess()?.on?.('beforeExit', () => void flushWindows('drop'));
2550
2579
  }
2551
2580
 
2552
2581
  function unrefTimer(timer: unknown): void {
@@ -2578,6 +2607,18 @@ function record(operation: OperationCounts, call: SettledCall): void {
2578
2607
  }
2579
2608
  }
2580
2609
 
2610
+ function addCounts(target: OperationCounts, source: OperationCounts): void {
2611
+ target.calls += source.calls;
2612
+ target.attempts += source.attempts;
2613
+ target.durationSumMs += source.durationSumMs;
2614
+ for (const statusClass of STATUS_CLASSES) {
2615
+ target.status[statusClass] += source.status[statusClass];
2616
+ }
2617
+ for (const { bucket } of LATENCY_BUCKETS) {
2618
+ target.latency[bucket] += source.latency[bucket];
2619
+ }
2620
+ }
2621
+
2581
2622
  function statusClass(call: SettledCall): StatusClass {
2582
2623
  if (call.response === undefined) {
2583
2624
  if (call.error instanceof Error && call.error.name === 'TimeoutError') return 'timeout';
@@ -2639,6 +2680,29 @@ async function sendOtlp(endpoint: string, events: SdkUsageEvent[]): Promise<void
2639
2680
  signal: AbortSignal.timeout(SEND_TIMEOUT_MS),
2640
2681
  });
2641
2682
  await response.body?.cancel();
2683
+ if (!response.ok) {
2684
+ throw new RejectedSendError(response.status);
2685
+ }
2686
+ }
2687
+
2688
+ class RejectedSendError extends Error {
2689
+ public readonly status: number;
2690
+ constructor(status: number) {
2691
+ super(\`The telemetry endpoint answered \${status}.\`);
2692
+ this.name = 'RejectedSendError';
2693
+ this.status = status;
2694
+ }
2695
+ }
2696
+
2697
+ function actionForFailedSend(error: unknown): OnFailedSend {
2698
+ // The endpoint can have stored the counts of a send that timed out.
2699
+ if (error instanceof Error && error.name === 'TimeoutError') return 'drop';
2700
+ if (error instanceof RejectedSendError) {
2701
+ if (error.status === 408 || error.status === 429 || error.status >= 500) return 'keep';
2702
+ // The endpoint refuses the same counts again.
2703
+ return 'drop';
2704
+ }
2705
+ return 'keep';
2642
2706
  }
2643
2707
 
2644
2708
  type OtlpValue = { stringValue: string } | { intValue: number } | { doubleValue: number };
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a}from"./HRZLSSOF.js";import"./5AVTCY6F.js";import"./L325HIGK.js";import"./R32HBYOH.js";import"./DM4EUYBB.js";import"./5CR6AOLY.js";import"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as tanstackQueryGenerator};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as c}from"./FKKC7G6X.js";import{h as s,l as a}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{Z as t,fa as e,la as i}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function y({argv:r,config:l,version:d}){let o=s(l,r.residency);try{let n=new a(d);r.verbose&&(e.info(`OAuth client initialized.
7
+ import{a as c}from"./U2F3JOT2.js";import{h as s,l as a}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{Z as t,fa as e,la as i}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function y({argv:r,config:l,version:d}){let o=s(l,r.residency);try{let n=new a(d);r.verbose&&(e.info(`OAuth client initialized.
8
8
  `),e.info(`Local credentials file path: ${n.credentialsFilePath}
9
9
  `)),await n.login(o,c),e.output(t(`\u2705 Logged in
10
10
 
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as we,e as Re,f as be,g as k,h as A,i as Oe,j as Ie,k as S,l as x,m as Pe,n as ke,v as Ae,w as xe}from"./LRMOPAZ4.js";import{$ as T,H as lt,S as le,V as ft,W as fe,X as g,Y as E,Z as me,_ as q,ba as b,c as p,da as w,fa as R,ga as he,ha as ge,ia as ye,ja as Se,oa as ve,p as de,v as pe}from"./WBWCX3LS.js";import{e as ce}from"./RFWIIJFG.js";import Ce from"node:path";function O(t){return t?t.trim():""}function L(t){let e=O(t.operationId)||O(t.path);return[O(t.ruleId),O(t.severity),O(t.message),e,O(t.target),O(t.schemaPath)].join("")}var N=t=>fe(b(t));function mt(t){return t==="error"?"error":t==="warning"?"warning":"note"}function ht(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
7
+ import{a as we,e as Re,f as be,g as k,h as A,i as Oe,j as Ie,k as S,l as x,m as Pe,n as ke,v as Ae,w as xe}from"./N4GCIKY4.js";import{$ as T,H as lt,S as le,V as ft,W as fe,X as g,Y as E,Z as me,_ as q,ba as b,c as p,da as w,fa as R,ga as he,ha as ge,ia as ye,ja as Se,oa as ve,p as de,v as pe}from"./FRQHCFKP.js";import{e as ce}from"./RFWIIJFG.js";import Ce from"node:path";function O(t){return t?t.trim():""}function L(t){let e=O(t.operationId)||O(t.path);return[O(t.ruleId),O(t.severity),O(t.message),e,O(t.target),O(t.schemaPath)].join("")}var N=t=>fe(b(t));function mt(t){return t==="error"?"error":t==="warning"?"warning":"note"}function ht(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
8
8
  `)?e:`"${e.replace(/"/g,'""')}"`}function gt(t){return Ce.isAbsolute(t)?Ce.relative(process.cwd(),t)||".":t}function yt(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function St(t){return Object.entries(t).sort((e,n)=>{let r=n[1]-e[1];return r!==0?r:e[0].localeCompare(n[0])})}function vt(t){let e=[],n=new Map;for(let r of t){let s=L({ruleId:r.ruleId,severity:r.severity,message:r.message,operationId:r.operationId,path:r.path,target:r.target,schemaPath:r.schemaPath}),i=n.get(s);if(i!==void 0){e[i].occurrences+=1;continue}n.set(s,e.length),e.push({finding:r,occurrences:1})}return e}function wt(t){let e=vt(t.findings).map(r=>({occurrences:r.occurrences,exchangeIndex:r.finding.exchangeIndex,ruleId:r.finding.ruleId,severity:r.finding.severity,category:r.finding.category,message:r.finding.message,operationId:r.finding.operationId,specSource:r.finding.specSource,target:r.finding.target,schemaPath:r.finding.schemaPath,dataPath:r.finding.dataPath,details:r.finding.details,method:r.finding.method,url:r.finding.url,path:r.finding.path,status:r.finding.status})),n={run:{id:t.runId,specSource:t.meta.specSource,trafficPath:t.meta.trafficPath,format:t.meta.format,matchMode:t.meta.matchMode,server:t.meta.server,totalExchanges:t.summary.totalExchanges,documentedExchanges:t.summary.documentedExchanges,undocumentedExchanges:t.summary.undocumentedExchanges,skippedExchanges:t.summary.skippedExchanges,findingsBySeverity:t.summary.findingsBySeverity,findingsByRule:t.summary.findingsByRule,totalProblems:t.summary.totalProblemGroups,durationMs:t.summary.durationMs},problems:e};return`${JSON.stringify(n,null,2)}
9
9
  `}function Rt(t){let e=["run_id","finding_id","exchange_index","severity","category","rule_id","message","method","path","url","status","operation_id","spec_source","target","schema_path","data_path"],n=t.findings.map(s=>[t.runId,s.id,s.exchangeIndex,s.severity,s.category,s.ruleId,s.message,s.method,s.path,s.url,s.status,s.operationId,s.specSource,s.target,s.schemaPath,s.dataPath]);return`${[e,...n].map(s=>s.map(ht).join(",")).join(`
10
10
  `)}
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{fa as t}from"./WBWCX3LS.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
7
+ import{fa as t}from"./FRQHCFKP.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
8
8
  `);return}this.intervalId===null&&(this.intervalId=setInterval(()=>{this.showFrame()},100))}}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,t.info("\r")),this.message=""}};function h(i){i.stop(),e.stderr.isTTY&&t.info("\x1B[2K")}function m(i,r){let[s]=r.inFlight;if(!s)return;let a=r.inFlight.size>1?` (+${r.inFlight.size-1} more)`:"";i.start(`[${r.position}/${r.total}] ${r.action} ${s}${a}`)}export{n as a,h as b,m as c};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as k,f as v}from"./QMS4UKIK.js";import{I as A,J as S,K as y,S as f,T as w,aa as d,ea as l,fa as n,ha as x,ia as h,ja as O,la as g,oa as b,p as u,v as p}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as F}from"perf_hooks";function I(o){let t=Object.fromEntries(Object.entries(o).map(([s,{metric:e,total:r,counts:a}])=>[s,{metric:e,total:r,counts:a}]));n.output(JSON.stringify(t,null,2))}function P(o){let t=`| Feature | Count |
7
+ import{b as k,f as v}from"./BH4FA7AH.js";import{I as A,J as S,K as y,S as f,T as w,aa as d,ea as l,fa as n,ha as x,ia as h,ja as O,la as g,oa as b,p as u,v as p}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as F}from"perf_hooks";function I(o){let t=Object.fromEntries(Object.entries(o).map(([s,{metric:e,total:r,counts:a}])=>[s,{metric:e,total:r,counts:a}]));n.output(JSON.stringify(t,null,2))}function P(o){let t=`| Feature | Count |
8
8
  | --- | --- |
9
9
  `,s=[];for(let{metric:e,total:r,counts:a}of Object.values(o)){t+=`| ${e} | ${r} |
10
10
  `;let c=Object.entries(a??{});c.length&&s.push(`
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as A,c as F,d as S,e as l}from"./YDQCJP4F.js";import"./RLJVKAOL.js";import{e as $,g as x,r as I,s as P}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{f as p}from"./QMS4UKIK.js";import{Z as w,fa as n,k as u}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
7
+ import{b as A,c as F,d as S,e as l}from"./FDKY4PGX.js";import"./XQEXWC5L.js";import{e as $,g as x,r as I,s as P}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{f as p}from"./BH4FA7AH.js";import{Z as w,fa as n,k as u}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
8
8
  `)}),!e.length)return p("push",h,"No files to upload");let m=await I({domain:f,apiKey:i,organization:g,project:d,mountPath:z,files:e,defaultBranch:t["default-branch"],commit:{message:t.message,branchName:t.branch,sha:t["commit-sha"],url:t["commit-url"],createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:U(t.author)},version:c,replace:t.replace,onUploadStart:a=>{n.info(`Uploading to ${a.mountPath} ${e.length} ${u("file",e.length)}:
9
9
  `)},onSunsetWarning:a=>s.push(a),onSlugDeprecated:S});r=m.pushId,y=m.organizationId,b=m.projectId}catch(i){l("push",s),F("\u2717 File upload failed.",i)}for(let i of e)n.info(w(`\u2713 ${i.name}
10
10
  `));return n.info(`
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c as r}from"./WBWCX3LS.js";var s="components",p="paths",i="webhooks",O="x-webhooks",c="channels",f="operations";function e(o,n){if(r(o)){n(o);for(let t of Object.keys(o))e(o[t],n)}else if(Array.isArray(o))for(let t of o)e(t,n)}function S(o){return o.startsWith(`#/${s}/`)}export{s as a,p as b,i as c,O as d,c as e,f,e as g,S as h};
7
+ import{c as r}from"./FRQHCFKP.js";var s="components",p="paths",i="webhooks",O="x-webhooks",c="channels",f="operations";function e(o,n){if(r(o)){n(o);for(let t of Object.keys(o))e(o[t],n)}else if(Array.isArray(o))for(let t of o)e(t,n)}function S(o){return o.startsWith(`#/${s}/`)}export{s as a,p as b,i as c,O as d,c as e,f,e as g,S as h};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as q}from"./FKKC7G6X.js";import{A as _,h as H,l as B,v as z,x as K,y as V,z as Z}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{b as J,d as M,e as Y,v as L}from"./QMS4UKIK.js";import{$ as b,S as N,W as v,Y as O,Z as A,_ as j,ba as y,ca as C,da as R,fa as e,k as h,la as w,ma as D,ra as S,ua as g}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{dirname as le}from"node:path";function W(r,t,o,n){n&&e.info(C(v(`
7
+ import{a as q}from"./U2F3JOT2.js";import{A as _,h as H,l as B,v as z,x as K,y as V,z as Z}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{b as J,d as M,e as Y,v as L}from"./BH4FA7AH.js";import{$ as b,S as N,W as v,Y as O,Z as A,_ as j,ba as y,ca as C,da as R,fa as e,k as h,la as w,ma as D,ra as S,ua as g}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{dirname as le}from"node:path";function W(r,t,o,n){n&&e.info(C(v(`
8
8
  \u2611\uFE0F Achieved Level: ${y(o)}
9
9
 
10
10
  `))),e.output(`<?xml version="1.0" encoding="UTF-8"?>
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./QMS4UKIK.js";import{$ as w,da as l,fa as n,k as x,ma as h,sa as A,ta as g,va as k}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
7
+ import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./BH4FA7AH.js";import{$ as w,da as l,fa as n,k as x,ma as h,sa as A,ta as g,va as k}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
8
8
 
9
9
  `),f===void 0?n.info(l(`validating ${m(o)}...
10
10
  `)):n.info(l(`validating ${m(o)} using lint rules for api '${f}'...
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "cli" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "cli" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator cli --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "cli" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "cli" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator cli --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "cli" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "cli" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator cli --update`.
@@ -86,5 +86,5 @@ export default {
86
86
  docs: cliDocs,
87
87
  requires: ["typescript","zod"],
88
88
  errorModes: ["throw"],
89
- requiresGenerator: '^0.7.11',
89
+ requiresGenerator: '^0.7.13',
90
90
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "cli" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "cli" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator cli --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -332,5 +332,5 @@ export default {
332
332
  "argsStyle": "inputs follow the target language's own idiom",
333
333
  "importExt": "the generated file has no relative imports"
334
334
  },
335
- requiresGenerator: '^0.7.11',
335
+ requiresGenerator: '^0.7.13',
336
336
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -26,11 +26,16 @@ function writeStruct(
26
26
  dateType: DateType,
27
27
  description?: string
28
28
  ): void {
29
+ // A response never carries a `writeOnly` property, and responses decode into this same
30
+ // struct, so the property is optional even when the description requires it.
31
+ const fields = properties.map((property) =>
32
+ property.writeOnly ? { ...property, required: false } : property
33
+ );
29
34
  printer.doc(exported(name), description);
30
35
  printer.block(
31
36
  `type ${exported(name)} struct {`,
32
37
  () => {
33
- for (const property of properties) {
38
+ for (const property of fields) {
34
39
  const field = exported(property.name);
35
40
  let fieldType = goType(property.schema, dateType);
36
41
  let tag = `\`json:"${property.name}"\``;
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "go" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "go" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator go --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "mock" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "mock" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator mock --update`.
@@ -22,7 +22,7 @@ import {
22
22
  } from '@redocly/client-generator';
23
23
  import { codeLiteral } from '@redocly/client-generator/printers/typescript';
24
24
 
25
- import { splitIntersection } from './sample.ts';
25
+ import { numericRange, omitsFromResponse, splitIntersection } from './sample.ts';
26
26
  import { expr, isObjectValue, type MockEntry, type MockValue, objectValue } from './values.ts';
27
27
 
28
28
  /** The faker-call value for an IR schema. Refs resolve against `schemas`;
@@ -69,6 +69,7 @@ function walk(
69
69
  case 'object':
70
70
  return objectValue(
71
71
  schema.properties.flatMap((p): MockEntry[] => {
72
+ if (omitsFromResponse(p)) return [];
72
73
  const value = walk(p.schema, byName, visiting, dateType);
73
74
  // A cyclic optional property is omitted; a cyclic required property is
74
75
  // uninhabitable, so null is the only stand-in.
@@ -142,8 +143,8 @@ function scalarExpr(
142
143
  ): string {
143
144
  if (meta?.format === 'binary') return 'new Blob([])';
144
145
  if (scalar === 'boolean') return 'faker.datatype.boolean()';
145
- if (scalar === 'integer') return `faker.number.int(${boundsArg(meta)})`;
146
- if (scalar === 'number') return `faker.number.float(${boundsArg(meta)})`;
146
+ if (scalar === 'integer') return `faker.number.int(${boundsArg(scalar, meta)})`;
147
+ if (scalar === 'number') return `faker.number.float(${boundsArg(scalar, meta)})`;
147
148
  switch (meta?.format) {
148
149
  case 'email':
149
150
  return 'faker.internet.email()';
@@ -173,13 +174,20 @@ function dateExpr(dateType: DateType, dateOnly: boolean): string {
173
174
  return dateOnly ? `${iso}.slice(0, 10)` : iso;
174
175
  }
175
176
 
176
- /** `{ min, max }` arg for a bounded numeric, or empty when neither bound is set. */
177
- function boundsArg(meta: SchemaMetadata | undefined): string {
177
+ /**
178
+ * `{ min, max, multipleOf }` for a bounded numeric, or empty when unbounded. Both ends are
179
+ * always set, because faker's defaults (`0`, and `1` for floats) can sit on the wrong side
180
+ * of a single bound: the missing end is 100 steps away from the set one.
181
+ */
182
+ function boundsArg(scalar: 'integer' | 'number', meta: SchemaMetadata | undefined): string {
183
+ const { min, max, step = 1 } = numericRange(scalar, meta);
184
+ if (min === undefined && max === undefined) return '';
178
185
  const props = [
179
- ...(meta?.minimum !== undefined ? [`min: ${meta.minimum}`] : []),
180
- ...(meta?.maximum !== undefined ? [`max: ${meta.maximum}`] : []),
186
+ `min: ${min ?? (max ?? 0) - 100 * step}`,
187
+ `max: ${max ?? (min ?? 0) + 100 * step}`,
188
+ ...(meta?.multipleOf !== undefined ? [`multipleOf: ${meta.multipleOf}`] : []),
181
189
  ];
182
- return props.length > 0 ? `{ ${props.join(', ')} }` : '';
190
+ return `{ ${props.join(', ')} }`;
183
191
  }
184
192
 
185
193
  /** `faker.helpers.multiple(() => <item>, { count: 1 })` — one element keeps output small.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.11 — the built-in "mock" generator.
1
+ // Ejected from @redocly/client-generator@0.7.13 — the built-in "mock" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator mock --update`.
@@ -13,13 +13,14 @@ import { renderMockModule } from './render.ts';
13
13
  * sdk client stays dependency-free. Output-mode-agnostic in v1 — one module beside
14
14
  * the client. Emits nothing when there are no operations.
15
15
  */
16
- export const mockGenerator: Generator = ({ model, output, banner, emit }) => {
16
+ export const mockGenerator: Generator = ({ model, output, banner, emit, pagination }) => {
17
17
  const header = banner.map((line) => `// ${line}`).join('\n');
18
18
  const content = renderMockModule(model, {
19
19
  sdkModule: `./${output.stem}.${emit.importExt ?? 'js'}`,
20
20
  dateType: emit.dateType,
21
21
  mockData: emit.mockData,
22
22
  mockSeed: emit.mockSeed,
23
+ pagination,
23
24
  });
24
25
  if (content === '') return [];
25
26
  return [
@@ -31,5 +32,5 @@ export default {
31
32
  name: 'mock',
32
33
  run: mockGenerator,
33
34
  requires: ["typescript"],
34
- requiresGenerator: '^0.7.11',
35
+ requiresGenerator: '^0.7.13',
35
36
  };