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

feat(generator): use InputOperation.OperationId #5210

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

archerzz
Copy link
Member

@archerzz archerzz commented Jan 3, 2025

Description

Previously we used resource name to guess operation id, which doesn't work well in some cases.
Instead of gussing operation id in generator, we try best to get the id in emitter and pass it to generator.

resolve #5117

Checklist

To ensure a quick review and merge, please ensure:

  • The PR has a understandable title and description explaining the why and what.
  • The PR is opened in draft if not ready for review yet.
    • If opened in draft, please allocate sufficient time (24 hours) after moving out of draft for review
  • The branch is recent enough to not have merge conflicts upon creation.

Ready to Land?

  • Build is completely green
    • Submissions with test failures require tracking issue and approval of a CODEOWNER
  • At least one +1 review by a CODEOWNER
  • All -1 reviews are confirmed resolved by the reviewer
    • Override/Marking reviews stale must be discussed with CODEOWNERS first

Mingzhe Huang (from Dev Box) added 2 commits January 3, 2025 16:24
Previously we use resource name to guess operation id, which doesn't work well in some cases.
Instead of gussing operation id in generator, we try best to get the id in emitter and pass it to generator.

resolve Azure#5117
@@ -431,7 +431,7 @@ public virtual ArmOperation<ManagedHsmResource> Update(WaitUntil waitUntil, Mana
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>MHSMPrivateLinkResources_ListByMhsmResource</description>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new operation id is what defined in swagger:

"operationId": "MHSMPrivateLinkResources_ListByMHSMResource",

@@ -24,7 +24,7 @@ public partial class Sample_FooCollection
public async Task CreateOrUpdate_CreateAFoo()
{
// Generated from example definition: 2024-05-01/Foos_CreateOrUpdate.json
// this example is just showing the usage of "Foo_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -151,7 +151,7 @@ public static Response<FooResource> GetFoo(this ResourceGroupResource resourceGr
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PrivateLinkResource_GetAllPrivateLinkResources</description>
/// <description>PrivateLinks_listByMongoCluster</description>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the difference between original name and @clientName:

@clientName("GetAllPrivateLinkResources")
listByMongoCluster is ArmResourceListByParent<PrivateLinkResource>;

@@ -215,7 +215,7 @@ public static Pageable<MgmtTypeSpecPrivateLinkResourceData> GetAllPrivateLinkRes
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PrivateLinks_Start</description>
/// <description>PrivateLinks_start</description>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original name is start:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that before 0.61.2, it's still Start.

@@ -264,7 +264,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Foo_CreateOrUpdate</description>
/// <description>Foos_createOrUpdate</description>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original name is createOrUpdate:

createOrUpdate is ArmResourceCreateOrUpdateAsync<Foo>;

archerzz pushed a commit to archerzz/azure-sdk-for-net that referenced this pull request Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Operation ID changed after tsp 0.61
1 participant