fix: narrow ARM metadata filter to only strip exclusively read-only properties#3931
Merged
JialinHuang803 merged 5 commits intomainfrom Apr 23, 2026
Merged
fix: narrow ARM metadata filter to only strip exclusively read-only properties#3931JialinHuang803 merged 5 commits intomainfrom
JialinHuang803 merged 5 commits intomainfrom
Conversation
…roperties The condition in buildModelInterface was too broad - it stripped any property with Visibility.Read (even if it had other visibilities too), which caused @path properties on parameter bag models to be incorrectly removed. Fix: require p.visibility?.length === 1 so only truly read-only (exclusively Visibility.Read) properties are filtered out in ARM mode. Add scenario test: models/arm/pathPropertyInParameterBag.md Agent-Logs-Url: https://github.com/Azure/autorest.typescript/sessions/d8d0fef5-8c72-4a9c-aecd-e64f91755e1c Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ARM metadata filter for parameter bag models
fix: narrow ARM metadata filter to only strip exclusively read-only properties
Apr 22, 2026
Member
|
@copilot could you add more uts about visibility cases like |
…e&Create cases Agent-Logs-Url: https://github.com/Azure/autorest.typescript/sessions/43e77bb1-a896-4e24-af7f-f4bd39018215 Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com>
Contributor
Author
Added three new scenario files in
|
| @@ -0,0 +1,66 @@ | |||
| # ARM metadata filter should preserve @path property with Read & Create visibility | |||
Member
There was a problem hiding this comment.
There are four ut files for this case. Does it make sense to combine them into one?
Contributor
Author
There was a problem hiding this comment.
Done in commit 94b2fca. All four scenario files are now consolidated into a single armMetadataFilter.md with four #-level scenarios (default multi-flag @path, Read & Create, Read only, and Read & Update & Create).
…dataFilter.md Agent-Logs-Url: https://github.com/Azure/autorest.typescript/sessions/f5acd95e-aed2-4be5-b46d-776ced2b3502 Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com>
JialinHuang803
approved these changes
Apr 23, 2026
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.
In ARM mode, the metadata property filter in
buildModelInterfacewas stripping@pathproperties from any model where the property's visibility set containedVisibility.Read— including plain parameter bag models with no ARM base class. Since@pathproperties carry multiple visibility flags (Read | Create | Update | ...), they were incorrectly filtered out, producing empty interfaces and downstream TypeScript compile failures.Changes
src/modular/emitModels.ts— Tighten the ARM metadata filter condition fromp.visibility?.includes(Visibility.Read)top.visibility?.length === 1 && p.visibility?.includes(Visibility.Read), so only properties that are exclusively read-only are removed.test/modularUnit/scenarios/models/arm/pathPropertyInParameterBag.md— New scenario test reproducing the reported pattern: an ARM service with a plainPrivateLinkParametersmodel carrying a@path privateLinkNameproperty. Verifies the property survives into the generated interface.test/modularUnit/scenarios/models/arm/armReadCreateVisibility.md— Scenario test verifying a@pathproperty withRead & Createvisibility is preserved in the generated interface.test/modularUnit/scenarios/models/arm/armReadOnlyVisibility.md— Scenario test verifying a@pathproperty with exclusivelyReadvisibility is correctly stripped (interface remains empty).test/modularUnit/scenarios/models/arm/armReadUpdateCreateVisibility.md— Scenario test verifying a@pathproperty withRead & Update & Createvisibility is preserved in the generated interface.Before fix:
After fix: