TCGC, by default, groups operations via TypeSpec Interfaces.
If @operationGroup
is specified in client.tsp, it would group operations from Interfaces with @operationGroup
in client.tsp instead.
Swagger in Management usually groups many different resources in a single resource group, via "operationId".
When migrating to TypeSpec, service need to write mutliple Interface for these operations.
Service would use @operationId
(from typespec-openai lib) to keep "operationId" unchanged in Swagger.
SDK emitter does not read @operationId
decorator.
As DPG, SDK dev would add @operationGroup interface <ClientOperationGroup> {}
to client.tsp
However, due to an issue about armRenameListByOperation
decorator over ArmResourceListByParent
, 2 operations of ArmResourceListByParent
with resoures of same parent resource cannot be written in a same Interface.
(discussion at Teams; reporduction at playground; issue to typespec-azure)
Accept the break to stable SDK. Usually the impact would be at the scale of 10s of APIs.
E.g. there is about 40 of Workloadnetworks_<operation>
in vmware. They would scatter to different operation groups as e.g. WorkloadNetworkSegments
, WorkloadNetworkDhcpConfigurations
, etc.
In Teams chat, Mark appears OK to remove the decorator.
Currently there is about 152+ places that ArmResourceListByParent
is used. We need to modify all of them, so that the operation name stays same before/after the removal (put it another way, Swagger should be same, before/after the removal). Then remove the decorator.
This will take time and efforts.
After that, we would be free to group it either in Interface in routes.tsp or in client.tsp
Though, service would need to maintain this client.tsp, e.g. after they add new Interface.
Add an overload of @operationGroup
as @operationGroup(operationGroupName: string)
. So that it can be specified on multiple Interface, and merge them to a single operation group.
E.g.
@@operationGroup(WorkloadNetworks);
@@operationGroup(WorkloadNetworkSegments, "WorkloadNetworks");
@@operationGroup(WorkloadNetworkDhcpConfigurations, "WorkloadNetworks");
The logic in TCGC would be complicated.
i vote for 2nd bc it is a thorough solution though legacy typespec fix is annoying