Skip to content

[TCGC] Azure.ClientGenerator.Core.Legacy.hierarchyBuilding doesn't recognize tags envelope properly #3686

@ArthurMa1978

Description

@ArthurMa1978

Context

We define the models like belowing:

model FooResource
  is Azure.ResourceManager.ProxyResource<FooProperties> {
  ...ResourceNameParameter<
    Resource = FooResource,
    KeyName = "fooName",
    SegmentName = "foos",
    NamePattern = ""
  >;
  ...Azure.ResourceManager.Foundations.ArmTagsProperty;

  location?: string;
}

model FooProperties{
  /** something */
  something?: string;
}

For C#, we use the hierarchyBuilding decorator to change the base type of FooResource from ProxyResource to TrackedResource:

@@Azure.ClientGenerator.Core.Legacy.hierarchyBuilding(FooResource, Azure.ResourceManager.Foundations.TrackedResource, "csharp");

Issue

It reports warning: "@hierarchyBuilding decorator causes conflicts in inherited properties. Please check that the model ApplicationResource has the same properties as TrackedResource in the spec."

This happens because the decorator doesn't detect a tags property on FooResource, but TrackedResource has. Actually in our definition, the tags is provided via the envelope Azure.ResourceManager.Foundations.ArmTagsProperty, and the decorator currently does not honor the envelope semantics.

Expected Behavior

The hierarchyBuilding decorator should expand any envelopes when doing property check.

Metadata

Metadata

Labels

lib:tcgcIssues for @azure-tools/typespec-client-generator-core library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions