@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.
- package/THIRD_PARTY_NOTICES +3 -3
- package/lib/chunks/{V6VNRABV.js → 2TG3DP4I.js} +1 -1
- package/lib/chunks/{BU4AMVHN.js → 2ZEKFWJQ.js} +1 -1
- package/lib/chunks/{LS3G7CUH.js → 3EQNI6CT.js} +1 -1
- package/lib/chunks/{TXSBWL3Y.js → 3FR3456Q.js} +1 -1
- package/lib/chunks/{VXD5O25A.js → 3VOQMXIZ.js} +1 -1
- package/lib/chunks/4H3DPQDW.js +7 -0
- package/lib/chunks/4S6LRPCX.js +20 -0
- package/lib/chunks/{QB6CQ2CV.js → 5AVTCY6F.js} +1 -1
- package/lib/chunks/{JCP37EY3.js → 5CR6AOLY.js} +59 -25
- package/lib/chunks/{G2M6SQCS.js → 5HPO77VR.js} +2 -2
- package/lib/chunks/6X42UQ3O.js +20 -0
- package/lib/chunks/{QTGTCBFK.js → 7GADNOVY.js} +1 -1
- package/lib/chunks/{SXIMN47K.js → 7JS7JGWP.js} +1 -1
- package/lib/chunks/{EH6VW7JO.js → ADACRYTN.js} +1 -1
- package/lib/chunks/{PF43QQZA.js → AXGFQS75.js} +2 -2
- package/lib/chunks/{BCRM4BTA.js → AZ5LIJEO.js} +1 -1
- package/lib/chunks/{QMS4UKIK.js → BH4FA7AH.js} +5 -5
- package/lib/chunks/{MQUZ5IJ2.js → BIS2ZFGS.js} +1 -1
- package/lib/chunks/{IULINGO6.js → BOTTA3HA.js} +1 -1
- package/lib/chunks/{L4F2ERUL.js → BPJTNQBC.js} +1 -1
- package/lib/chunks/CER2D6ZD.js +20 -0
- package/lib/chunks/{NZE22F7Q.js → CR5TYFBN.js} +2 -2
- package/lib/chunks/{NCDX4IGX.js → CRJEY7P3.js} +1 -1
- package/lib/chunks/CZX7WE2R.js +7 -0
- package/lib/chunks/{EFB2YVY2.js → DM4EUYBB.js} +2 -2
- package/lib/chunks/{NBMSBQEL.js → DWXDCKZ7.js} +1 -1
- package/lib/chunks/DZT5NLUB.js +22 -0
- package/lib/chunks/{STAMDB3P.js → EHJ3FMW6.js} +1 -1
- package/lib/chunks/{O37B7ABT.js → FAFMGLT6.js} +1 -1
- package/lib/chunks/{YDQCJP4F.js → FDKY4PGX.js} +1 -1
- package/lib/chunks/FRQHCFKP.js +199 -0
- package/lib/chunks/{SBHCUK5I.js → GFSMOHUE.js} +1 -1
- package/lib/chunks/{YUEIHUPX.js → HMYFTLS7.js} +1 -1
- package/lib/chunks/{LNEXTJNF.js → HP7UD4BA.js} +1 -1
- package/lib/chunks/{YLRH4RVF.js → HRZLSSOF.js} +2 -2
- package/lib/chunks/{TR67FYLT.js → HTFKP5HH.js} +1 -1
- package/lib/chunks/{E3FBSKNS.js → I4TK6NG7.js} +1 -1
- package/lib/chunks/{VJHJJBVN.js → IQLQH23V.js} +1 -1
- package/lib/chunks/{DHP4BBTH.js → J2EPFEBO.js} +1 -1
- package/lib/chunks/{RIGQPR2I.js → JO76DPXR.js} +1 -1
- package/lib/chunks/{2UAA6O26.js → JOUEVI3E.js} +1 -1
- package/lib/chunks/{B5KSRXXW.js → JRVXIEVC.js} +1 -1
- package/lib/chunks/{MV3ZJ5HR.js → JZATGVUO.js} +5 -5
- package/lib/chunks/KFQC57GK.js +145 -0
- package/lib/chunks/{N37OGNC4.js → KJNBOXDI.js} +3 -3
- package/lib/chunks/{CN2ZOHYL.js → KLGUZBJO.js} +1 -1
- package/lib/chunks/KNMNSDHR.js +7 -0
- package/lib/chunks/{3DMXMP4K.js → L325HIGK.js} +1 -1
- package/lib/chunks/{MT4W54PL.js → LET2MPMU.js} +1 -1
- package/lib/chunks/{2CMKIFTE.js → LKNL5LEV.js} +1 -1
- package/lib/chunks/LY6BDOEF.js +7 -0
- package/lib/chunks/MJ2NI6MR.js +20 -0
- package/lib/chunks/N4GCIKY4.js +8 -0
- package/lib/chunks/NXREEI2S.js +98 -0
- package/lib/chunks/{6TE6AFQ3.js → OFIQ2EST.js} +1 -1
- package/lib/chunks/{CZS2ZXJ7.js → ORWIUECT.js} +1 -1
- package/lib/chunks/{T55LQK2H.js → P5T6BIKW.js} +1 -1
- package/lib/chunks/{2NVGTELR.js → QTSECOQB.js} +1 -1
- package/lib/chunks/{HHCU6T2V.js → QXBSAWH3.js} +1 -1
- package/lib/chunks/{EHQY7ZOF.js → QXXAC25O.js} +1 -1
- package/lib/chunks/{LD5MEXEL.js → R32HBYOH.js} +1 -1
- package/lib/chunks/SSEMMWPY.js +7 -0
- package/lib/chunks/T77BOGYV.js +14 -0
- package/lib/chunks/{QAPQYNI3.js → TH44RKLO.js} +1 -1
- package/lib/chunks/{FKKC7G6X.js → U2F3JOT2.js} +1 -1
- package/lib/chunks/{P7LM57HK.js → U4MI7HDM.js} +1 -1
- package/lib/chunks/{MYSYBBIO.js → UTEOWLD5.js} +1 -1
- package/lib/chunks/{B3GE7EIX.js → UVKUPD4U.js} +1 -1
- package/lib/chunks/{HAOBCQWB.js → VJZDR6KS.js} +84 -20
- package/lib/chunks/VPTYPV6P.js +7 -0
- package/lib/chunks/{E4MPGN3Z.js → W7TN2XCW.js} +1 -1
- package/lib/chunks/{2R2CXBRH.js → WO6IIVA3.js} +1 -1
- package/lib/chunks/{RLJVKAOL.js → XQEXWC5L.js} +1 -1
- package/lib/chunks/{YDGFDJ2K.js → XVS7B4RZ.js} +1 -1
- package/lib/chunks/{5ECOOGVW.js → YF4FMOTE.js} +1 -1
- package/lib/chunks/{WKDC6LN3.js → YWRFPTTI.js} +1 -1
- package/lib/chunks/{MYOQDPQZ.js → Z6GFQV2Y.js} +1 -1
- package/lib/chunks/{O6NMXFEP.js → ZXOX7NF2.js} +1 -1
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +1 -1
- package/lib/eject-assets/generators/go/client.ts +1 -1
- package/lib/eject-assets/generators/go/descriptor.ts +1 -1
- package/lib/eject-assets/generators/go/index.ts +2 -2
- package/lib/eject-assets/generators/go/models.ts +7 -2
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +17 -9
- package/lib/eject-assets/generators/mock/index.ts +4 -3
- package/lib/eject-assets/generators/mock/render.ts +128 -9
- package/lib/eject-assets/generators/mock/sample.ts +87 -4
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +10 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +8 -3
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +11 -6
- package/lib/eject-assets/generators/php/pagination.ts +3 -2
- package/lib/eject-assets/generators/php/types.ts +12 -2
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +3 -3
- package/lib/eject-assets/generators/python/models.ts +9 -3
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +6 -5
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +6 -5
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +34 -7
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +1 -1
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/eject-assets/skills/go-generator/SKILL.md +3 -0
- package/lib/eject-assets/skills/mock-generator/SKILL.md +22 -0
- package/lib/eject-assets/skills/php-generator/SKILL.md +9 -2
- package/lib/eject-assets/skills/python-generator/SKILL.md +6 -0
- package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +2 -1
- package/lib/eject-assets/skills/transformers-generator/SKILL.md +4 -0
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +5 -0
- package/lib/index.js +5 -5
- package/lib/skills/redocly-cli/SKILL.md +20 -1
- package/package.json +1 -1
- package/lib/chunks/2Y7MGFQS.js +0 -105
- package/lib/chunks/BPDHBW3N.js +0 -7
- package/lib/chunks/EWU57NBY.js +0 -20
- package/lib/chunks/GKXY6U4S.js +0 -145
- package/lib/chunks/GMGZQR6Q.js +0 -7
- package/lib/chunks/JM7BMZLD.js +0 -13
- package/lib/chunks/K6VR5YNF.js +0 -22
- package/lib/chunks/LRMOPAZ4.js +0 -8
- package/lib/chunks/M6UVHV6D.js +0 -7
- package/lib/chunks/O72R3AD4.js +0 -20
- package/lib/chunks/RZ3FGCBT.js +0 -20
- package/lib/chunks/SBT63VHF.js +0 -7
- package/lib/chunks/UW4UC7ZI.js +0 -9
- package/lib/chunks/VQRJE4I2.js +0 -7
- package/lib/chunks/WACZWFKN.js +0 -19
- package/lib/chunks/WBWCX3LS.js +0 -199
- 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
|
-
|
|
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
|
|
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[
|
|
1730
|
+
class Envelope(Generic[TData]):
|
|
1729
1731
|
"""A *_with_headers() result: decoded body + coerced declared headers + raw response."""
|
|
1730
1732
|
|
|
1731
|
-
data:
|
|
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
|
-
|
|
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
|
|
2478
|
-
|
|
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
|
-
|
|
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(() =>
|
|
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
|
-
|
|
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"./
|
|
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"./
|
|
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"./
|
|
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"./
|
|
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"./
|
|
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"./
|
|
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"./
|
|
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"./
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
89
|
+
requiresGenerator: '^0.7.13',
|
|
90
90
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from @redocly/client-generator@0.7.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
335
|
+
requiresGenerator: '^0.7.13',
|
|
336
336
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from @redocly/client-generator@0.7.
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
/**
|
|
177
|
-
|
|
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
|
-
|
|
180
|
-
|
|
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
|
|
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.
|
|
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.
|
|
35
|
+
requiresGenerator: '^0.7.13',
|
|
35
36
|
};
|