@redocly/cli 2.60.0 → 2.62.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/THIRD_PARTY_NOTICES +24 -3
- package/lib/chunks/{AP2GA7RS.js → 22EANOP2.js} +87 -87
- package/lib/chunks/{B5GZ7KU2.js → 2EP764NP.js} +1 -1
- package/lib/chunks/2OVI7BIW.js +105 -0
- package/lib/chunks/{GYKYFMW3.js → 2XK7ML3U.js} +1 -1
- package/lib/chunks/{DAAOXDSB.js → 37WWN4MA.js} +1 -1
- package/lib/chunks/{IAN3UOJT.js → 3C6UUCEW.js} +1 -1
- package/lib/chunks/{S27TE7KZ.js → 3DEJQSYG.js} +1 -1
- package/lib/chunks/{SDNESV5E.js → 3JYY42DL.js} +1 -1
- package/lib/chunks/{SNR3DAVL.js → 4WO6ZSKT.js} +1 -1
- package/lib/chunks/53INGMTO.js +20 -0
- package/lib/chunks/5NOJ76EP.js +9 -0
- package/lib/chunks/{SXOXAG7R.js → 5PG3ST2N.js} +2 -2
- package/lib/chunks/{BHUCIWQF.js → 66GKT2TZ.js} +1 -1
- package/lib/chunks/{V46KUEYR.js → 6DO6IN4A.js} +1 -1
- package/lib/chunks/{2F2YM4RD.js → 6EGJEFXO.js} +1 -1
- package/lib/chunks/{MJYI42E6.js → 6NB3FKVN.js} +8 -8
- package/lib/chunks/{GHPOEF7A.js → 75SLMDAN.js} +1 -1
- package/lib/chunks/{CAJM6OL3.js → AB2EMYEK.js} +1 -1
- package/lib/chunks/{PKYNMOKV.js → AZO6SCNH.js} +1 -1
- package/lib/chunks/{LF35KJ5M.js → B2J7WNDG.js} +1 -1
- package/lib/chunks/C67OKMFJ.js +11 -0
- package/lib/chunks/{ZJAFKITR.js → DC2HDHGE.js} +1 -1
- package/lib/chunks/{XZKUPNLZ.js → DFWXX7E2.js} +1 -1
- package/lib/chunks/{HFGKPU2P.js → FDMXHRDK.js} +1 -1
- package/lib/chunks/{SL6UQOKE.js → G5N3UXMR.js} +1 -1
- package/lib/chunks/{HVO5F4MP.js → GVQMC2WB.js} +1 -1
- package/lib/chunks/{RDMFHSDB.js → HBENVUR4.js} +1 -1
- package/lib/chunks/HN2ZK7LZ.js +20 -0
- package/lib/chunks/I6AAWNTY.js +20 -0
- package/lib/chunks/{HSHAARAO.js → KPPPJNVL.js} +1 -1
- package/lib/chunks/{52MW7SRF.js → KRCCY64H.js} +1 -1
- package/lib/chunks/LNYTDBAU.js +12 -0
- package/lib/chunks/{4XDEFJCF.js → LRLGVYCG.js} +1 -1
- package/lib/chunks/{3MPID4OC.js → LVGVWPDB.js} +1 -1
- package/lib/chunks/{XHDOW23C.js → MNH2K4WM.js} +1 -1
- package/lib/chunks/{J4NCFMOR.js → N3GO4LRW.js} +1 -1
- package/lib/chunks/{GD6WKI2C.js → NBI4EQPC.js} +1 -1
- package/lib/chunks/{G4ZIYGF5.js → NENSYJQB.js} +1 -1
- package/lib/chunks/NFRA6IE2.js +7 -0
- package/lib/chunks/{O5WCU6SC.js → OMIM3KH6.js} +10 -10
- package/lib/chunks/{YNPWONFN.js → OP7NIAI7.js} +1 -1
- package/lib/chunks/{CKZ35ARL.js → OT7Y7FIM.js} +1 -1
- package/lib/chunks/{ACVFQG4D.js → PTNNX4IU.js} +1 -1
- package/lib/chunks/{UPHYYNN3.js → PXCT44HL.js} +5 -5
- package/lib/chunks/{HQUG6XPO.js → QAUXTHD6.js} +2 -2
- package/lib/chunks/{N4AA4DRD.js → R2TPTKNR.js} +1 -1
- package/lib/chunks/{UXSV2J6V.js → REIGI2Y7.js} +1 -1
- package/lib/chunks/{S5G22GL5.js → RGU6OZYB.js} +1 -1
- package/lib/chunks/{W3K4YAMS.js → RPHIT72T.js} +1 -1
- package/lib/chunks/{7C244K4X.js → RUIEI3YV.js} +1 -1
- package/lib/chunks/{NADFEIIN.js → S3STDXJN.js} +1 -1
- package/lib/chunks/{DJWI7SF7.js → S6NFOZ34.js} +1 -1
- package/lib/chunks/{VCV3FKMW.js → SLQPKXO2.js} +1 -1
- package/lib/chunks/{4WAQNM63.js → SS6PCAMM.js} +58 -12
- package/lib/chunks/{CEPC3LL4.js → SXBAAS4M.js} +1 -1
- package/lib/chunks/{7ED6ZTTH.js → SYWAPWW7.js} +1 -1
- package/lib/chunks/{S46ENZHC.js → T4Y6M5MJ.js} +1 -1
- package/lib/chunks/{O4RAFGZA.js → TBZEEKTV.js} +1 -1
- package/lib/chunks/{HNKSHJLU.js → TF4PPK4N.js} +1 -1
- package/lib/chunks/TWWNWQRB.js +7 -0
- package/lib/chunks/{EXCIOEBN.js → US7X4XPD.js} +1 -1
- package/lib/chunks/VGM6NIVC.js +8 -0
- package/lib/chunks/{QGUZ4KFX.js → VX2VONNO.js} +1 -1
- package/lib/chunks/{DTMC35L3.js → VXLODB3S.js} +1 -1
- package/lib/chunks/{4HEJ6GQB.js → WEOCCL26.js} +2 -2
- package/lib/chunks/{Q526MFO3.js → WQ3XMPU7.js} +1 -1
- package/lib/chunks/{2U6O26CV.js → XJE2OFDN.js} +116 -16
- package/lib/chunks/{WFIIXHF3.js → XJTGJYVS.js} +1 -1
- package/lib/chunks/YDVWNFMS.js +24 -0
- package/lib/chunks/{HZZP3BZQ.js → YPYZCXVX.js} +1 -1
- package/lib/chunks/{72ZX5WSN.js → ZYQDPQVA.js} +1 -1
- package/lib/eject-assets/AGENTS.md +24 -23
- 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 +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +35 -3
- 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 +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- 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 +1 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +21 -3
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- package/lib/eject-assets/generators/php/types.ts +1 -1
- 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 +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +19 -6
- 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 +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- 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 +3 -4
- 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/client-generators/SKILL.md +24 -23
- package/lib/eject-assets/skills/go-generator/SKILL.md +11 -0
- package/lib/eject-assets/skills/php-generator/SKILL.md +16 -0
- package/lib/eject-assets/skills/python-generator/SKILL.md +13 -0
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +16 -0
- package/lib/index.js +55 -55
- package/package.json +1 -1
- package/lib/chunks/BZBFESBB.js +0 -11
- package/lib/chunks/DJXBNZCO.js +0 -7
- package/lib/chunks/GC26XZYZ.js +0 -20
- package/lib/chunks/IJ43XWPG.js +0 -20
- package/lib/chunks/MCJLOALK.js +0 -22
- package/lib/chunks/OKTLNLO3.js +0 -7
- package/lib/chunks/PGZIUA7J.js +0 -105
- package/lib/chunks/W7VT3BOM.js +0 -9
- package/lib/chunks/XQA4EEZA.js +0 -20
|
@@ -96,29 +96,30 @@ discriminated union on `kind`: `scalar`, `array`, `object`, `record`, `ref`,
|
|
|
96
96
|
|
|
97
97
|
## Helpers (import from '@redocly/client-generator')
|
|
98
98
|
|
|
99
|
-
| Helper | Use
|
|
100
|
-
| ------------------------------------------------------- |
|
|
101
|
-
| `flattenAllOf(schema, model)` | The merged property view of allOf compositions — languages without intersection types render this.
|
|
102
|
-
| `deref(schema, model)` | Follow a `ref` chain to the schema it names (cycle-guarded).
|
|
103
|
-
| `jsonSuccessSchema(op)` / `sseResponse(op)` | The primary JSON success schema; the `text/event-stream` response when the operation streams.
|
|
104
|
-
| `isMultipartBody(op)` | Whether the request body is multipart.
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
99
|
+
| Helper | Use |
|
|
100
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
101
|
+
| `flattenAllOf(schema, model)` | The merged property view of allOf compositions — languages without intersection types render this. |
|
|
102
|
+
| `deref(schema, model)` | Follow a `ref` chain to the schema it names (cycle-guarded). |
|
|
103
|
+
| `jsonSuccessSchema(op)` / `sseResponse(op)` | The primary JSON success schema; the `text/event-stream` response when the operation streams. |
|
|
104
|
+
| `isMultipartBody(op)` | Whether the request body is multipart. |
|
|
105
|
+
| `isUntypedMultipartBody(op)` | Whether the request body is multipart with a schema that is neither an object nor a `$ref`, so the caller supplies the encoded body. |
|
|
106
|
+
| `isBinaryContentType(contentType)` | Whether a body of this content type is bytes (archives, PDF, images, media) — decode it as a Blob, not JSON or text. |
|
|
107
|
+
| `serverUrlParts(server)` | A server-URL template as literal/variable parts, ready for any concatenation syntax. |
|
|
108
|
+
| `securityRequirements(op, model)` | The operation's security as OR-alternatives of AND-sets, denormalized against the declared schemes. |
|
|
109
|
+
| `paginationItemSchema(pageSchema, itemsPointer, model)` | The raw element schema behind a pagination rule's `items` pointer — a `ref` element keeps its name. |
|
|
110
|
+
| `discriminatorCases(schema, model)` | `{ property, cases }` dispatch table for discriminated unions. |
|
|
111
|
+
| `isNullable(schema)` / `unwrapNullable(schema)` | Detect and strip `null` union members (`Optional[T]`, pointers, `Option<T>`). |
|
|
112
|
+
| `enumValues(schema)` | Values plus SCREAMING_SNAKE member-name suggestions. |
|
|
113
|
+
| `headerCoerceType(schema, model)` | Response-header coerce hint (`integer`/`number`/`boolean`/`string`) through refs, nullables, and allOf wrappers. |
|
|
114
|
+
| `casing` / `identifierFor(name, { style, reserved })` | camel/pascal/snake/screaming; keyword-safe identifiers (`RESERVED_WORDS.python/go/typescript` shipped). |
|
|
115
|
+
| `uniqueIdentifiers(names, { style, reserved, taken })` | The same, made unique among themselves and among names you already took — for a signature that takes one argument per parameter. |
|
|
116
|
+
| `Printer` | Indentation-aware text builder — no manual whitespace bookkeeping. |
|
|
117
|
+
| `docText(description)` | Description as trimmed lines for any comment syntax. |
|
|
118
|
+
| `schemaAtPointer(schema, pointer, model)` | Resolve an RFC 6901 JSON pointer over a schema (through refs and allOf) — e.g. a pagination `items` pointer to its element type. |
|
|
119
|
+
| `paginationRuleFor(op, config)` | The pagination rule that applies to an operation (per-op config > extension > fitting convention), normalized. |
|
|
120
|
+
| `renderReferencePage(model, options)` | The Markdown reference page a generator's `docs` hook returns — your `sample` hook supplies its call snippets. |
|
|
121
|
+
| `NotSupportedError` | Throw it to reject an option the generator can't honor — the CLI prints the message as a user error, not a crash. |
|
|
122
|
+
| `AUTHORING_HELPER_NAMES` | The list of the above (introspection). |
|
|
122
123
|
|
|
123
124
|
Worked example: the built-in `python` generator
|
|
124
125
|
(`packages/client-generator/src/generators/python/index.ts` in the Redocly CLI repo) is
|
|
@@ -55,6 +55,17 @@ runtime. Go ≥ 1.21, standard library only — zero dependencies.
|
|
|
55
55
|
parameters (Go has no defaults — the doc comment states the spec default), so templated
|
|
56
56
|
base URLs need no manual string building. The client's baked default stays `servers[0]`
|
|
57
57
|
with variable defaults substituted.
|
|
58
|
+
- **Stream bodies pass through.** For an untyped `multipart/form-data` operation
|
|
59
|
+
(`isUntypedMultipartBody` from the toolkit: a schema that is neither an object nor a
|
|
60
|
+
`$ref`) or a binary operation (`isBinaryContentType`), the body argument is `any` and
|
|
61
|
+
the runtime sorts it out (`multipartBody` / `binaryBody`): an `io.Reader` is the
|
|
62
|
+
request body as is, with no `io.ReadAll` and exactly one attempt (a consumed reader
|
|
63
|
+
cannot be replayed, whatever the retry policy says); a `[]byte` or a `string` is sent as
|
|
64
|
+
bytes, not JSON-marshalled, and stays replayable, so retries stay; a map or struct body
|
|
65
|
+
of an untyped multipart operation keeps the `toMultipart` path. The description's (or
|
|
66
|
+
the multipart boundary's) `Content-Type` is applied only when the caller set none, so a
|
|
67
|
+
forwarded boundary survives; that rule holds for every operation. The per-attempt
|
|
68
|
+
timeout still applies. Typed multipart bodies are unaffected.
|
|
58
69
|
- **Parity surface:** auth, retries with `Retry-After` + jittered backoff, per-attempt
|
|
59
70
|
`context.WithTimeout`, idempotency keys, middleware, pagination (`<Op>Pages`/`<Op>Items`
|
|
60
71
|
as `func(yield func(T, error) bool)` — `range`-over-func needs Go ≥ 1.23; 1.21 calls
|
|
@@ -76,6 +76,22 @@ extension — zero Composer dependencies. The namespace derives from the API tit
|
|
|
76
76
|
to the spec's defaults (`Servers::production(organizationId: 'org_x')`), so templated
|
|
77
77
|
base URLs need no manual string building. The client's baked default stays `servers[0]`
|
|
78
78
|
with variable defaults substituted.
|
|
79
|
+
- **Stream bodies pass through.** For an untyped `multipart/form-data` operation
|
|
80
|
+
(`isUntypedMultipartBody` from the toolkit: a schema that is neither an object nor a
|
|
81
|
+
`$ref`) or a binary operation (`isBinaryContentType`), the body is `mixed` and the
|
|
82
|
+
runtime sorts it out (`multipartBody` / `binaryBody`): a stream `resource` is uploaded
|
|
83
|
+
by curl in chunks (`CURLOPT_UPLOAD` + `CURLOPT_INFILE`, the method kept by
|
|
84
|
+
`CURLOPT_CUSTOMREQUEST`), never read into a string, in exactly one attempt, whatever
|
|
85
|
+
the retry policy says (the default is three attempts for any method), because a
|
|
86
|
+
consumed stream cannot be replayed. `CURLOPT_INFILESIZE` is set only when the stream is
|
|
87
|
+
seekable AND `fstat` returns an array (the bytes left from the current position);
|
|
88
|
+
`php://input`, pipes, and wrappers without `stream_stat` go chunked. A `string` body of
|
|
89
|
+
either operation is sent raw, not `json_encode`d; any other binary-operation value is
|
|
90
|
+
still `json_encode`d; an `array` body of an untyped multipart operation keeps the
|
|
91
|
+
`toMultipart` path. The caller's `Content-Type` wins over the description's or the
|
|
92
|
+
multipart boundary's, matched case-insensitively in `send` so the header is never sent
|
|
93
|
+
twice; that rule holds for every operation. The whole-request curl timeout still
|
|
94
|
+
applies (`timeout: null` disables it). Typed multipart bodies are unaffected.
|
|
79
95
|
- **Parity surface:** auth, retries with `Retry-After` + jittered backoff, per-attempt
|
|
80
96
|
curl timeouts, middleware callables, pagination (`<op>Pages()` / `<op>Items()` as
|
|
81
97
|
`\Generator`s), SSE (`iterSse` over a curl_multi pump), multipart.
|
|
@@ -82,6 +82,19 @@ One self-contained `<stem>.py`: typed dataclass models, a sync `Client` and an a
|
|
|
82
82
|
the spec's defaults (`Servers.production(organization_id="org_x")`), so templated base
|
|
83
83
|
URLs need no manual string building. The client's baked default stays `servers[0]`
|
|
84
84
|
with variable defaults substituted.
|
|
85
|
+
- **Stream bodies pass through.** For an untyped `multipart/form-data` operation
|
|
86
|
+
(`isUntypedMultipartBody`) or a binary operation (`isBinaryContentType`), the body
|
|
87
|
+
argument is `Any`, and a body that is `bytes`/`bytearray`, a `str`, a
|
|
88
|
+
file-like object (a callable `.read`), or an iterator/async iterator of bytes goes to httpx
|
|
89
|
+
`content=`, never through `json=` or `to_multipart`; a `dict` body of an untyped
|
|
90
|
+
multipart operation keeps the `to_multipart` path. The runtime sets the operation's
|
|
91
|
+
declared content type only when the caller set none (matched case-insensitively), and
|
|
92
|
+
never for a multipart body, whose boundary is the caller's. A body that cannot be
|
|
93
|
+
replayed (a file-like object or iterator, as opposed to `bytes` or `str`) is sent in
|
|
94
|
+
exactly one attempt, whatever the retry policy says. The per-attempt `timeout` still
|
|
95
|
+
applies. Both the sync and the async `send` behave the same. Typed multipart bodies
|
|
96
|
+
are unaffected: they go straight to `to_multipart` and never through stream detection,
|
|
97
|
+
so a model field named `read` cannot turn one into a raw upload.
|
|
85
98
|
- **Parity surface:** auth (bearer/basic/apiKey), retries with `Retry-After` + jittered
|
|
86
99
|
backoff, timeouts, idempotency keys, middleware, pagination (`<op>_pages()` /
|
|
87
100
|
`<op>_items()` + `aiter` mirrors), SSE (`iter_sse`/`aiter_sse`), multipart.
|
|
@@ -40,6 +40,22 @@ relatively (`runtime: module`).
|
|
|
40
40
|
layer — `path`, `query`, `headers`, `cookies`, `body` — and `flat` merges them into one
|
|
41
41
|
object, which the runtime converts back using the descriptor's own parameter list. An
|
|
42
42
|
operation whose merged names would collide keeps the grouped shape.
|
|
43
|
+
- **Stream bodies pass through.** A request body that is a `ReadableStream`, or any
|
|
44
|
+
async iterable of bytes (a Node `Readable`), is a pass-through upload: `send()` hands it
|
|
45
|
+
to `fetch` untouched with `duplex: 'half'` and makes exactly one attempt, because a
|
|
46
|
+
consumed stream cannot be replayed, whatever the retry policy says. The whole-attempt
|
|
47
|
+
`timeout` still applies; callers pass `timeout: 0` or a budget that fits the upload per
|
|
48
|
+
call. The body type of an untyped `multipart/form-data` operation is
|
|
49
|
+
`FormData | ReadableStream`, and of a binary operation (`isBinaryContentType`:
|
|
50
|
+
`application/octet-stream`, `application/pdf`, images, audio, video, fonts, zip)
|
|
51
|
+
`Blob | ArrayBuffer | ReadableStream`. The client stays free of Node types: a Node
|
|
52
|
+
request becomes a web stream with `Readable.toWeb(request)`. Typed multipart objects
|
|
53
|
+
are unaffected.
|
|
54
|
+
- **The caller's `Content-Type` wins; the description's fills the gap.** For a
|
|
55
|
+
pass-through body other than `FormData` or `URLSearchParams` (whose type `fetch`
|
|
56
|
+
derives, boundary included), `send()` sets the operation's declared content type only
|
|
57
|
+
when the caller set none, the same rule the JSON branch already follows. A forwarded
|
|
58
|
+
multipart boundary therefore survives, and a binary upload is never sent untyped.
|
|
43
59
|
- **Throw mode returns the body**; `{ envelope: true }` opts into
|
|
44
60
|
`{ data, headers, response }` with typed declared headers. Result mode returns
|
|
45
61
|
`{ data, error, response }` and ignores `envelope`.
|