fix(cli): generated combo PATCH sends literal {id} — resolve $ref params + requestBody (#10955) - #11013
Merged
Conversation
Sa3id23
pushed a commit
to Sa3id23/OmniRoute
that referenced
this pull request
Aug 21, 2026
…ams + requestBody (diegosouzapw#10955) (diegosouzapw#11013) ⭐5 — Fix(diegosouzapw#10955): generator de CLI não resolvia $ref em parâmetros do OpenAPI (bug em 20 lugares do spec), PATCH combo sem requestBody. TDD RED→GREEN, gates completos (file-size/complexity/cognitive/changelog/typecheck/lint/docs-all) todos OK. UNSTABLE é o base-red inherited diegosouzapw#9985.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ams + requestBody (diegosouzapw#10955) (diegosouzapw#11013) ⭐5 — Fix(diegosouzapw#10955): generator de CLI não resolvia $ref em parâmetros do OpenAPI (bug em 20 lugares do spec), PATCH combo sem requestBody. TDD RED→GREEN, gates completos (file-size/complexity/cognitive/changelog/typecheck/lint/docs-all) todos OK. UNSTABLE é o base-red inherited diegosouzapw#9985.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10955
Root cause
scripts/cli/generate-api-commands.mjsloadsdocs/openapi.yamlwithyaml.loadand never resolves$ref. The spec declares the combo path parameter via:The generator's
p.in === "path"filter silently drops any$ref'd parameter — a bare{ $ref }object has no.in— so every generated command on a$ref'd path param lost its--idflag and its{id}→ real-id URL substitution. On top of that,PATCH /api/combos/{id}had norequestBodyin the spec, so no--bodywas ever emitted. The result:omniroute api combos patch-api-combos-id-sent a literalPATCH /api/combos/{id}with no body → 405/mismatch upstream.This is a pre-existing spec-wide bug, not combo-specific:
#/components/parameters/ResourceIdis$ref'd 20 times across the spec (providers, combos, api-keys, settings, etc.).Fix
scripts/cli/generate-api-commands.mjs— added a minimal, scopedresolveParam()that only follows#/components/parameters/*refs (not a generic dereferencer — this spec never uses any other parameter-level$reftarget, and a full dereferencer would be scope creep). Unsupported/unresolvable refs now throw at generation time instead of being silently dropped.docs/openapi.yaml— added the missingrequestBodytoPATCH /api/combos/{id}, mirroringPUT's shape exactly (verified againstsrc/app/api/combos/[id]/route.ts—PATCHdelegates straight toPUT, same partial-update/merge semantics).bin/cli/api-commands/combos.mjs— regenerated with the fixed generator. Diff is wiring-only:--id/--body/URL-substitution added toget/put/patch/deletecombo-by-id commands (get/putwere entirely missing before — same underlying bug, not new scope). No otherapi-commands/*.mjsfile is touched in this PR; the same$reffix will apply the next time the fullbuild:cli-apiregen runs, but that pulls in unrelated spec drift on ~15 other files that's out of scope for this issue.OPENAPI_OUT_DIRenv override added to the generator (mirrors the existingOPENAPI_SPECoverride) purely so the new test can regenerate into a scratch directory instead of the realbin/cli/api-commands/tree; added to thecheck-env-doc-sync.mjsinternal-tooling allowlist next toOPENAPI_SPEC.Tests (TDD)
tests/unit/cli-api-generator-ref-params.test.ts— RED on the untouched code, GREEN after the fix:$refpath parameter into--idand substitutes{id}in the URL (fixture spec reproducing the exact broken shape)$reftarget instead of silently dropping the parameterbin/cli/api-commands/combos.mjshas--idand--bodyon the PATCH combo commandSibling suites:
tests/unit/cli-openapi-codegen.test.ts,tests/unit/cli-combo-command.test.ts— all green.Gates run
check-file-size.mjs— OKcheck-complexity.mjs— OK (2615 vs baseline 2774)check-cognitive-complexity.mjs— OK (1175 vs baseline 1223)npm run typecheck:core— cleaneslint --suppressions-location config/quality/eslint-suppressions.json— clean on changed files (generated.mjs/scripts are gitignore-pattern excluded from lint, as expected)check-changelog-integrity.mjs— OKnpm run check:docs-all:check:docs-sync— PASScheck:docs-counts— 5 STRICT drifts, all pre-existing and untouched by this diff:docs/reference/PROVIDER_REFERENCE.md(346 vs 347) + 4 SVGs — this is the inherited 🔴 Release branch not green: release/v3.8.50 #9985 base-red (gh issue/nightly-release-green), not introduced here (git diff origin/release/v3.8.50 -- docs/reference/PROVIDER_REFERENCE.md docs/diagrams/is empty)check:env-doc-sync— OPENAPI_OUT_DIR resolved via allowlist; remaining 6 missing-vars are pre-existing, untouched production code (OMNIROUTE_STANDALONE_DIR,KIMI_WEB_*,OIDC_DISABLE_PASSWORD_LOGIN, etc.)check:deprecated-versions— advisory (exit 0), 66 pre-existing drifts across unrelated docscheck:doc-links— PASScheck:fabricated-docs— PASS