From 03109d62b0b71e6a3fa59a0d0d4756b13fc99fe8 Mon Sep 17 00:00:00 2001 From: Roman Marshevskyi Date: Tue, 25 Aug 2026 19:15:38 +0300 Subject: [PATCH 1/2] fix: refresh the ejected example on release and stop warning that language SDKs ignore the module runtime --- .changeset/ninety-banks-try.md | 6 +++ .github/workflows/release.yaml | 1 + .../src/generators/__tests__/index.test.ts | 3 +- .../client-generator/src/generators/meta.ts | 10 ++--- scripts/refresh-ejected-example.mjs | 38 +++++++++++++++++++ .../generators/php/client.ts | 2 +- .../generators/php/descriptor.ts | 2 +- .../ejected-generator/generators/php/index.ts | 7 ++-- .../generators/php/models.ts | 2 +- .../generators/php/naming.ts | 2 +- .../generators/php/operations.ts | 2 +- .../generators/php/pagination.ts | 2 +- .../ejected-generator/generators/php/types.ts | 2 +- 13 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 .changeset/ninety-banks-try.md create mode 100644 scripts/refresh-ejected-example.mjs diff --git a/.changeset/ninety-banks-try.md b/.changeset/ninety-banks-try.md new file mode 100644 index 0000000000..85fb961f6b --- /dev/null +++ b/.changeset/ninety-banks-try.md @@ -0,0 +1,6 @@ +--- +'@redocly/client-generator': patch +'@redocly/cli': patch +--- + +Removed the incorrect warning that the `python`, `go`, and `php` generators ignore `--runtime`; the module runtime applies to them. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fc8a9a154d..c821146ea1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -55,6 +55,7 @@ jobs: npx changeset version npm i node scripts/post-changeset.js + node scripts/refresh-ejected-example.mjs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/client-generator/src/generators/__tests__/index.test.ts b/packages/client-generator/src/generators/__tests__/index.test.ts index 766ee0d439..41915b60af 100644 --- a/packages/client-generator/src/generators/__tests__/index.test.ts +++ b/packages/client-generator/src/generators/__tests__/index.test.ts @@ -80,8 +80,9 @@ describe('validateGenerators', () => { validateGenerators(['php'], { runtime: 'inline', argsStyle: 'grouped' }, undefined, 'split'); const messages = warn.mock.calls.map(([message]) => message).join(''); expect(messages).toContain('the "php" generator ignores outputMode'); - expect(messages).toContain('the "php" generator ignores runtime'); expect(messages).toContain('the "php" generator ignores argsStyle'); + // `runtime` applies to every runtime-embedding generator since module mode landed. + expect(messages).not.toContain('ignores runtime'); // Defaults must stay quiet: only an EXPLICIT option warns. warn.mockClear(); diff --git a/packages/client-generator/src/generators/meta.ts b/packages/client-generator/src/generators/meta.ts index 6bdffe67c2..25f8decbe2 100644 --- a/packages/client-generator/src/generators/meta.ts +++ b/packages/client-generator/src/generators/meta.ts @@ -24,13 +24,13 @@ function tanstackQuery(framework: 'react' | 'vue' | 'svelte' | 'solid'): Builtin } /** - * The TypeScript-only knobs a standalone language SDK cannot apply: it always emits - * one self-contained file with the runtime embedded, and each language passes inputs - * its own idiomatic way (keyword arguments, named arguments, a params struct). + * The TypeScript-only knobs a standalone language SDK cannot apply: the client is + * always one module (`runtime: module` adds its runtime files beside it), and each + * language passes inputs its own idiomatic way (keyword arguments, named arguments, + * a params struct). */ const LANGUAGE_SDK_NOT_APPLICABLE: BuiltinMeta['notApplicable'] = { - outputMode: 'it always emits one self-contained file', - runtime: 'the runtime is always embedded in the generated file', + outputMode: 'the client is always one module (`split` applies to the TypeScript client)', argsStyle: "inputs follow the target language's own idiom", importExt: 'the generated file has no relative imports', }; diff --git a/scripts/refresh-ejected-example.mjs b/scripts/refresh-ejected-example.mjs new file mode 100644 index 0000000000..c33e3d6b1e --- /dev/null +++ b/scripts/refresh-ejected-example.mjs @@ -0,0 +1,38 @@ +// Re-stamp the checked-in ejected-generator example with the current +// @redocly/client-generator version. The example is a frozen user copy, and its +// `requiresGenerator: '^'` caret range treats a 0.x minor bump as breaking +// (deliberately), so a release that bumps the package would otherwise fail the +// examples job with "Generator 'php' needs @redocly/client-generator ^". +// Runs from the release workflow's `version` block, after `changeset version`. + +import { readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { join } from 'node:path'; + +const { version } = JSON.parse(readFileSync('packages/client-generator/package.json', 'utf-8')); +const generatorsDir = 'tests/e2e/generate-client/examples/ejected-generator/generators'; + +const HEADER = /Ejected from @redocly\/client-generator@\d+\.\d+\.\d+(?:-[\w.]+)?/g; +const REQUIRES = /requiresGenerator: '\^\d+\.\d+\.\d+(?:-[\w.]+)?'/g; + +let touched = 0; +for (const entry of readdirSync(generatorsDir, { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const dir = join(generatorsDir, entry.name); + for (const name of readdirSync(dir)) { + if (!name.endsWith('.ts')) continue; + const path = join(dir, name); + const source = readFileSync(path, 'utf-8'); + const updated = source + .replaceAll(HEADER, `Ejected from @redocly/client-generator@${version}`) + .replaceAll(REQUIRES, `requiresGenerator: '^${version}'`); + if (updated !== source) { + writeFileSync(path, updated, 'utf-8'); + touched++; + } + } +} +console.log( + touched === 0 + ? `refresh-ejected-example: already at ${version}, nothing to do` + : `refresh-ejected-example: stamped ${touched} file(s) with ${version}` +); diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/client.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/client.ts index 6f0c9295e8..eeae8e4085 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/client.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/client.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/descriptor.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/descriptor.ts index 5039232007..ad77c4a59f 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/descriptor.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/descriptor.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/index.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/index.ts index cadfbb969b..f949191cbd 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/index.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/index.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. @@ -211,10 +211,9 @@ export default { docs: phpDocs, errorModes: ["throw"], notApplicable: { - "outputMode": "it always emits one self-contained file", - "runtime": "the runtime is always embedded in the generated file", + "outputMode": "the client is always one module (`split` applies to the TypeScript client)", "argsStyle": "inputs follow the target language's own idiom", "importExt": "the generated file has no relative imports" }, - requiresGenerator: '^0.3.7', + requiresGenerator: '^0.3.8', }; diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/models.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/models.ts index 234c0c9319..8799982e38 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/models.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/models.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/naming.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/naming.ts index 7f88a057b5..629281cfbd 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/naming.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/naming.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/operations.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/operations.ts index fd2f912426..1151bcd65a 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/operations.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/operations.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/pagination.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/pagination.ts index 642d70fff6..74354b6dfc 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/pagination.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/pagination.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. diff --git a/tests/e2e/generate-client/examples/ejected-generator/generators/php/types.ts b/tests/e2e/generate-client/examples/ejected-generator/generators/php/types.ts index c057a27fa8..6a15d95065 100644 --- a/tests/e2e/generate-client/examples/ejected-generator/generators/php/types.ts +++ b/tests/e2e/generate-client/examples/ejected-generator/generators/php/types.ts @@ -1,4 +1,4 @@ -// Ejected from @redocly/client-generator@0.3.7 — the built-in "php" generator. +// Ejected from @redocly/client-generator@0.3.8 — the built-in "php" generator. // This file is yours: edit freely; the generated client stays machine-owned and is // rebuilt by `redocly generate-client`. Newer generator versions merge in with // `redocly eject-generator php --update`. From 11b58f8b2580512afe6dfaba519561b1fd3c7250 Mon Sep 17 00:00:00 2001 From: Roman Marshevskyi Date: Tue, 25 Aug 2026 19:19:19 +0300 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20drop=20the=20changeset=20=E2=80=94?= =?UTF-8?q?=20the=20warning=20never=20shipped?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/ninety-banks-try.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .changeset/ninety-banks-try.md diff --git a/.changeset/ninety-banks-try.md b/.changeset/ninety-banks-try.md deleted file mode 100644 index 85fb961f6b..0000000000 --- a/.changeset/ninety-banks-try.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@redocly/client-generator': patch -'@redocly/cli': patch ---- - -Removed the incorrect warning that the `python`, `go`, and `php` generators ignore `--runtime`; the module runtime applies to them.