Skip to content

Fix tuple resource list handling in mgmt generator#59363

Merged
ArcturusZhang merged 4 commits into
Azure:mainfrom
ArcturusZhang:fix/tuple-resource-list-handling
May 25, 2026
Merged

Fix tuple resource list handling in mgmt generator#59363
ArcturusZhang merged 4 commits into
Azure:mainfrom
ArcturusZhang:fix/tuple-resource-list-handling

Conversation

@ArcturusZhang
Copy link
Copy Markdown
Member

Summary

  • classify basic array-returning operations as resource list methods
  • support tuple-resource intermediate collection paths by matching operation paths as prefixes of resource instance paths
  • emit all collection GetAll overloads when multiple list operations target the same resource collection

Validation

  • npm exec -- vitest run -c .\emitter\vitest.config.ts .\emitter\test\resource-detection.test.ts
  • npm run prettier
  • npm run lint
  • dotnet test eng\packages\http-client-csharp-mgmt\generator\Azure.Generator.Management\test\Azure.Generator.Mgmt.Tests.csproj --filter ResourceCollectionClientProviderTests
  • RegenSdkLocal.ps1 -Services "Azure.ResourceManager.Compute" -LocalSpecRepoPath "C:\Users\dapzhang\Documents\workspace\spec-compute-wt"
  • dotnet build sdk\compute\Azure.ResourceManager.Compute\tests\Azure.ResourceManager.Compute.Tests.csproj /p:RunApiCompat=false /p:ApiCompatValidateAssemblies=false /p:ApiCompatValidatePackage=false

Classify array-returning tuple resource list operations as resource lists and emit all matching collection GetAll overloads so Compute extension image list operations remain available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added CodeGen Issues that relate to code generation Mgmt This issue is related to a management package. labels May 20, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ArcturusZhang ArcturusZhang marked this pull request as ready for review May 25, 2026 02:02
Copilot AI review requested due to automatic review settings May 25, 2026 02:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Azure Management (TypeSpec) emitter and C# mgmt generator to more reliably classify array-returning GET operations as resource list methods, including tuple-resource intermediate collection paths, and to generate multiple GetAll overloads when several list operations map to the same collection.

Changes:

  • Adjust list-target resource matching to treat an operation path as a prefix of a resource’s instance path (better handling of tuple-resource intermediate collection paths).
  • Update the C# ResourceCollectionClientProvider to keep and emit multiple list (GetAll/GetAllAsync) methods, with ordering to select a canonical list method for contextual operation mapping.
  • Add/adjust emitter tests and update resource detection documentation to reflect the new matching rules.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/storage/Azure.ResourceManager.Storage/tsp-location.yaml Normalizes additionalDirectories formatting in the TypeSpec location config.
eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/ResourceCollectionClientProvider.cs Tracks multiple list methods, selects a canonical list method for context, and emits all GetAll overloads.
eng/packages/http-client-csharp-mgmt/emitter/test/resource-detection.test.ts Adds coverage for tuple-resource intermediate list paths and updates TrafficManager custom resource expectations to include list.
eng/packages/http-client-csharp-mgmt/emitter/src/resource-detection.ts Changes list-target matching from exact collection-path match to prefix match against the resource instance path.
eng/packages/http-client-csharp-mgmt/docs/resource-detection.md Updates the documented list-matching algorithm to the new prefix-first behavior with scope-level fallback.

ArcturusZhang and others added 2 commits May 25, 2026 11:16
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ArcturusZhang ArcturusZhang merged commit ce460ef into Azure:main May 25, 2026
25 checks passed
@ArcturusZhang ArcturusZhang deleted the fix/tuple-resource-list-handling branch May 25, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CodeGen Issues that relate to code generation Mgmt This issue is related to a management package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants