Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: [ARM][SDK] armRenameListByOperation decorator prevent client.tsp re-arrange the operation groups #1052

Closed
4 tasks done
weidongxu-microsoft opened this issue Jun 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library

Comments

@weidongxu-microsoft
Copy link
Member

Describe the bug

SDK emitter (and TCGC) takes interface (interface with @client/@operationGroup in client.tsp takes precedence) to group the client and operation groups.

@armRenameListByOperation decorator on ArmResourceListByParent operation template would rename the operation to pattern listBy<parent-resource-name>. This present SDK putting 2 or more ArmResourceListByParent operation (different resource, but same parent resource) to a single operation groups.
See https://gist.github.com/weidongxu-microsoft/fa420c35cf0611a62a8d155771dd3425#known-approach-to-group-operations

For brownfield service, SDK would need to keep the operation group structure, to avoid breaking changes.

One solution would be to remove the @armRenameListByOperation decorator from ArmResourceListByParent operation template.
But this leaves one question: what can we do to guide (particularly greenfield) service dev on operation name. E.g. it would be welcome that the operation name being consistent for new services, e.g. listByResourceGroup or listByTenant.

If we remove the decorator, breakdown could be

  1. rename all existing operation to the expected name of @armRenameListByOperation (so that operation name would be same, regardless of the existence of @armRenameListByOperation)
  2. remove @armRenameListByOperation from ArmResourceListByParent operation template
  3. [optional] find another way to guide service on the List operation name

Reproduction

playground

Checklist

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the TypeSpec repo
  • Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@weidongxu-microsoft
Copy link
Member Author

weidongxu-microsoft commented Jul 2, 2024

@allenjzhang

Let me know if we follow this breakdown. And if I can help you to do 1st item on the renames on existing operations.

@markcowl
Copy link
Member

This should be fixed in the July release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library
Projects
None yet
Development

No branches or pull requests

3 participants