@redocly/cli 2.47.0 → 2.48.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/lib/chunks/{TEQA5OM7.js → 2GJPOM5H.js} +1 -1
- package/lib/chunks/{W2NJCZOS.js → 3CR6IHZV.js} +1 -1
- package/lib/chunks/3JJEI7CJ.js +456 -0
- package/lib/chunks/{QRD3XQNU.js → 3M6ARSHY.js} +1 -1
- package/lib/chunks/3X52NOC5.js +7 -0
- package/lib/chunks/46OWEERC.js +19 -0
- package/lib/chunks/4IA3ZTGK.js +20 -0
- package/lib/chunks/{TO2KJ36N.js → 5E3L4HJN.js} +1 -1
- package/lib/chunks/5EG7SNNU.js +177 -0
- package/lib/chunks/5L3FH5WQ.js +16 -0
- package/lib/chunks/5L5WOOWA.js +7 -0
- package/lib/chunks/5ZEWVWOC.js +14 -0
- package/lib/chunks/6O3ZHZZ2.js +7 -0
- package/lib/chunks/{KEUH3PST.js → AJZAID3R.js} +1 -1
- package/lib/chunks/BD5JG7YZ.js +7 -0
- package/lib/chunks/{B6HS7CVY.js → BEOYUN4L.js} +48 -48
- package/lib/chunks/CF5YCHNA.js +7 -0
- package/lib/chunks/D27SC2KR.js +90 -0
- package/lib/chunks/{SN2EC2ZR.js → DYAVWTVD.js} +1 -1
- package/lib/chunks/E35Q6YJN.js +7 -0
- package/lib/chunks/EB2V4VMP.js +7 -0
- package/lib/chunks/{QVV2EKMT.js → FL3CA53Z.js} +1 -1
- package/lib/chunks/FVBSRIWC.js +18 -0
- package/lib/chunks/G2XR6TRU.js +67 -0
- package/lib/chunks/G3YJARF7.js +57 -0
- package/lib/chunks/GA6WYGKY.js +7 -0
- package/lib/chunks/GBRES7WG.js +5400 -0
- package/lib/chunks/GHPAE4DZ.js +20 -0
- package/lib/chunks/{SL6AH3N2.js → GJRJZYC4.js} +1 -1
- package/lib/chunks/{REBHK2JR.js → GOJNDGZT.js} +1 -1
- package/lib/chunks/HJYFWIVE.js +9 -0
- package/lib/chunks/HLZCPNF7.js +16 -0
- package/lib/chunks/KIQI3UBS.js +177 -0
- package/lib/chunks/KNPQJVYA.js +14 -0
- package/lib/chunks/L3TZNNJJ.js +13 -0
- package/lib/chunks/{34J2ZJDK.js → LUC2DWUK.js} +1 -1
- package/lib/chunks/MBHFDTYI.js +78 -0
- package/lib/chunks/NB54XRRU.js +10 -0
- package/lib/chunks/NSIQWNYL.js +7 -0
- package/lib/chunks/NWMTC4AN.js +7 -0
- package/lib/chunks/PFYPTG4G.js +7 -0
- package/lib/chunks/{5NR4DJW4.js → PVM7EVWV.js} +1 -1
- package/lib/chunks/Q5FNL2RM.js +22 -0
- package/lib/chunks/QW5MTOU2.js +22 -0
- package/lib/chunks/REFX2EKS.js +13 -0
- package/lib/chunks/S4GQKQ5G.js +7 -0
- package/lib/chunks/SGBB4RNM.js +11 -0
- package/lib/chunks/{YQW463Z7.js → SPPRUUK3.js} +1 -1
- package/lib/chunks/SQVG3CEM.js +8 -0
- package/lib/chunks/TSB6PODJ.js +13 -0
- package/lib/chunks/U2A6GEAN.js +42 -0
- package/lib/chunks/UDBINQ2S.js +42 -0
- package/lib/chunks/UKSQ7B5H.js +2268 -0
- package/lib/chunks/{QL4V2A4A.js → V3JMSQFP.js} +1 -1
- package/lib/chunks/VWSPU27A.js +30 -0
- package/lib/chunks/W62VKXGM.js +26 -0
- package/lib/chunks/WIZYCYZG.js +7 -0
- package/lib/chunks/XDK4JK3V.js +9 -0
- package/lib/chunks/{5PXRDPHV.js → YJGI7CZ2.js} +1 -1
- package/lib/chunks/YQS3OX36.js +11 -0
- package/lib/chunks/{S4MX7JPH.js → Z2AXUXMK.js} +1 -1
- package/lib/chunks/ZBL4IVEW.js +11 -0
- package/lib/chunks/ZGMTMVBB.js +19 -0
- package/lib/chunks/{RIFZSMUA.js → ZVUMPMHU.js} +1 -1
- package/lib/eject-assets/AGENTS.md +137 -0
- package/lib/eject-assets/generators/cli/docs.ts +224 -0
- package/lib/eject-assets/generators/cli/engine-source.ts +21 -0
- package/lib/eject-assets/generators/cli/index.ts +90 -0
- package/lib/eject-assets/generators/cli/render.ts +348 -0
- package/lib/eject-assets/generators/go/client.ts +57 -0
- package/lib/eject-assets/generators/go/descriptor.ts +41 -0
- package/lib/eject-assets/generators/go/index.ts +336 -0
- package/lib/eject-assets/generators/go/models.ts +179 -0
- package/lib/eject-assets/generators/go/naming.ts +49 -0
- package/lib/eject-assets/generators/go/operations.ts +296 -0
- package/lib/eject-assets/generators/go/pagination.ts +194 -0
- package/lib/eject-assets/generators/go/types.ts +60 -0
- package/lib/eject-assets/generators/mock/faker.ts +214 -0
- package/lib/eject-assets/generators/mock/index.ts +35 -0
- package/lib/eject-assets/generators/mock/render.ts +282 -0
- package/lib/eject-assets/generators/mock/sample.ts +316 -0
- package/lib/eject-assets/generators/mock/values.ts +63 -0
- package/lib/eject-assets/generators/php/client.ts +63 -0
- package/lib/eject-assets/generators/php/descriptor.ts +58 -0
- package/lib/eject-assets/generators/php/index.ts +237 -0
- package/lib/eject-assets/generators/php/models.ts +275 -0
- package/lib/eject-assets/generators/php/naming.ts +51 -0
- package/lib/eject-assets/generators/php/operations.ts +232 -0
- package/lib/eject-assets/generators/php/pagination.ts +133 -0
- package/lib/eject-assets/generators/php/types.ts +148 -0
- package/lib/eject-assets/generators/python/client.ts +123 -0
- package/lib/eject-assets/generators/python/descriptor.ts +52 -0
- package/lib/eject-assets/generators/python/index.ts +251 -0
- package/lib/eject-assets/generators/python/models.ts +242 -0
- package/lib/eject-assets/generators/python/naming.ts +46 -0
- package/lib/eject-assets/generators/python/operations.ts +147 -0
- package/lib/eject-assets/generators/python/pagination.ts +128 -0
- package/lib/eject-assets/generators/python/types.ts +54 -0
- package/lib/eject-assets/generators/swr/index.ts +37 -0
- package/lib/eject-assets/generators/swr/render.ts +78 -0
- package/lib/eject-assets/generators/tanstack-query/index.ts +48 -0
- package/lib/eject-assets/generators/tanstack-query/render.ts +346 -0
- package/lib/eject-assets/generators/transformers/index.ts +46 -0
- package/lib/eject-assets/generators/transformers/render.ts +506 -0
- package/lib/eject-assets/generators/typescript/banner.ts +35 -0
- package/lib/eject-assets/generators/typescript/client.ts +254 -0
- package/lib/eject-assets/generators/typescript/descriptor.ts +137 -0
- package/lib/eject-assets/generators/typescript/index.ts +101 -0
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +135 -0
- package/lib/eject-assets/generators/typescript/operation-signature.ts +62 -0
- package/lib/eject-assets/generators/typescript/operation-types.ts +17 -0
- package/lib/eject-assets/generators/typescript/operations.ts +524 -0
- package/lib/eject-assets/generators/typescript/response-headers.ts +74 -0
- package/lib/eject-assets/generators/typescript/type-guards.ts +159 -0
- package/lib/eject-assets/generators/typescript/types.ts +172 -0
- package/lib/eject-assets/generators/zod/index.ts +32 -0
- package/lib/eject-assets/generators/zod/schemas.ts +456 -0
- package/lib/eject-assets/skills/cli-generator/SKILL.md +121 -0
- package/lib/eject-assets/skills/client-generators/SKILL.md +142 -0
- package/lib/eject-assets/skills/go-generator/SKILL.md +96 -0
- package/lib/eject-assets/skills/mock-generator/SKILL.md +50 -0
- package/lib/eject-assets/skills/php-generator/SKILL.md +112 -0
- package/lib/eject-assets/skills/python-generator/SKILL.md +110 -0
- package/lib/eject-assets/skills/swr-generator/SKILL.md +50 -0
- package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
- package/lib/eject-assets/skills/transformers-generator/SKILL.md +47 -0
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +95 -0
- package/lib/eject-assets/skills/zod-generator/SKILL.md +54 -0
- package/lib/index.js +272 -193
- package/package.json +1 -1
- package/lib/chunks/PIJLRHNN.js +0 -8
- package/lib/chunks/Y5HLCNL5.js +0 -2542
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: transformers-generator
|
|
3
|
+
description: Design of the ejected Redocly `transformers` client generator. Read it, and update it, before changing generators/transformers/.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# The `transformers` generator — its skill
|
|
7
|
+
|
|
8
|
+
This file is the DESIGN of your ejected `transformers` generator (`generators/transformers/`):
|
|
9
|
+
**to change the generator, edit this skill first, then make the code match it** — a diff
|
|
10
|
+
to `generators/transformers/` that has no covering sentence here is incomplete.
|
|
11
|
+
|
|
12
|
+
## What it emits
|
|
13
|
+
|
|
14
|
+
Per-schema `to<Name>()` / `from<Name>()` converters that turn wire JSON into typed
|
|
15
|
+
values and back — the bridge for `dateType: Date` clients.
|
|
16
|
+
|
|
17
|
+
## Design decisions that must hold
|
|
18
|
+
|
|
19
|
+
- **Requires `dateType: Date`** (declared as `dateTypes: ['Date']`, so a mismatched
|
|
20
|
+
selection fails fast): the converters assign `Date` objects to fields the sdk types as
|
|
21
|
+
`Date`, which only type-checks in that mode.
|
|
22
|
+
- **Imports the sdk's schema TYPES** (so `typescript` is required) and nothing else.
|
|
23
|
+
- Converters are pure and total: every named schema gets a pair, nested structures
|
|
24
|
+
recurse, and a missing optional stays missing.
|
|
25
|
+
|
|
26
|
+
## The stage files
|
|
27
|
+
|
|
28
|
+
`render.ts` holds the whole converter renderer; `index.ts` is the entry. Naming comes
|
|
29
|
+
from the TypeScript printer (`@redocly/client-generator/printers/typescript`).
|
|
30
|
+
|
|
31
|
+
## Ejecting it
|
|
32
|
+
|
|
33
|
+
`redocly eject-generator transformers` copies this generator's TypeScript source folder
|
|
34
|
+
to `generators/transformers/`, exactly as we wrote it, importing
|
|
35
|
+
`@redocly/client-generator` and `@redocly/client-generator/printers/typescript`. Running
|
|
36
|
+
a `.ts` generator uses Node's type stripping (Node 22.18, 23.6, or newer); newer built-in
|
|
37
|
+
versions merge in per file with `--update`. Change which fields are converted, or how,
|
|
38
|
+
and regenerate.
|
|
39
|
+
|
|
40
|
+
## The modify loop
|
|
41
|
+
|
|
42
|
+
1. Edit this skill: state the new behavior or decision.
|
|
43
|
+
2. Make `generators/transformers/` match it.
|
|
44
|
+
3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
|
|
45
|
+
generated files are never hand-edited.
|
|
46
|
+
|
|
47
|
+
Newer built-in versions merge in with `redocly eject-generator transformers --update`.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-generator
|
|
3
|
+
description: Design of the ejected Redocly `typescript` client generator. Read it, and update it, before changing generators/typescript/.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# The `typescript` generator — its skill
|
|
7
|
+
|
|
8
|
+
This file is the DESIGN of your ejected `typescript` generator (`generators/typescript/`):
|
|
9
|
+
**to change the generator, edit this skill first, then make the code match it** — a diff
|
|
10
|
+
to `generators/typescript/` that has no covering sentence here is incomplete.
|
|
11
|
+
|
|
12
|
+
## What it emits
|
|
13
|
+
|
|
14
|
+
The typed TypeScript client itself: model types with JSDoc, type guards, the `Ops`
|
|
15
|
+
type map, the `OPERATIONS` descriptor table, a `client` instance, one binding per
|
|
16
|
+
operation, and the runtime — embedded in the file (`runtime: inline`, the default) or
|
|
17
|
+
written as real modules in a `runtime/` folder beside it that the client imports
|
|
18
|
+
relatively (`runtime: module`).
|
|
19
|
+
|
|
20
|
+
## Design decisions that must hold
|
|
21
|
+
|
|
22
|
+
- **Descriptor-driven:** generated code is DATA (`OPERATIONS` + `Ops`) plus wiring;
|
|
23
|
+
request behavior lives in the runtime, never in per-operation code.
|
|
24
|
+
`satisfies Record<string, OperationDescriptor>` is the version-skew guard.
|
|
25
|
+
- **`single` vs `split`:** split derives `<stem>.schemas.ts` (types, enums, guards) and
|
|
26
|
+
an entry that `export *`s it; the entry type-imports only the schema names it
|
|
27
|
+
references (`collectEntrySchemaRefs`).
|
|
28
|
+
- **Zero runtime dependencies.** `Date`, `Blob`, `fetch` — nothing else.
|
|
29
|
+
- **Names are collision-safe:** `packageIdents` seeds every reserved wiring name before
|
|
30
|
+
any operation is sanitized, so renames are deterministic (`configure` → `configure_2`).
|
|
31
|
+
A rename becomes part of the SDK's public API, so the warning must say WHICH cause it
|
|
32
|
+
is and what the publisher can do: a duplicate `operationId` in the description (fix the
|
|
33
|
+
description — the only real fix), a name that isn't a valid identifier, or a clash with
|
|
34
|
+
a name the generated module already declares. A vague "collides or is invalid" message
|
|
35
|
+
leaves the publisher unable to act.
|
|
36
|
+
- **One operation, one function, one input shape.** The module-level names are bindings
|
|
37
|
+
of the client's own methods (`export const { getOrder } = client;`), never wrappers, so
|
|
38
|
+
`getOrder` and `client.getOrder` cannot disagree about their arguments. `argsStyle`
|
|
39
|
+
shapes the method itself: `grouped` (the default) namespaces the inputs by transport
|
|
40
|
+
layer — `path`, `query`, `headers`, `cookies`, `body` — and `flat` merges them into one
|
|
41
|
+
object, which the runtime converts back using the descriptor's own parameter list. An
|
|
42
|
+
operation whose merged names would collide keeps the grouped shape.
|
|
43
|
+
- **Throw mode returns the body**; `{ envelope: true }` opts into
|
|
44
|
+
`{ data, headers, response }` with typed declared headers. Result mode returns
|
|
45
|
+
`{ data, error, response }` and ignores `envelope`.
|
|
46
|
+
|
|
47
|
+
## The stage files
|
|
48
|
+
|
|
49
|
+
One file per stage of the emit, same skeleton as the other generators:
|
|
50
|
+
`types.ts` renders type text (`tsType`, JSDoc, the model type aliases);
|
|
51
|
+
`operations.ts` the per-operation surface (the `Ops` map, the `<Op>*` aliases, the
|
|
52
|
+
input shapes, `flatInputShape`);
|
|
53
|
+
`descriptor.ts` the `OPERATIONS` wire table and the collision-safe `packageIdents`;
|
|
54
|
+
`client.ts` the assembly (single/split entries, the runtime needs, the module-mode
|
|
55
|
+
runtime files);
|
|
56
|
+
`type-guards.ts`, `response-headers.ts`, `operation-types.ts`, `operation-signature.ts`
|
|
57
|
+
the narrower questions their names state;
|
|
58
|
+
`banner.ts` the generated-by header and title comment;
|
|
59
|
+
`inline-runtime.ts` the runtime assembly for both modes. The runtime's real sources ship
|
|
60
|
+
inside the package and reach the generator through
|
|
61
|
+
`@redocly/client-generator/runtime-sources` (in this repo they live in `runtime/` beside
|
|
62
|
+
these files). Naming and string escaping live in the TypeScript printer
|
|
63
|
+
(`@redocly/client-generator/printers/typescript`).
|
|
64
|
+
|
|
65
|
+
## Ejecting it
|
|
66
|
+
|
|
67
|
+
`redocly eject-generator typescript` copies this generator's TypeScript source folder to
|
|
68
|
+
`generators/typescript/` — the stage files above, exactly as we wrote them. Imports stay
|
|
69
|
+
package specifiers: `@redocly/client-generator` (the toolkit and IR types),
|
|
70
|
+
`@redocly/client-generator/printers/typescript` (naming and text mechanics), and
|
|
71
|
+
`@redocly/client-generator/runtime-sources` (the runtime sources it embeds). Running a
|
|
72
|
+
`.ts` generator uses Node's own type stripping (Node 22.18, 23.6, or newer), and newer
|
|
73
|
+
built-in versions merge into your copy per file with
|
|
74
|
+
`redocly eject-generator typescript --update`.
|
|
75
|
+
|
|
76
|
+
It is the largest of them, so reach for the smaller paths first when they fit:
|
|
77
|
+
`client.setup` bakes publisher defaults into the generated client, and middleware or
|
|
78
|
+
`configure()` change behavior at run time rather than generation time.
|
|
79
|
+
|
|
80
|
+
- **It documents itself.** With `client.docs` (or `--docs`), the `docs` hook writes
|
|
81
|
+
`<stem>.typescript.md`: the security schemes, then one section per operation with its parameters,
|
|
82
|
+
body, response type, and behavior notes. The call snippets come from this generator's own
|
|
83
|
+
`sample` hook, so the page can only show the syntax of the SDK beside it, and the layout
|
|
84
|
+
comes from `renderReferencePage` in the authoring toolkit — reachable from an ejected copy
|
|
85
|
+
through `@redocly/client-generator`. Pagination on the page is decided by
|
|
86
|
+
`paginationRuleFor`, the same helper this generator resolves pagination with.
|
|
87
|
+
|
|
88
|
+
## The modify loop
|
|
89
|
+
|
|
90
|
+
1. Edit this skill: state the new behavior or decision.
|
|
91
|
+
2. Make `generators/typescript/` match it.
|
|
92
|
+
3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
|
|
93
|
+
generated files are never hand-edited.
|
|
94
|
+
|
|
95
|
+
Newer built-in versions merge in with `redocly eject-generator typescript --update`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zod-generator
|
|
3
|
+
description: Design of the ejected Redocly `zod` client generator. Read it, and update it, before changing generators/zod/.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# The `zod` generator — its skill
|
|
7
|
+
|
|
8
|
+
This file is the DESIGN of your ejected `zod` generator (`generators/zod/`):
|
|
9
|
+
**to change the generator, edit this skill first, then make the code match it** — a diff
|
|
10
|
+
to `generators/zod/` that has no covering sentence here is incomplete.
|
|
11
|
+
|
|
12
|
+
## What it emits
|
|
13
|
+
|
|
14
|
+
A standalone `<stem>.zod.ts`: one `export const <Name>Schema` per named IR schema, the
|
|
15
|
+
`operationSchemas` request/response map, and a `zodValidation()` middleware.
|
|
16
|
+
|
|
17
|
+
## Design decisions that must hold
|
|
18
|
+
|
|
19
|
+
- **The client stays dependency-free.** zod is the CONSUMER's peer dependency; the
|
|
20
|
+
generated client never imports this module, and this module never imports the client.
|
|
21
|
+
- **Output-mode-agnostic:** one module beside the client whatever the sdk's layout.
|
|
22
|
+
- **Emits nothing** when the model has neither named schemas nor JSON operation bodies —
|
|
23
|
+
an empty file is worse than no file.
|
|
24
|
+
- Validation is opt-in at runtime (`use(zodValidation())`), never automatic.
|
|
25
|
+
- **Only ERASABLE TypeScript.** The module must run under `node --experimental-strip-types`
|
|
26
|
+
with no build step, so nothing that needs a transform is emitted: no `enum`, no
|
|
27
|
+
`namespace`, and no constructor parameter properties. `ZodValidationError` therefore
|
|
28
|
+
declares its fields and assigns them in the constructor body — `constructor(readonly
|
|
29
|
+
operationId: string)` fails strip-only mode, which is how the generated CLI broke when it
|
|
30
|
+
imported this module.
|
|
31
|
+
|
|
32
|
+
## The stage files
|
|
33
|
+
|
|
34
|
+
`schemas.ts` holds the whole renderer — schema expressions, the `operationSchemas` map,
|
|
35
|
+
and the module assembly; `index.ts` is the entry. Naming and literal escaping come from
|
|
36
|
+
the TypeScript printer (`@redocly/client-generator/printers/typescript`).
|
|
37
|
+
|
|
38
|
+
## Ejecting it
|
|
39
|
+
|
|
40
|
+
`redocly eject-generator zod` copies this generator's TypeScript source folder to
|
|
41
|
+
`generators/zod/`, exactly as we wrote it, importing `@redocly/client-generator` and
|
|
42
|
+
`@redocly/client-generator/printers/typescript`. Running a `.ts` generator uses Node's
|
|
43
|
+
type stripping (Node 22.18, 23.6, or newer); newer built-in versions merge in per file
|
|
44
|
+
with `--update`. Change the schema shapes, the naming, or what gets a schema at all, and
|
|
45
|
+
regenerate.
|
|
46
|
+
|
|
47
|
+
## The modify loop
|
|
48
|
+
|
|
49
|
+
1. Edit this skill: state the new behavior or decision.
|
|
50
|
+
2. Make `generators/zod/` match it.
|
|
51
|
+
3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
|
|
52
|
+
generated files are never hand-edited.
|
|
53
|
+
|
|
54
|
+
Newer built-in versions merge in with `redocly eject-generator zod --update`.
|