Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
11 stars 37 forks source link

Expanded resource (resource type is not constant) in TypeSpec #1261

Open pshao25 opened 1 month ago

pshao25 commented 1 month ago

We are preparing for helping brownfield services onboard TypeSpec world.

It seems we lack the expression for expanded resource like this. For the resource RecordSet, which is a child resource of DnsZone, its resource type Microsoft.Network/dnsZones/{recordType} is expandable with an enum {recordType}, instead of a constant.

Proposal: I feel like we could add a new parameter called SegmentType, similar to NameType like this

@parentResource(DnsZone)
model RecordSet {
  ...ResourceNameParameter<
    Resource = RecordSet,
    SegmentType = RecordType,
  >;
}

union RecordType  = "A" | "AAA" | ...
markcowl commented 1 month ago

Brownfield services without GA SDKs should be the target in this phase. For now, older specs non-conformant to the ARM RPC with GA SDKs should not be at the top of our priority list