Add C# client customizations for Compute TypeSpec migration#41351
Merged
ArthurMa1978 merged 113 commits intoJun 18, 2026
Merged
Add C# client customizations for Compute TypeSpec migration#41351ArthurMa1978 merged 113 commits into
ArthurMa1978 merged 113 commits into
Conversation
- Add @azure-typespec/http-client-csharp-mgmt emitter config with namespace - Add 24 @@clientName decorators in Compute/client.tsp for backward compat - Create ComputeGallery/client.tsp with SharedToValues -> SharedToValue rename - Update root client.tsp to import ComputeGallery/client.tsp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Next Steps to Merge✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge.Comment generated by summarize-checks workflow run. |
8 tasks
- Renamed EdgeZone operations to avoid CollectionResult name collisions with non-EdgeZone counterparts (listPublishers, listOffers, listSkus, etc.) - Renamed VirtualMachineImages, Usage, VirtualMachineSizes, RunCommands, and LogAnalytics operations to match old API names Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… migration - @@clientName for CommunityGalleryImageProperties.identifier → ImageIdentifier (fixes CS0108 hiding) - @@clientName for SharedGalleryImageProperties.identifier → ImageIdentifier (fixes CS0108 hiding) - @@clientName for StorageAccountType → ImageStorageAccountType (fixes CS0234 missing type)
- Disk -> ManagedDisk (ManagedDiskResource, ManagedDiskData) - Image -> DiskImage (DiskImageResource, DiskImageData) - RestorePointCollection -> RestorePointGroup (RestorePointGroupResource, RestorePointGroupData) - PrivateEndpointConnection -> ComputePrivateEndpointConnection (RP-prefix convention) - SshPublicKeyResource -> SshPublicKey (SshPublicKeyResource, SshPublicKeyData) - VirtualMachineScaleSetVMRunCommands -> VirtualMachineScaleSetVmRunCommands (VM->Vm casing) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove @@clientName(SshPublicKeyResource, 'SshPublicKey') that collides with existing model SshPublicKey in models.tsp - Add @@clientName(RestorePointCollectionSourceProperties, 'RestorePointGroupSource') to match old SDK naming convention Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
VirtualMachineExtensions.list and VirtualMachineScaleSetVMExtensions.list return a single-page list result but need to be treated as pageable for the C# SDK to generate proper IEnumerable/IAsyncEnumerable support. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ations These 6 types were deprecated as ARM resources in the .NET SDK and replaced with hand-written custom code. Convert their TypeSpec definitions from ARM resource patterns (@parentResource, @armResourceOperations) to raw @route operations so the C# generator no longer treats them as ARM resources. - SharedGallery, SharedGalleryImage, SharedGalleryImageVersion - CommunityGallery, CommunityGalleryImage, CommunityGalleryImageVersion - Add @@clientName for operations to match old SDK method names - Swagger changes are description-only (no route/schema changes) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…shPublicKey Free up the 'SshPublicKey' name for the ARM resource by renaming the non-resource model (SSH key path/keyData) to SshPublicKeyConfiguration, matching the old AutoRest-generated SDK name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Batch rename of types to match old AutoRest-generated names: - RP-prefix prepending (ResourceSku→ComputeResourceSku, etc.) - Content/Input/Parameters suffix normalization - VirtualMachine prefix restoration - Gallery and Disk namespace renames Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SharedGallery→SharedGalleryData, CommunityGallery→CommunityGalleryData, etc. These types were ARM resources with Data suffix in the old SDK. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Plural→singular enums, RP-prefix renames, VM/IP casing, and other type name normalization. Resolves 53 of 66 TypesMustExist ApiCompat errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tiatedRedeploy public - Add '!csharp' scope to flattenProperty on VirtualMachineScaleSet.properties, VirtualMachineScaleSetVM.properties, VirtualMachineScaleSetUpdate.properties (C# SDK had flatten disabled in autorest.md) - Add @@access(AllInstancesDown/UserInitiatedRedeploy, public, csharp) — were internal due to single-property auto-flattening Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AllInstancesDown and UserInitiatedRedeploy need a generator option to disable safe-flatten. Reverted @@access decorators as they don't solve the root cause. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
gary-x-li
reviewed
Jun 16, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ient-customizations
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
live1206
reviewed
Jun 17, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
audreyttt
previously requested changes
Jun 17, 2026
audreyttt
left a comment
Member
There was a problem hiding this comment.
TypeSpec CI check is failing due to formatting, from Microsoft.Compute/Compute please run tsp format .
…ient-customizations
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ArthurMa1978
approved these changes
Jun 18, 2026
ArcturusZhang
added a commit
to Azure/azure-sdk-for-net
that referenced
this pull request
Jun 18, 2026
* Remove redundant generator workarounds
- ManagementTypeFactory: Remove field dedup workaround — now handled by
emitter-side deduplicateApiVersionEnums (merged via PR #57160)
- KnownManagementTypes: Remove ResourceIdentifier serialization entries —
already present in base KnownAzureTypes, reached via fallback path
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Replace WrapResourceIdArgument with @@alternateType for Resource.id
Remove generator-side fix for CommonTypes v3 string id → ResourceIdentifier.
Instead, use @@alternateType(Resource.id, armResourceIdentifier, "csharp")
in the spec's client.tsp, which is the preferred spec-side approach.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove unused static Snippet import
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert unintended changes to csproj, sln, metadata.json and other RPs
Revert compute csproj/sln/metadata.json to main versions.
Remove netapp ghost rename artifacts from merge.
Revert computelimit/computeschedule/computefleet regeneration side-effects.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert style-only change in InheritableSystemObjectModelVisitor.cs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove customization code and regenerate clean compute SDK
Remove all custom code under Customize/ to isolate pure generated code issues.
Remove IncludeAutorestDependency from csproj.
Regenerate with @@alternateType for Resource.id.
Generated code has 183 unique errors (generator-side issues):
- CS0234 (153): 39 types have wrong namespace prefix
- CS0111 (14): Duplicate GetAll/GetByLocation methods
- CS0102 (6): Duplicate Type/AutomaticallyApprove properties
- CS0051 (8): Internal types used in public API
- CS0108 (2): Member hiding without 'new' keyword
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate compute with @@clientName decorators applied
- Regenerated from spec branch compute/add-csharp-client-customizations
which includes 130+ @@clientName, @@access, @@alternateType decorators
- All CS0234 (missing type) errors resolved via @@clientName renames
- All CS0108 (member hiding) errors resolved via @@clientName for Identifier
- Added ComputeUsageUnit stub type for backward-compat ModelFactory method
- Remaining: 30 CS0051 errors (generator bug: ModelFactory backward-compat
methods reference internal @flattenProperty types)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate Compute with resource renames and latest generator
- Regenerated with latest emitter (1.0.0-alpha.20260406.2)
- Resource renames via @@clientName: Disk→ManagedDisk, Image→DiskImage,
RestorePointCollection→RestorePointGroup, PrivateEndpointConnection→
ComputePrivateEndpointConnection, VMRunCommands→VmRunCommands casing
- RestorePointCollectionSourceProperties→RestorePointGroupSource
- Merged latest main for generator improvements
- Remaining: 10 CS0051 errors (ModelFactory internal types, generator bug)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove stale blank line in ArrayResponseOperationMethodProvider
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate Compute with latest official generator (1.0.0-alpha.20260406.2)
No local generator changes — using stock emitter from main.
10 CS0051 errors remain (generator bug #57525, internal @flattenProperty types).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Suppress ModelFactory overloads with internal @flattenProperty types
Add [CodeGenSuppress] for 10 backward-compat overloads in ArmComputeModelFactory
that incorrectly expose internal types (SharedGalleryIdentifier,
CommunityGalleryIdentifier, VirtualMachineScaleSetProperties,
VirtualMachineScaleSetVmProperties) in public method signatures.
Resolves all 10 CS0051 errors. Remaining 12 CS1061 errors are pre-existing
generator bugs (data.Id on gallery resources, GetEnumerator on extension
collections).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with markAsPageable for VM extension list operations
Fixes 6 CS1061 GetEnumerator errors on extension collections.
Remaining: 6 CS1061 errors (.Id on gallery data types).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate: gallery types as non-resources, clean build (0 errors)
- SharedGallery/CommunityGallery types are no longer ARM resources
- Updated CodeGenSuppress for renamed ModelFactory methods
- All 549 original errors resolved — clean build achieved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename SshPublicKey resource, export API — clean build milestone
- SshPublicKeyResource → SshPublicKey (resource), SshPublicKeyData (data)
- SshPublicKey (non-resource model) → SshPublicKeyConfiguration
- Exported API surface with Export-API.ps1
This is the first clean build (0 errors) for the Compute TypeSpec migration.
549 errors at start → 0 errors now.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix ModelFactory namespace to .Models, keep 4 CS0051 as known issue
- Fixed ArmComputeModelFactory customization namespace from
Azure.ResourceManager.Compute to Azure.ResourceManager.Compute.Models
- Cannot suppress 4 VMSS backward-compat overloads due to ExtendedLocation
type ambiguity in CodeGenSuppress (Compute.Models vs Resources.Models)
- 4 CS0051 remain: generator bug #57525
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Exclude ModelFactory temporarily, fix namespace, export API
- Exclude ArmComputeModelFactory.cs via Compile Remove in csproj
(generator bug #57525: internal types in public method signatures)
- Fix customization namespace to Azure.ResourceManager.Compute.Models
- Export API surface successfully
Clean build with 0 errors on all frameworks.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with 42 type renames, export API
Resolved 42 type name mismatches between old AutoRest and new TypeSpec generation.
Remaining diffs are expected (gallery non-resources, CloudService deprecated,
internal @flattenProperty types, new types from spec updates).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with Pir* renames, export API — type renames complete
All actionable type renames resolved (45 total @@clientName decorators).
Remaining type diffs are expected:
- Gallery non-resource conversions (18 types)
- CloudService deprecated types (8 types)
- Internal @flattenProperty types (3 types)
- New types from spec/common type exposure (23 types)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore gallery customization code with delegation pattern
- Rewrite SharedGallery/CommunityGallery Collection, Resource, and Data
customization files to delegate to generated extension methods
- Use [ForwardsClientCalls] + GetSubscriptionResource() pattern
- Gallery models renamed to *Data via spec @@clientName
- Remove CommunityGalleryInfo.cs (PublisherUri now generated as string)
- Clean build, API exported
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add CloudService deprecated stubs and REST operations
- 34 CloudService stub types with [Obsolete] and [EditorBrowsable(Never)]
(CloudService API deprecated, no TypeSpec spec available)
- All methods throw NotSupportedException
- Restored CloudService REST operations from main for backward compat
- Clean build with 0 errors including ApiCompat
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move CloudService models out of Generated, add StatusCodeCount stub
Generated/ is wiped on regeneration — CloudService model files must be in
Customize/ only. Removed 6 model files from Generated/ that were incorrectly
restored from main. Added missing StatusCodeCount stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add IJsonModel/IPersistableModel interfaces to CloudService stubs
All 28 CloudService stub types now implement the serialization interfaces
(IJsonModel<T>, IPersistableModel<T>) with NotSupportedException.
This resolves all CannotRemoveBaseTypeOrInterface ApiCompat errors.
Build: 0 errors, ApiCompat: 0 errors — fully passing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move CloudService model stubs to Models/ subdirectory
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with 53 type renames, fix OperatingSystemType suppress, export API
TypesMustExist: 132 → 13 (remaining are internal @flattenProperty types,
method parameter types, and types needing investigation).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with !csharp flattenProperty for VMSS types, export API
VMSS Properties types (VirtualMachineScaleSetProperties,
VirtualMachineScaleSetVmProperties, VirtualMachineScaleSetPatchProperties)
are now public in C# — matching old SDK behavior.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with PatchProperties, expand types, HostEndpointSettingsMode renames
TypesMustExist: 11 → 7. Remaining are blocked on generator fixes:
- AllInstancesDown, UserInitiatedRedeploy (#58066 safe-flatten)
- 4 SubscriptionResourceGet*Options (structural change)
- GetVirtualMachineImagesWithPropertiesExpand (parameter type change)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with 28 @@alternateType decorators — 0 ApiCompat errors
All ResourceIdentifier property type changes resolved. Full build passes
with 0 compilation errors AND 0 ApiCompat errors on all frameworks.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with SubResource/Identity alternateType — ApiCompat 2862→2806
- SubResource[]/WritableSubResource[] for list properties
- ManagedServiceIdentity for Identity properties
- ExtendedLocation blocked (name collision), needs separate solution
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix CloudService stubs: add JsonModelWriteCore, missing properties and methods
- JsonModelWriteCore on all 19 model/data types
- NetworkInterfaces: SubResource → WritableSubResource
- CloudServiceExtension: Settings/ProtectedSettings as BinaryData
- CloudServiceRoleInstanceCollection: GetAll overload with InstanceViewType
- CloudServiceRoleInstanceResource: GetRemoteDesktopFile returning Stream
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with OS casing, Uri alternateType, CloudService fixes — ApiCompat 2806→2594
- OS→OS property casing (osDisk→OSDisk, osProfile→OSProfile, etc.)
- Uri alternateType (privacyStatementUri, releaseNoteUri, etc.)
- CloudService stubs: JsonModelWriteCore, NetworkInterfaces, Settings, etc.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix CloudService stub properties: get-only lists, parameter names, GetAll signature
- Zones, Roles, OSSecrets, Extensions: remove setter (get-only)
- CloudServiceData: add JsonModelWriteCore override
- CloudServiceResource: roleInstances parameter name (not parameters)
- CloudServiceRoleInstanceCollection: single GetAll with optional expand
- CloudServiceNetworkProfile.LoadBalancerConfigurations: get-only
- CloudServiceVaultSecretGroup.VaultCertificates: get-only
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add CloudService extension method stubs — ApiCompat 2594→2554
- ComputeExtensions: 16 static extension methods
- MockableComputeArmClient: 5 GetCloudService*Resource methods
- MockableComputeResourceGroupResource: 3 methods
- MockableComputeSubscriptionResource: 8 methods
All throw NotSupportedException with [Obsolete] + [EditorBrowsable(Never)]
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with extensible enum wrappers, fix OperatingSystemTypes ref — ApiCompat 2554→2506
- ComponentName, PassName: extensible unions via @@alternateType
- OperatingSystemType blocked by name collision (TODO)
- TypeCannotChangeClassification: 6 → 0
- Fix ArmComputeModelFactory CodeGenSuppress for OperatingSystemTypes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add [ForwardsClientCalls] to CloudService extension stubs, [Obsolete] to tag methods
- ComputeExtensions: [ForwardsClientCalls] on 16 CloudService static methods
- CloudServiceRoleInstanceResource: [Obsolete] on AddTag/RemoveTag/SetTags
- ApiCompat: 2506→2494, CannotRemoveAttribute: 46→34
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add [ForwardsClientCalls] to CloudService instance method stubs
- CloudServiceResource: 4 Get methods
- MockableComputeResourceGroupResource: 2 Get methods
- MockableComputeSubscriptionResource: 4 Get methods
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with WritableSubResource[] fix and Uri alternateTypes — ApiCompat 2494→2368
- Fixed 11 IP config SubResource[] → WritableSubResource[]
- Added 17 Uri alternateType decorators (KeyVault, VHD, etc.)
- CannotRemoveAttribute: 34 → 14
Overall: 3198 → 2368 (26% reduction)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix CloudService tag method Obsolete message to match old API exactly
CannotRemoveAttribute: 14 to 2 (only JsonConverter on KeyVaultSecretReference remains)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with 110 property renames — ApiCompat 2356 to 2078
MembersMustExist: 2226 to 1948 (-278)
Overall: 3198 to 2078 (35% reduction)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with final type change fixes — ApiCompat 2078 to 2084
Minor regression: TypesMustExist 16->22, CannotMakeMemberNonVirtual 30->36
due to moving uri property to base class. Needs investigation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate after reverting RestorePoint alternateType — ApiCompat 2076
Restored DiskRestorePointAttributes, RestorePointEncryption, RestorePointEncryptionType.
Gallery uri fix retained (moved to base class).
Overall: 3198 to 2076 (35% reduction)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with ExtendedLocation ARM common type — ApiCompat 2076 to 2050
Overall: 3198 to 2050 (36% reduction)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate with ExtendedLocationType alternateType — ApiCompat 2050 to 2048
Overall: 3198 to 2048 (36% reduction)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add markAsPageable for GetPrivateLinkResources and GetVirtualMachineImagesByEdgeZone — ApiCompat 1022 per framework
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore VMSS customization code with justification comments — ApiCompat 887 per framework
Restored 17 VMSS customization files, adapted to new generator output:
- Unflatten properties (Data/Patch/VmProfile): redirect to nested Properties
- Method overloads (Collection/Resource/VmResource): delegate to MatchConditions versions
- Tag operations (RollingUpgradeResource): stub with NotSupportedException (Obsolete)
- KeyVaultProtectedSettings: alias to generated ProtectedSettingsFromKeyVault
- Extension name constructor: use this() + Name setter
- Removed 4 Id-override files (no longer inherit ComputeWriteableSubResourceData)
- Removed serialization override (generator now handles correctly)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add VmSizeType member casing clientName decorators (65 fixes) — ApiCompat 822 per framework
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regen after spec merge + VMExtImage tag stubs — ApiCompat 804 per framework
- Merged latest main into spec branch (fixes GalleryScript update response body)
- Added VirtualMachineExtensionImageResource tag operation stubs (Obsolete+NotSupported)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix OperatingSystemType/SupportedOperatingSystemType name swap
The existing @@clientName decorator was renaming the wrong type:
- Compute.OperatingSystemTypes (closed enum) stayed as `OperatingSystemTypes`, not matching the old SDK's `SupportedOperatingSystemType` enum.
- Compute.OperatingSystemType (extensible union) was renamed to `SupportedOperatingSystemType`, stealing the old enum's name and silently swapping type shapes.
Fix: rename the closed enum to `SupportedOperatingSystemType` in csharp and leave the extensible union as `OperatingSystemType` — matching the old AutoRest SDK contract.
Also includes SaveInputs artifacts (tspCodeModel.json, Configuration.json) from the regeneration for diagnostic reference.
ApiCompat: 1606 -> 1548 per framework.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [Mgmt Generator] Flatten required value-type from optional parent as Nullable<T>
PropertyFlatten emitted required value-type inner properties (e.g. required enum or primitive) as non-nullable on the flattened wrapper, even when the parent `properties?:` reference is optional and can be null at runtime. The public getter is null-guarded (returns `default`), so callers observe a silent zero-value instead of a true `null`, and the shape diverges from the ModelFactory parameter emitted by IsOverriddenValueType.
Apply WithNullable(true) on the FlattenedPropertyProvider type in PropertyFlatten, mirroring SafeFlatten. Fix the companion setter in BuildSetterForPropertyFlatten to unwrap with .Value when the inner target is a non-nullable value type (previously the branch keyed off `inner IsNullable` which was never true post-flatten, causing NRE risk for already-nullable inner properties).
Regenerates affected TestProjects and adds a unit test.
Fixes #58288.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add required value-type flatten test case to Mgmt-TypeSpec test project
Adds `requiredInt: int32`, `requiredFixedEnum: FooFixedMode` (closed enum), and `requiredExtensibleEnum: FooProvisioningState` (extensible union) to `FooProperties`. Since `Foo` uses `TrackedResource<FooProperties, false>` (`properties?:` is always optional at the TypeSpec level), the flattened `RequiredInt`, `RequiredFixedEnum`, and `RequiredExtensibleEnum` properties on `FooData` should be `T?` — this exercises all three value-type flavors covered by the PropertyFlatten fix.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [Mgmt Generator] Overhaul flatten: lift required value-type from optional parent as Nullable<T>
Replaces the prior single-line lift with a property-level overhaul:
- Predicate now requires BOTH parent-may-be-absent AND inner-required-value-type
- Public ctor parameter stays non-nullable T (caller MUST provide); body builds parent unconditionally
- Public property setter uses HasValue guard + creates parent on demand; null is no-op (preserves sibling required leaves)
- Model factory parameter is Nullable<T> with .GetValueOrDefault() in body so callers can omit; all-null guard skips non-nullable params
- Adds IsLiftedFromValueType flag on FlattenedPropertyProvider to drive these decisions
- Test project: requiredInt / requiredFixedEnum / requiredExtensibleEnum on optional FooProperties exercise the lifted path
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Switch flatten test fixture to optional properties? (true) + force flatten
Foo previously used <FooProperties, false> which made properties required.
That happens to also exercise the auto-flatten path, but doesn't reproduce the
real-RP scenario the overhaul fixes (optional wrapper + required inner value
type lifted to Nullable<T>).
Switch to:
- TrackedResource<FooProperties, true> (default-optional)
- explicit @@Azure.ClientGenerator.Core.Legacy.flattenProperty(Foo.properties)
to opt the test fixture into flattening even when the parent is optional.
Verified generated FooData.cs and MgmtTypeSpecTestsModelFactory.cs:
- Public property: int? RequiredInt with HasValue-guarded setter (no .Value
on null assignment).
- Public ctor: only AzureLocation location (parent is now optional, no
required leaves to surface in the ctor).
- Model factory: nullable int? requiredInt = default parameter, body uses
equiredInt.GetValueOrDefault() and the all-null guard correctly skips
the optional inner construction.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move flatten lift-to-nullable test fixture from Foo to Zoo
Restore Foo to its original `<FooProperties, false>` shape (required parent,
auto-flattened) so it continues to exercise the existing required-parent
flatten path without lifting (case [b]: required inner stays as T).
Add a separate Zoo fixture for the new `optional wrapper + required inner
value-type` path (case [a]: lift to `Nullable<T>`):
- ZooProperties gains 3 required value-type fields (int32, fixed enum,
extensible enum union).
- Defines ZooFixedMode and ZooProvisioningState.
- Adds `@@Azure.ClientGenerator.Core.Legacy.flattenProperty(Zoo.properties)`
to opt the default-optional `properties?:` into flattening (the test
project's auto-flatten only fires for required parents).
Generated ZooData.cs and MgmtTypeSpecTestsModelFactory.cs verify the lift:
- `public int? RequiredInt` with HasValue-guarded setter.
- Public ctor remains `ZooData(AzureLocation location)` (parent optional).
- Model factory: `int? requiredInt = default` parameter, body uses
`requiredInt.GetValueOrDefault()` and the all-null guard correctly
includes the lifted parameters.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [Mgmt Generator] Unified flatten lift-to-nullable rule
Overhaul PropertyFlatten and SafeFlatten so lift-to-nullable depends only on the wrapper-property's optionality, symmetrically for value and reference types:
- wrapper required -> flattened property keeps inner type as-is
- wrapper optional -> flattened property is nullable
Applies uniformly to the public property type, the public ctor parameter handling, and the model-factory parameter. Renames FlattenedPropertyProvider.IsLiftedFromValueType -> IsLiftedToNullable. Generalizes BuildSetterForPropertyFlatten / BuildSetterForSafeFlatten to handle ref-type lifts and fixes a latent casing bug in the SafeFlatten clear-parent branch. Removes the legacy IsOverriddenValueType fallback.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore lazy-create-and-assign setter shape for flatten lifts
Address PR review feedback: the previous lifted-property setters either silently no-op'd on null assignments (PropertyFlatten) or wiped the parent (SafeFlatten), both of which are unnecessary behavior changes vs the original setter. Revert to the original 'if (parent is null) parent = new(); parent.X = value;' shape, with the only adaptation being .GetValueOrDefault() for value-type lifts where the public parameter is now Nullable<T>.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate test projects after merging main
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Skip GetValueOrDefault when inner property is already nullable
When the inner property is already a nullable value type (e.g. bool?), the public flattened property has the same type as the inner, so we can assign value directly. .GetValueOrDefault() is only needed when the inner is a non-nullable value type and we're lifting it to Nullable<T>.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regen test projects after npm install (pick up bumped base emitter)
The previous regen used a stale node_modules from before the merge of
main, which still had the old base emitter that emitted RenewalMode and
the saasResourceId/extra fields on MarketplaceDetails/OfferDetails.
After 'npm install' the bumped base emitter (#58419) is in effect and
those artifacts are correctly removed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Guard lifted value-type setter on value.HasValue (no-op on null)
When a non-nullable value-type inner is lifted to Nullable<T> on the public
API surface (because the wrapper parent is optional), the previous setter
unconditionally executed 'parent.X = value.GetValueOrDefault()', which
silently overwrote the inner leaf with default(T) (e.g. 0) when the caller
assigned null. Wrap the lazy-create-and-assign body in 'if (value.HasValue)'
so a null assignment is a no-op for both PropertyFlatten and the
includeSetterCheck=true branch of SafeFlatten.
For the SafeFlatten branch with includeSetterCheck=false (inner has only the
single required value-type leaf as ctor arg) the parent's only meaningful
state IS that one value, so assigning null is interpreted as 'erase the
parent' via the existing ternary 'parent = value.HasValue ? new(value.Value) : default'.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix model factory: preserve IEnumerable for collection params and skip null check for required wrappers
UpdateModelFactoryMethod: always start from Type.InputType so collections become IEnumerable<T> in factory signatures (regression introduced by the unified flatten rule). BuildConditionExpression: when the wrapper is required (no leaf has IsLiftedToNullable), return null so the factory always constructs the wrapper unconditionally - previously the check excluded required leaves and could silently drop user-provided values.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* billingbenefits: mitigate flatten/lift-to-nullable break for EntityType
Rename flattened MaccModelProperties.entityType to BenefitEntityType in spec
(client.tsp), then preserve original public `EntityType` property as an
[EditorBrowsable(Never)] [Obsolete] shim with the original non-nullable
`MaccEntityType` type on ContributorData, MaccData, ApplicableMacc, and
MaccValidateModel.
Hand-copy the affected `Arm{Service}ModelFactory` factory methods to keep
the original `entityType` parameter name (avoid named-arg source break).
Spec: Azure/azure-rest-api-specs#42594
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Apply naming review comments and convert remarks to plain comments
- Apply spec @@clientName edits and corresponding SDK shim updates for
certificateregistration, lambdatesthyperexecute, mongocluster, oracle,
servicefabricmanagedclusters
- Regenerate affected RPs and re-export public API
- Convert backward-compat shim <remarks> XML doc blocks to plain // comments
across artifactsigning, billingbenefits, certificateregistration
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update tsp-location.yaml commit SHA to spec branch HEAD
Point all 7 customized RPs (artifactsigning, billingbenefits,
certificateregistration, lambdatesthyperexecute, mongocluster, oracle,
servicefabricmanagedclusters) at spec branch HEAD 222942248f, which
includes the latest naming-review @@clientName edits.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove regenerated RP changes (kept in preview branch)
This PR is now scoped to mgmt generator changes only, for narrow review.
All regenerated SDK output (and corresponding shims) is preserved in the
sibling preview PR for end-to-end visualization:
https://github.com/Azure/azure-sdk-for-net/pull/58628
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove backward-compat shim files (kept in preview branch)
Companion to the prior revert. These Custom/ shim files were added
alongside the regenerated RPs and are not needed when the regen output
is excluded from this PR. Preview PR #58628 retains them.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Migrate test asserts to NUnit 4 syntax
Repo upgraded to NUnit 4 (#58316), which removed Assert.IsNotNull /
Assert.IsTrue. Replace with Assert.That(..., Is.Not.Null) / Is.True.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Document property flatten nullability and setter behavior
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regen Compute against generator-merged base + bump tsp-location
Bumped sdk/compute/Azure.ResourceManager.Compute/tsp-location.yaml to spec commit 28e16cac1c (compute/add-csharp-client-customizations branch with the stale GalleryArtifactVersionSource.uri alternateType removed).
Net ApiCompat impact (per framework): -30 (33 resolved, 4 new). All 30 resolved errors are flatten-related Nullable<T> property reinstatement on optional-wrapper required value-type leaves (OSState, OSType, SupportedOSType, PlatformFaultDomainCount, DefaultAccess, Mode). The 4 new and 3 trivially-resolved are an unrelated GalleryArtifactVersionSource.Uri spec gap (the uri property no longer exists on the model).
Also removed stale Configuration.json + tspCodeModel.json intermediate build artifacts (other migrated RPs do not check these in).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate compute against latest spec + 2025-11-01 API version
Bumps tsp-location.yaml to spec commit 2d6ac45435 which adds:
- @@alternateType(SubResource.id, armResourceIdentifier, csharp)
- @@alternateType(ApiEntityReference.id, armResourceIdentifier, csharp)
- @@alternateType(VirtualMachineImageResource.location, azureLocation, csharp)
Regen also picks up the 2025-11-01 ComputeRP release brought in via
the latest main merge.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate compute after removing 3 scalar SubResource @@alternateType decorators
The 3 `networkSecurityGroup` properties on VirtualMachineScaleSetNetworkConfigurationProperties,
VirtualMachineScaleSetUpdateNetworkConfigurationProperties, and
VirtualMachineNetworkInterfaceConfigurationProperties no longer use `@@alternateType(..., SubResource, `csharp`)`.
The new generator now correctly emits these as internal properties with auto-flattened
`NetworkSecurityGroupId: ResourceIdentifier` accessors, matching the legacy AutoRest shape.
Spec change: Azure/azure-rest-api-specs#41351 commit 0d844ec49a
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Regenerate compute after swapping Common.SubResource csharp rename
Spec change: Azure/azure-rest-api-specs#41351 commit 83f0866cc6d
Maps Common.SubResource ↔ ComputeWriteableSubResourceData and
Common.SubResourceReadOnly ↔ ComputeSubResourceData (was inverted).
Restores correct base classes for ImageReference, VirtualMachineImage,
VirtualMachineCaptureResult, VirtualMachineManagedDisk,
VirtualMachineNetworkInterfaceReference, ComputeSubResourceDataWithColocationStatus,
DiskRestorePointAttributes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore VirtualMachineImages*Options bag forwarding overloads
The previous (AutoRest-based) generator produced *Options bag types when
a method had more than 6 parameters. The new TypeSpec generator emits
multi-parameter methods directly. Re-introduce the four bags plus the
GetVirtualMachineImagesWithPropertiesExpand enum and add forwarding
overloads on ComputeExtensions and MockableComputeSubscriptionResource
so the public surface remains source/binary-compatible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore [JsonConverter] on KeyVaultSecretReference via customization
The previous SDK had [JsonConverter(typeof(KeyVaultSecretReferenceConverter))]
on this model. The mgmt TypeSpec generator does not currently honor the TCGC
@useSystemTextJsonConverter decorator, so we re-add the attribute and the
companion converter class via a partial in src/Customize/.
Bumps tsp-location.yaml to spec commit 114af47b20.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Mgmt generator: emit a GetAll overload per List operation for tuple resources
For a uple resource' (a resource needing multiple path keys from its parent
to identify a single instance), the spec may declare several list operations
at different parent scopes. ResourceCollectionClientProvider previously kept
only the FIRST List-kind ResourceMethod as the canonical _getAll, silently
dropping the others. This caused both:
- the collection's contextual scope (and ctor signature) to be derived from
whichever list happened to be first,
- and loss of the additional GetAll overload(s) that should expose the
narrower-scope list operations.
Fix:
- Collect every List-kind method in InitializeMethods.
- Order them by fewest extra variable path segments beyond the collection's
contextual path (broadest scope wins), so the canonical _getAll drives the
secondary contextual path / extra ctor parameters as before.
- In BuildGetAllMethods iterate _getAlls and emit one async/sync pair per
list operation, with sync-signature based de-dup. Cache the canonical sync
provider for the existing IEnumerable / GetEnumerator() decisions.
Verified on Azure.ResourceManager.Compute's VirtualMachineExtensionImage
resource (subscription / location / publisher / type / version), which has
listTypes (publisher scope) and listVersions (type scope). Before the fix:
collection ctor took (location, publisher, type) and exposed only
GetAll(filter, top, orderby); listTypes was orphaned in REST ops. After the
fix the collection matches the GA contract: ctor (location, publisher), and
GetAll(), GetAll(type, filter, top, orderby), Get(type, version) overloads.
All 162 generator unit tests pass; no snapshot baselines for non-tuple
resource test projects changed.
Refs https://github.com/Azure/azure-sdk-for-net/issues/58735
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: restore (ifMatch, ifNoneMatch) string overloads on VM* Update/CreateOrUpdate/GetAll
The new TypeSpec API uses MatchConditions in place of two positional ifMatch/ifNoneMatch
string params, and VirtualMachineCollection.GetAll no longer exposes statusOnly.
Add EditorBrowsableNever shims that wrap the two strings into MatchConditions
(or drop statusOnly) and forward to the generated overload.
Resolves 14 ApiCompat MembersMustExist errors.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Mgmt generator: use CrossLanguageDefinitionId for ArrayResponse CollectionResult class names
Temporary local copy of the fix in #58793 so RegenSdkLocal works for
Compute on this branch before #58793 lands. Will be removed when main
is merged back into this branch after #58793 merges.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regenerate against spec a20c1a2c94 (8 @@clientName renames) with new CollectionResult naming
- Bumps tsp-location.yaml to spec commit a20c1a2c94, which adds 8 @@clientName decorators
in client.tsp to restore previously shipped operation names (PowerOn,
MigrateToVirtualMachineScaleSet, CancelVirtualMachineScaleSetRollingUpgrade,
StartExtensionUpgradeVirtualMachineScaleSetRollingUpgrade, UpdateSharingProfile,
GetSoftDeletedResourcesByArtifactName).
- Picks up the new CrossLanguageDefinitionId-based ArrayResponse CollectionResult
class names from the previous commit, which also resolves a CollectionResult naming
collision on VirtualMachineExtensionImageCollection's two GetAll overloads.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regen with @@alternateType to restore AllInstancesDown / UserInitiatedRedeploy as wrapper types
Defeats the mgmt generator's safe-flatten heuristic on these single-property
models. Restores the 1.x SDK API surface for Models.AllInstancesDown and
Models.UserInitiatedRedeploy. Adds a public 'Dummy' string property on each
wrapper as the safe-flatten escape hatch (the inner property count must
exceed 1 to skip safe-flatten). Resolves 2 TypesMustExist + 4 related
MembersMustExist ApiCompat breaks vs Azure.ResourceManager.Compute 1.14.0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert "Compute: regen with @@alternateType to restore AllInstancesDown / UserInitiatedRedeploy as wrapper types"
This reverts commit 3c20e68c5fe79ed287a385edf8aa7650056a03b3.
* [mgmt-generator] Add disable-safe-flatten clientOption opt-out
Adds a new `@@clientOption(Model, "disable-safe-flatten", true, "csharp")`
opt-out for the C# management generator's safe-flatten transform. When the
decorator is present on an inner model, the generator preserves it as a
public type instead of lifting its single property onto the parent.
Use case: spec authors migrating from AutoRest who previously relied on
`safe-flatten: false` directives to keep certain wrapper types public for
backward compatibility.
Implementation
--------------
- emitter/src/sdk-context-options.ts: add `Azure.ClientGenerator.Core.@clientOption`
to the TCGC `additionalDecorators` list so the decorator propagates
onto `InputModelType.Decorators` in tspCodeModel.json.
- ManagementInputLibrary.cs: new `SafeFlattenDisabledModels` HashSet built
by scanning every input model's decorators for the new opt-out key.
- ManagementOutputLibrary.cs: translate the input set to a
`HashSet<ModelProvider>` via TypeFactory.CreateModel.
- FlattenPropertyVisitor.cs: add a 4th skip condition (after abstract /
discriminator-base / has-discriminator-property) that bypasses SafeFlatten
when the inner model is in the opted-out set.
- docs/client-options.md: document the new `disable-safe-flatten` key
alongside the existing resource-rbac-roles and resource-name-constraint keys.
Tracks Azure/azure-sdk-for-net#58066.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regen with disable-safe-flatten on AllInstancesDown / UserInitiatedRedeploy
Bumps tsp-location to 7336796bda which adds:
@@clientOption(AllInstancesDown, "disable-safe-flatten", true, "csharp")
@@clientOption(UserInitiatedRedeploy, "disable-safe-flatten", true, "csharp")
Restores both wrapper types as public, eliminating the 2 TypesMustExist
ApiCompat errors against the last GA. Replaces the previous @@clientName
collision-renames on .automaticallyApprove (no longer needed because the
wrapper types are preserved as separate public surface).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [mgmt-generator] Clarify TCGC clientOption argument naming
The second positional parameter of TCGC's @@clientOption decorator is named `name` (not `key`), even though our docs and conceptual model refer to these as `keys`. Rename the local variable from `keyData`/`key` to `nameData`/`optionName` and add a comment so future readers don't assume this is a typo.
No behavior change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [mgmt-generator] disable-safe-flatten: only accept JSON boolean true
Drop the string "true" / case-insensitive fallback. The decorator value is fed through TCGC which always preserves the original literal type, so we never need to handle stringified booleans. Any non-boolean value (including the string "true", 1, false, etc.) is now silently ignored.
No behavior change for the only documented use case (`@@clientOption(Model, "disable-safe-flatten", true, "csharp")`).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [mgmt-generator] docs: clarify only boolean true is accepted
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* RegenSdkLocal.ps1: avoid sibling matches for full library names
The -Services filter currently pads every pattern with '*...*' wildcards,
so passing a full library name like 'Azure.ResourceManager.Compute' also
matches Azure.ResourceManager.ComputeFleet, ComputeLimit, ComputeSchedule,
and Compute.Recommender. That triples regen time and produces noise from
unrelated package failures.
Refine the matcher:
* If a pattern contains a wildcard ('*' or '?'), match it verbatim with
-like (no implicit padding).
* If a pattern starts with 'Azure.ResourceManager.' and has no wildcards,
treat it as an exact Library-name match.
* Otherwise keep the legacy substring behavior so 'KeyVault', 'Compute',
etc. continue to work as before.
* Add an -Exact switch that forces exact Library-name matching for any
pattern.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regenerate after Get{Shared,Community}Gallery -> *Data clientName rename
Spec change in Azure/azure-rest-api-specs PR (commit 718d48b7c9) renamed the
auto-generated singleton getters via @@clientName so the data-shape and
resource-shape overloads coexist in the generated extension classes
without colliding with the customize wrappers.
* Bumps tsp-location.yaml to the new spec commit.
* Restores customize partial classes for ComputeExtensions,
MockableComputeArmClient, and MockableComputeSubscriptionResource that
surface Get{Shared,Community}Gallery[Async] returning Response<*Resource>
to preserve the previously shipped public API.
* Generated CommunityGalleries / SharedGalleries RestOperations and
Extensions now expose Get{Shared,Community}GalleryData[Async] overloads.
* Re-runs Export-API.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert collateral sdk/computeschedule regen drift
This PR should only carry temporary mgmt-generator changes plus
sdk/compute changes. Sibling packages were getting regenerated by
RegenSdkLocal.ps1's overly broad filter; restore them to origin/main.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove sdk/computeschedule files unique to this branch
Files generated by past RegenSdkLocal.ps1 runs leaked sibling-package
artifacts into this PR. Restoring sdk/computeschedule to match origin/main.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regenerate from spec using LocationResourceParameter
Bumps tsp-location.yaml to spec commit 511a846a55 which replaces the
deprecated ARM common LocationParameter (location: string) with
LocationResourceParameter (location: Azure.Core.azureLocation) and
adds @@clientName to keep ResourceSkus.list emitting GetComputeResourceSkus.
API surface impact:
- 17 subscription-scoped action operations now expose AzureLocation
location instead of string (e.g. GetUsages, GetVirtualMachineSizes,
GetVirtualMachineImages.*, GetLogAnalytics.*, etc.)
- VirtualMachineExtensionImage[s] family (get / listTypes / listVersions)
now also exposes AzureLocation location (these were unreachable via
per-operation @@alternateType because of the ComputeLegacyOperations
template indirection).
- ResourceSkus.list / ResourceSkus.GetAll renamed back to
GetComputeResourceSkus on the subscription extension surface.
Eliminates the 66 ExtensionMethod ApiCompat breaks against last-stable
Azure.ResourceManager.Compute (1.13.1). Total unique ApiCompat: 623 -> 556.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: restore (CT-only) compatibility shims that shipped in 1.13.1
Closes 10 ApiCompat MissingMethod breaks (Bucket A) caused by the regenerated
SDK no longer exposing the (CancellationToken)-only overloads that were
preserved on main as customization shims. Most of these were dropped during
the migration cleanup; restoring them brings the API surface back to parity.
* CapacityReservationCollection.GetAll[Async](CT) - restored verbatim from main
* SshPublicKeyResource.GenerateKeyPair[Async](CT) - restored verbatim from main
* VirtualMachineCollection.CreateOrUpdate[Async](WaitUntil, name, data, CT)
- new shim, calls through with matchConditions: null (the spec replaced
the (ifMatch, ifNoneMatch) pair with a single MatchConditions param)
* VirtualMachineResource.Update[Async](WaitUntil, patch, CT)
- same shape as above, matchConditions: null
* VirtualMachineResource.Deallocate[Async](WaitUntil, bool? hibernate, CT)
- calls through with forceDeallocate: null (new optional middle param)
ApiCompat unique total: 556 -> 546.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: refresh API listing for restored compatibility shims
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: minimize Customize/* diff vs main; centralize MatchConditions compat helper
Restore the 6 VM/VMSS/VMSSVM Customize partial-class files to mirror main's
content (using statements, member ordering, xml docs verbatim). Adapt only
the forwarding bodies that no longer compile against the new generated
signature: where main's body forwarded the now-removed (ifMatch, ifNoneMatch)
positional pair, the body now forwards a single MatchConditions parameter.
The (string ifMatch, string ifNoneMatch, CancellationToken) compatibility
shims that shipped in 1.13.1 are reintroduced as additive members per file
and now share a single ConditionalRequestExtensions.BuildMatchConditions
helper (no per-file duplication).
Refresh api/*.cs to reflect:
- main's parameter names (filter, virtualMachineScaleSetName) on the hidden
EditorBrowsableNever shims (a stale rename was carried in the previous API
listing).
- the additive (ifMatch, ifNoneMatch, CT) shim methods.
ApiCompat unique breaks unchanged at 546.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: add xml docs to Customize/Models/* compat types
Pure documentation pass — no API surface or behavior changes:
- GetVirtualMachineImagesWithPropertiesExpand.cs: restore main's xml docs
verbatim and the type-level [EditorBrowsable(Never)] attribute.
- SubscriptionResourceGetVirtualMachineImagesWithPropertiesOptions.cs:
restore main's xml docs verbatim on the original ctor; add new docs for
the additive (expandOption) ctor and Top/Orderby/ExpandOption/Expand
members.
- SubscriptionResourceGetVirtualMachineImagesOptions.cs,
SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions.cs,
SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions.cs:
add concise <summary> docs to ctors, params, and public properties.
- KeyVaultSecretReference.cs: add <inheritdoc /> to JsonConverter
Write/Read overrides.
ApiCompat unique unchanged at 546; api/*.cs re-export shows 0-byte drift.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regen with @@alternateType to restore ComputeUsageUnit (Bucket B)
Bumps tsp-location.yaml to the spec commit that adds @@alternateType for
Compute.Usage.unit (string-literal `Count` -> extensible-enum
`ComputeUsageUnit`). The generator now emits the full ComputeUsageUnit struct
in src/Generated, so the orphan Customize/Models/ComputeUsageUnit.cs shim is
deleted to avoid CS0557 (duplicate user-defined conversion).
ApiCompat: 549 -> 546 unique. Closes Bucket B:
- ComputeUsage.Unit getter type
- ComputeUsageUnit.op_Equality
- ComputeUsageUnit.op_Inequality
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regen with @@clientName to restore Imds casing (Bucket D)
Bumps tsp-location.yaml to the spec commit that renames
ComputeGalleryEndpointType.IMDS -> Imds via @@clientName. Wire value remains
`IMDS`; only the C# enum member name changes.
ApiCompat: 546 -> 545. Closes Bucket D.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: regen with member-level @@clientName for acronym/casing back-compat (Bucket E)
Bumps tsp-location.yaml to the spec commit that adds @@clientName for 48
extensible-enum members. Also adds NetworkApiVersion partial-struct
customization to restore underscore-bearing names `v2020_11_01` /
`v2022_11_01` (which TypeSpec @@clientName cannot target due to identifier
constraints), plus the back-compat `TwoThousandTwenty1101` alias.
ApiCompat: 542 -> 494 (-48, all of Bucket E except 1 true removal in
ImageStorageAccountType.StandardSsdLrs which moves to Bucket F).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: rename NetworkApiVersion via clientName + CodeGenMember to drop leaked _20201101 properties
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bump tsp-location.yaml to spec 34a840f6 (NetworkApiVersion clientName)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: G1 - consolidate Architecture/HyperVGeneration/IPVersion duplicate enums
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute G2: alternateType narrowed location/resourceType props (-12 ApiCompat breaks)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute G3: restore IReadOnly* collections via partial-class customization (-10 ApiCompat breaks)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute G3: prefer ChangeTrackingList/Dictionary over default for null Properties fallback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute G5: ProtectedSettingsFromKeyVault BinaryData shim + KeyVaultProtectedSettings rename
Spec-side @@clientName renames protectedSettingsFromKeyVault -> keyVaultProtectedSettings (csharp) on the 3 extension properties models (commit fd8de6c68d). SDK-side adds 6 partial-class shims that re-expose the deprecated BinaryData ProtectedSettingsFromKeyVault property by serializing/deserializing through the typed KeyVaultProtectedSettings (KeyVaultSecretReference).
ApiCompat: 453 -> 437 (-16). Closes Bucket G5.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute G8: fix Disk.managedByExtended alternateType to use armResourceIdentifier[] (regen)
Spec commit 3f11e2445a corrects @@alternateType to use armResourceIdentifier[] so the SDK emits IReadOnlyList<ResourceIdentifier> ManagedByExtended instead of a single ResourceIdentifier.
ApiCompat: 437 -> 436 (-1). Closes Bucket G8.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* G9: add ScheduledEventsTerminateNotificationProfile shim on VirtualMachineData/Patch
Backward compatibility shim flattening Properties.ScheduledEventsProfile.TerminateNotificationProfile
to a top-level ScheduledEventsTerminateNotificationProfile accessor (matches existing pattern on
VirtualMachineScaleSetVmProfile / VirtualMachineScaleSetUpdateVmProfile).
ApiCompat: 436 -> 432 unique breaks.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute G7: GalleryArtifactVersionSource family - rename source->gallerySource + Uri shims
Spec @@clientName decorators rename source->gallerySource on GalleryDiskImage and
GalleryImageVersionStorageProfile to match baseline derived-typed property name.
Also rename uri->sourceUri on GalleryDiskImageSource (csharp) to avoid collision
with the base virtual System.Uri Uri shim restored on GalleryArtifactVersionSource.
SDK customize partials:
- GalleryArtifactVersionSource: virtual System.Uri Uri shim
- GalleryArtifactVersionFullSource: override System.Uri Uri shim
- GalleryDiskImage: base-typed Source shim forwarding to GallerySource
- GalleryImageVersionStorageProfile: base-typed Source shim forwarding to GallerySource
ApiCompat unique: 432 -> 404 (-28).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3: clientName renames + back-compat shims for deprecated baseline names
Spec rename (commit 26a266b71230): adopt the Is*-style canonical names
(IsPasswordAuthenticationDisabled, IsVmAgentPlatformUpdatesEnabled,
IsAutomaticUpdatesEnabled, IsExcludedFromLatest, ResilientVmCreationPolicy,
ResilientVmDeletionPolicy, GalleryImageVersionData.Restore).
SDK shims (Customize/*): restore the legacy verb-prefixed names
(DisablePasswordAuthentication, EnableVmAgentPlatformUpdates,
EnableAutomaticUpdates, ExcludeFromLatest, IsRestoreEnabled) as
[EditorBrowsable(Never)] forwarding accessors so the v1.14.0 baseline
deprecation pairs are preserved.
ApiCompat: 400 -> 388 unique breaks.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 follow-up: align shim files to main's canonical content
The shim files for LinuxConfiguration, WindowsConfiguration,
GalleryArtifactPublishingProfileBase, SharedGalleryImageVersionData,
CommunityGalleryImageVersionData, and GalleryImageVersionData were
already present (or had a baseline form) on main. Restore the original
XML doc text and single-line accessor formatting to keep the deprecated
properties textually identical to v1.14.0.
Note: dropped the 'IsVmAgentPlatformUpdatesEnabled { get; [Editor...] set; }'
re-declare from WindowsConfiguration that main relied on - the new mgmt
generator does not allow re-declaring an auto-property that is also
generated, so the .set break for that property is left for the L2-Setter
mitigation pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 batch 2: restore baseline properties via shims and clientName
Spec-side (Placement.zonePlacementPolicy):
- Apply @@clientName to rename to ZonePlacementPolicyType (csharp), so the
generated strongly-typed enum keeps a unique name. Mirrors the previous
autorest directive that stripped the enum to string.
SDK-side shims (Customize/Models):
- VirtualMachinePlacement: re-add legacy string ZonePlacementPolicy forwarding
to the new ZonePlacementPolicyType enum.
- RestorePointSourceVmStorageProfile: re-add DataDiskList (IList) projection
from generated DataDisks (IReadOnlyList).
- VirtualMachinePublicIPAddressConfiguration: re-add DnsDomainNameLabel
forwarding to DnsSettings.DomainNameLabel.
- ImageStorageAccountType: re-add StandardSsdLrs static field.
- ScheduledEventsPolicy: re-add Enable bool? forwarding to flattened
ScheduledEventsAdditionalPublishingTargetsEventGridAndResourceGraph.IsEnabled.
- CommunityGalleryInfo: re-add PublisherUriString forwarding to PublisherUri.
- ComputeSecurityPostureReference: re-add ExcludeExtensionNames projection
from ExcludeExtensions.
- SharedGalleryImageData: re-add Identifier forwarding to ImageIdentifier
(uses 'new' to hide internal base member).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 batch 3: rename DiskControllerType to DiskControllerKind via clientName + shim
Spec-side:
- @@clientName VirtualMachineScaleSetStorageProfile.diskControllerType and
VirtualMachineScaleSetUpdateStorageProfile.diskControllerType to DiskControllerKind
(csharp). Mirrors the previous autorest directives that stripped the enum to string.
SDK-side shims (Customize/Models):
- VirtualMachineScaleSetStorageProfile / VirtualMachineScaleSetUpdateStorageProfile:
re-add legacy string DiskControllerType forwarding to the new DiskControllerKind enum.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 batch 4: rename GalleryTargetExtendedLocation.storageAccountType to GalleryStorageAccountType + shim
Spec-side:
- @@clientName GalleryTargetExtendedLocation.storageAccountType to GalleryStorageAccountType
(csharp). Restores baseline EdgeZoneStorageAccountType-typed property name.
SDK-side shim (Customize/Models):
- GalleryTargetExtendedLocation: re-add legacy ImageStorageAccountType? StorageAccountType
property bridging through string values to GalleryStorageAccountType.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 batch 5: restore AdditionalProperties bag on 4 models
* Compute L3 batch 6: AutomaticByPlatformRebootSetting flatten shims + SoftDeletedOn
* Compute L3 batch 7: Group C flatten shims for 5 list projections
Adds [EditorBrowsable(Never)] partial-class shims preserving 5 baseline list
getters that auto-flattened in TypeSpec generation:
- CapacityReservationGroupData.InstanceViewCapacityReservations
- CapacityReservationGroupPatch.InstanceViewCapacityReservations
- CapacityReservationInstanceView.UtilizationInfoVirtualMachinesAllocated
- DedicatedHostInstanceView.AvailableCapacityAllocatableVms
- DedicatedHostGroupPatch.Hosts
Each forwards to the nested generated property. ApiCompat 375 -> 370 unique.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 batch 8: regenerate after @@usage(Usage.input) on 10 output-only models
Spec change restores public ctor + writable setters on 10 models that were emitted as
Output-only by TypeSpec. ApiCompat 370 -> 299 unique breaks (-71).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3 batch 9: K1-Ctor mitigations (299 to 287)
- Add @@usage(RollingUpgradeStatusInfo, Usage.input) via tsp-location bump
- 7 SDK customizations to restore previously shipped public ctors:
* KeyVaultAndKeyReference (Uri, WritableSubResource) ctor
* KeyVaultAndSecretReference (Uri, WritableSubResource) ctor
* KeyVaultKeyReference (Uri, WritableSubResource) ctor
* KeyVaultSecretReference (Uri, WritableSubResource) ctor
* MigrateToVirtualMachineScaleSetInput (WritableSubResource) ctor
* VirtualMachineCaptureResult () public ctor with Resources init
* ComputeSecurityPostureReference () public ctor with ExcludeExtensions init
Resolves all 8 K1-Ctor breaks. ApiCompat: 299 to 287 (-12).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L2: restore WindowsConfiguration.IsVmAgentPlatformUpdatesEnabled setter
The wire model marks enableVMAgentPlatformUpdates as readOnly (correctly
mirrored by @visibility(Lifecycle.Read) in TypeSpec), but the previously
shipped SDK exposed a setter for binary compatibility, hidden from
IntelliSense via [EditorBrowsable(Never)]. Restore that customization.
ApiCompat: 287 to 286 (-1).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute L3-Getter batch: restore DiskRestorePointId getters and PirCommunityGalleryResourceData.ResourceType
- RestorePointSourceVm{Data,OS}Disk: add EditorBrowsable-hidden DiskRestorePointId expression-body getter (matches prior shipped customization).
- PirCommunityGalleryResourceData: spec @@clientName + @@alternateType renames generated 'Type: string' to 'ResourceType: Azure.Core.ResourceType?' to match v1.14.0.
- tsp-location bump to 7bb2c4ca14 for the spec change above.
Reduces ApiCompat unique breaks 286 -> 283.
* Move broken back-compat ModelFactory overloads to customize code
The TypeSpec generator emits EBN back-compat overloads on the model
factory whenever a primary signature changes against the previously
shipped contract. After the migration, several primaries had params
renamed/reordered/added, and the auto-generated forwarding bodies do
not compile (params don't exist, named-then-positional ordering, etc).
See microsoft/typespec#10595.
Move the 16 affected overloads into Customize/ArmComputeModelFactory.cs
with hand-written bodies that forward to the current primary using
all-named arguments. The generator detects the user-supplied members
with matching signatures and skips re-emitting the broken ones.
ApiCompat: 283 -> 46 unique errors (-237).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move leftover broken overloads + disambiguation shims to customize
Adds 4 generator-emitted broken back-compat ModelFactory overloads
(SharedGalleryImageVersionData, CommunityGalleryData,
CommunityGalleryImageVersionData, VirtualMachineScaleSetVmData) to
Customize/ArmComputeModelFactory.cs. Same root cause as the prior batch
(microsoft/typespec#10595).
Also relocates 3 pre-existing shorter shims (without artifactTags) to
the customize file so the call-site can cast 'default' to
(IDictionary<string,string>) and disambiguate against the new
IReadOnlyDictionary back-compat overload that now coexists with the
IDictionary primary.
A new region-scoped justification block above these methods explains
both situations independently from the prior batch's justification.
ApiCompat unique errors: 46 -> 42 (the remaining 42 are 29 H/I-blocked
on TCGC + 13 L1b-CloudService still under investigation).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add hand-authored ModelFactory shims for deprecated CloudService surface
CloudService (classic) was removed from the TypeSpec spec, so the
generator no longer emits factory methods for the 13 CloudService-
related types kept under src/Customize/CloudService/. Adds a partial
ArmComputeModelFactory in the same directory with stubs that match the
1.14.0 contract signature-for-signature and throw NotSupportedException,
following the same pattern used by every other CloudService stub
(types, extensions, mockables).
Each shim is marked [EditorBrowsable(Never)] and [Obsolete] with the
shared 'CloudService operations are no longer supported.' message.
ApiCompat unique errors: 42 -> 29 (13 L1b-CloudService cleared). The
remaining 29 are all H/I-blocked on TCGC features (base type / Id
cascade / non-virtual member changes) and require generator support.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Merge MockableComputeSubscriptionResource Mocking partial into Extensions partial
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore xml docs, merge mocking partial, rename galleryIdentifier, drop new keyword
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Merge main + bump tsp-location to b4c188d8a5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Merge main + bump tsp-location to ca80b38be8 (consolidated client.tsp)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bump tsp-location to ad691bbf98 (alternate-type-stubs.tsp restored)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bump tsp-location to 113cdc82e5 (rename csharp-alternate-type-stubs.tsp)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Compute: rename VMScaleSetLifecycleHookEvent* -> Vm, vmInstanceIDs -> vmInstanceIds, move generated samples out of Generated/
- Spec bump: pulls in csharp-scoped clientName overrides for the lifecycle-hook event types and the VMSS power-method body parameter
- Move auto-generated tests/Generated/Samples/* (88 files) to tests/Samples/ (no longer regenerated under TypeSpec generator)
- Delete 10 obsolete CloudService sample files; remove obsolete CloudService method from Sample_SubscriptionResourceExtensions
- Update Sample_VirtualMachineScaleSetCollection to use VmScaleSetLifecycleHookEventType and the renamed Type property
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bump Compute tsp-location to 1665dc107c (revert path-param .name attempt)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Compute test build errors after flattening
Replace removed members with their flattened public replacements:
- VirtualMachineData/Patch.AvailabilitySet -> AvailabilitySetId
- VirtualMachineData/Patch.DiagnosticsProfile.BootDiagnostics -> BootDiagnostics
- AvailabilitySetData/Patch.ProximityPlacementGroup -> ProximityPlacementGroupId
- GalleryData.Identifier?.UniqueName -> IdentifierUniqueName
- VirtualMachineScaleSetIPConfiguration.Subnet -> SubnetId
No test logic changes; mechanical replacements only.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove resource-hierarchy*.json artifacts from PR
These were temporary analysis artifacts that should not have been committed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactor per code review: drop _getAll alias, hoist contextualPath, pure tuple return
- Remove _getAll field; _getAlls[0] is canonical after sorting.
- Hoist GetContextualPath(resourceMetadata) into the ctor; pass the
resulting RequestPathPattern into InitializeMethods, InitializeContext,
and SortGetAllMethodsByScopeBreadth so it is computed once.
- InitializeMethods now returns a tuple (Get, Create, GetAlls); drop the
mixed return-value-plus-out-params style.
- InitializeContext takes a single canonical ResourceMethod? instead of
the full list.
- BuildGetAllMethods caches the canonical sync provider via 'i == 0'
rather than ReferenceEquals(listMethod, _getAll).
Refs https://github.com/Azure/azure-sdk-for-net/issues/58735
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Mgmt emitter: classify all relocated non-resource methods as Actions
When �ssignNonResourceMethodsToResources matches a non-resource method onto
a resource via resourceModelId or resourceType, classify it as an Action
rather than a List. Any upstream-classified List operation would already be
in the resource's lists bucket; only Actions can land in the non-resource
methods bucket and be relocated here. Misclassifying these as Lists produced
bogus parameterless GetAll overloads on tuple resource collections.
Cherry-pick of #57766.
Co-authored…
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.
Description
Add C# client customizations for the Azure.ResourceManager.Compute TypeSpec migration.
Changes
amespace: Azure.ResourceManager.Compute\
Context
These customizations are needed for the C# mgmt SDK migration from AutoRest/Swagger to TypeSpec-based generation. All decorators are scoped to \csharp\ and do not affect other languages.
Related SDK PR: Azure/azure-sdk-for-net#57019