fix(angular): emit filterParams helper for acronym tags in tags-split#3640
fix(angular): emit filterParams helper for acronym tags in tags-split#3640wadakatu wants to merge 1 commit into
Conversation
In tags-split mode the per-tag output file is keyed by `kebab(tags[0])`,
but `getRelevantVerbOptionsForTag` matched tags with `camel`. `camel` is
not idempotent through that round-trip for acronym tags — e.g.
camel('AB Widget') === 'aBWidget' but camel(kebab('AB Widget')) === 'abWidget'
— so every operation was dropped and the shared `filterParams` helper was
suppressed while the operation still called it, producing TS2304.
Match on `kebab` to mirror the writer's grouping key. Adds a regression
spec/test covering an acronym tag alongside a single-word control tag.
Closes orval-labs#3634
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFixes a bug where Angular services generated in ChangesAngular tags-split filterParams fix (issue-3634)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes a bug in Angular tags-split generation where services for acronym-leading tags (e.g. AB Widget) could call filterParams(...) without emitting the shared helper, causing TS2304: Cannot find name 'filterParams'.
Changes:
- Align tag matching in
getRelevantVerbOptionsForTagwith the writer’s grouping key by comparing tags viakebab(...)instead ofcamel(...). - Add a regression OpenAPI spec and Angular tags-split test config for issue #3634.
- Add a focused generation assertion and new snapshots proving
filterParamsis emitted for the acronym-tag service.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/angular/src/utils.ts | Fixes tag filtering by matching tags using kebab(...), ensuring helpers are emitted for the correct per-tag output file. |
| tests/specifications/issue-3634.yaml | Adds a minimal spec reproducing the acronym-tag filterParams emission bug. |
| tests/configs/angular.config.ts | Wires the new issue fixture into the Angular generation test matrix (tags-split). |
| tests/api-generation.spec.ts | Adds a targeted assertion that the acronym-tag service both calls and defines filterParams. |
| tests/snapshots/angular/issue-3634/** | Adds generated output snapshots demonstrating the corrected helper emission. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Heads up @wadakatu. I was working in it as well — we independently converged on the same fix… 😇 Your PR cleanly resolves #3634. I opened #3641 which builds on the same root cause and goes further: generalizes the rule into a single cc: @melloware |
|
Thank you for your PR! |
Summary
Fixes a
TS2304: Cannot find name 'filterParams'error in Angulartags-splitoutput for tags whose first word is an acronym (e.g.AB Widget). The generated service calls the sharedfilterParamshelper but never defines or imports it. Single-word tags (Widget) and ordinary multi-word tags (User Account) were unaffected.Root cause
In
tags-splitmode each per-tag output file is keyed bykebab(operation.tags[0])(packages/core/src/writers/target-tags.ts), and that kebab-cased string is passed to the Angular header builder astag. ButgetRelevantVerbOptionsForTag— which decides whether the sharedfilterParamshelper is emitted — matched tags withcamel:camel('ab-widget')→'abWidget'(the incoming kebab-cased tag)camel('AB Widget')→'aBWidget'(the operation's original tag — the acronym keeps its second capital)'abWidget' !== 'aBWidget', so every operation was filtered out,hasBuiltInFilteredQueryParamsbecamefalse, and the helper was suppressed — while the operation body still calledfilterParams.camelis not idempotent through akebabround-trip for acronym tags, which is why only those tags broke.Fix
Match on
kebabinstead ofcamelingetRelevantVerbOptionsForTagso the comparison mirrors the writer's grouping key (kebab(tags[0])).kebabis idempotent (kebab('ab-widget') === 'ab-widget') andDefaultTagis unaffected (kebab('default') === 'default'). This is a single shared function, so the fix covers thehttpClient,httpResource, andbothAngular modes at once.Tests
tests/specifications/issue-3634.yamlwith a single-word control tag (Widget) and an acronym trigger tag (AB Widget), wired through a newtags-splitAngular config.tests/api-generation.spec.tsthat the acronym-tag service definesfilterParams(fails before the fix, passes after).orval-tests build); full snapshot suite passes with no churn on existing fixtures.Closes #3634
Summary by CodeRabbit
Bug Fixes
Tests