[TCGC] Fix enum type exclusion in protocol methods when @convenientAPI(false)#3767
Conversation
|
@copilot You need to make the change based on the branch: release/january-2026. |
Done! I've rebased the changes onto The changes are ready but there's a technical issue with force-pushing the updated branch due to the different base. The fix itself remains identical - removing the |
Remove generateConvenient check for HTTP operation parameters so that types referenced in query, header, and path parameters always get Input usage, even when convenientAPI is false. This ensures enums and other types are included in the generated output. The check is still kept for method parameters and body parameters as intended. Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
91e282d to
218ee70
Compare
commit: |
weidongxu-microsoft
left a comment
There was a problem hiding this comment.
Java would actually generate String or String[] on protocol API. So in scenario of Java, we actually would like it be no Input.
But for now, Java is not using TCGC calculation
Summary
Fixed enum types not being included in generated output when
@convenientAPI(false)is used with HTTP operation parameters. Now based on release/january-2026 branch as requested by @tadelesh.Changes Made
Modified
updateTypesFromOperationintypes.ts: Removed thegenerateConvenientcheck for HTTP operation parameters so that types referenced in these parameters always get Input usage, regardless of the convenient API setting.Added comprehensive tests: Created three test cases in
convenient-api.test.tsto verify that enums in query, header, and path parameters receive Input usage even when@convenientAPI(false)is set.Root Cause
The bug occurred because TCGC was skipping input usage updates for ALL parameters when
generateConvenientwas false. However, HTTP operation parameters (query, header, path) represent the actual protocol-level parameters that must be included in the generated code.Fix Details
generateConvenientcheckgenerateConvenientcheckgenerateConvenientcheck (the fix)This ensures that types like enums used in HTTP parameters are always included in the output.
Branch Update
Rebased changes onto
release/january-2026as requested.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.