Skip to content

Commit cd4e110

Browse files
Copilotlive1206
andauthored
Support Azure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation (#53496)
* Initial plan * WIP: Add support for TrackedResourceWithOptionalLocation Added mapping in KnownManagementTypes.cs and updated baz.tsp to use Legacy.TrackedResourceWithOptionalLocation. Emitter logic partially implemented but needs refinement to avoid affecting other models. Co-authored-by: live1206 <[email protected]> * Support TrackedResourceWithOptionalLocation - nearly complete - Added mapping in KnownManagementTypes.cs - Updated baz.tsp to use Legacy.TrackedResourceWithOptionalLocation - Implemented emitter logic to set correct base model cross-language ID - BazData now extends TrackedResourceData as expected - Remaining: 3 build errors due to duplicate properties (Tags, Location) and constructor signature mismatch - these should be handled by InheritableSystemObjectModelVisitor but require further investigation Co-authored-by: live1206 <[email protected]> * Revert emitter.ts changes as requested Co-authored-by: live1206 <[email protected]> * Regenerate mgmt test projects with updated baz.tsp Co-authored-by: live1206 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: live1206 <[email protected]>
1 parent 162d19a commit cd4e110

File tree

6 files changed

+1409
-1334
lines changed

6 files changed

+1409
-1334
lines changed

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Primitives/KnownManagementTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ internal class KnownManagementTypes
3434
["Azure.ResourceManager.CommonTypes.ExtensionResource"] = typeof(ResourceData),
3535
["Azure.ResourceManager.CommonTypes.Resource"] = typeof(ResourceData),
3636
["Azure.ResourceManager.CommonTypes.TrackedResource"] = typeof(TrackedResourceData),
37+
["Azure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation"] = typeof(TrackedResourceData),
3738
};
3839

3940
private static readonly IReadOnlyDictionary<string, CSharpType> _idToSystemTypeMap = new Dictionary<string, CSharpType>()

eng/packages/http-client-csharp-mgmt/generator/TestProjects/Local/Mgmt-TypeSpec/baz.tsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using Azure.ClientGenerator.Core;
88
namespace MgmtTypeSpec;
99

1010
@resource("bazs")
11-
model Baz is TrackedResource<BazProperties> {
11+
model Baz is Azure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation<BazProperties> {
1212
...ResourceNameParameter<Baz, SegmentName = "bazs">;
1313
}
1414

eng/packages/http-client-csharp-mgmt/generator/TestProjects/Local/Mgmt-TypeSpec/src/Generated/BazData.Serialization.cs

Lines changed: 36 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eng/packages/http-client-csharp-mgmt/generator/TestProjects/Local/Mgmt-TypeSpec/src/Generated/BazData.cs

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eng/packages/http-client-csharp-mgmt/generator/TestProjects/Local/Mgmt-TypeSpec/src/Generated/MgmtTypeSpecTestsModelFactory.cs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)