Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Description

Extension resources with specific parent scopes (e.g., Extension.ExternalResource<>) were being flattened to generic "Extension" scope, losing the specific parent resource type. This breaks C# path handling which interprets "Extension" as a generic scope parameter (/{scope}/providers/...).

Changes

Schema Extension

  • Added optional specificExtensionScope field to ResourceMetadata in both TypeScript and C# schemas
  • Captures extension type when scope is:
    • String literal: "Scope" or "ExternalResource"
    • ResolvedResource: parent resource type (e.g., "Microsoft.Compute/virtualMachines")

Emitter Updates

  • Modified convertScopeToResourceScope() to return both ResourceScope enum and specificExtensionScope
  • Updated convertResolvedResourceToMetadata() to populate new field from scope information

Testing

  • Added test case validating specific extension scope preservation
  • All existing tests pass (30 TypeScript, 91 C#)

Example

For a VM extension scoped to a VirtualMachine resource:

// Before: Lost specific parent information
{ resourceScope: "Extension" }

// After: Preserves parent resource type
{ 
  resourceScope: "Extension",
  specificExtensionScope: "Microsoft.Compute/virtualMachines"
}

The field is optional and backward compatible. C# generator can leverage this in future enhancements to correctly handle specific extension scenarios.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.
Original prompt

This section details on the original issue you should resolve

<issue_title>[Azure Mgmt Generator] Support "specific extension"</issue_title>
<issue_description>Now our generator just make resources with "specific extension" as "Extension". This information is not enough.
For instance, for a resource like this:

alias VM = Extension.ExternalResource<>;

resolveArmResources returns a ResolvedResource with a specific "external resource" as its scope, but we did not handle it now, therefore it will have a scope of "Extension".
This could also happen when the resource is written by using a complicated "legacy operation".

This causes an issue in the C# part because C# part actually understands the "Extension" as scope as a resource path like those with scope parameters: /{scope}/providers/...

Therefore we need to refine both parts to make things correct.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 22, 2026 09:16
Co-authored-by: live1206 <5196139+live1206@users.noreply.github.com>
Co-authored-by: live1206 <5196139+live1206@users.noreply.github.com>
Co-authored-by: live1206 <5196139+live1206@users.noreply.github.com>
Copilot AI changed the title [WIP] Refine handling for specific extension resources [Mgmt Generator] Preserve specific extension scope information Jan 22, 2026
Copilot AI requested a review from live1206 January 22, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Azure Mgmt Generator] Support "specific extension"

2 participants