[tcgc] provide a name for SDK client (when SDK client is from TypeSpec Namespace) #1737
Closed
4 tasks done
Labels
lib:tcgc
Issues for @azure-tools/typespec-client-generator-core library
Clear and concise description of the problem
Context
For unbranded or simple Azure (without
@client
in client.tsp), the name of the Namespace becomes the name of the clientTypeSpec for Azure management mostly uses this pattern.
However, the namespace provided by service usually is not a good candidate for SDK client.
Service typically use ARM RP namespace as TypeSpec Namespace. e.g.
Microsoft.DocumentDB
, while SDK want to use a more meaningful client named likeMongoClusterMgmtClient
.Currently, dev usually did a
@clientName
on the namespace to modify the name of the client.But given the new namespace design, this same
@clientName
syntax now modify the SDK namespace (instead of SDK client name).In short, after namespace design, the TypeSpec Namespace specifies both the SDK namespace AND SDK client name. And
@clientName
can only modify one of the two.Proposal
Have a new decorator to specify the name of the client to the Namespace. The name of the decorator is TBD.
Alternatives Considered
Write a full client.tsp client hierarchy
Con:
@client
@operationGroup
decorators, dev had to write the full@client
@operationGroup
in client.tsp, which typically results to hundreds of lines in client.tsp. And service had to add more to it, whenever they add new Interface/Resource to main.tspUse
title
in@service
for ARM mgmtThere is a
title
in@service
, which maps totitle
in Swagger.Con:
namespace Client { namespace SubClent {...} }
Repurpose the
@client
decorator so that it can apply to service Namespace and provide an SDK nameCon:
@client
could be confusing to dev.Checklist
The text was updated successfully, but these errors were encountered: