-
Notifications
You must be signed in to change notification settings - Fork 167
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
base: main
Are you sure you want to change the base?
Conversation
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> |
There was a problem hiding this comment.
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:
autorest.csharp/test/TestProjects/MgmtMockAndSample/specification/mockSwagger/managedHsm.json
Line 736 in 371c2a2
"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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be Foos
, not Foo
which is a regression when upgrading to tsp 0.61.2
: https://github.com/Azure/autorest.csharp/pull/5110/files#diff-22fec97a025df3dec39b67b814688ef812fb9f7dfd2f85b3cc48d2501823415b
@@ -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> |
There was a problem hiding this comment.
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
:
autorest.csharp/test/TestProjects/MgmtTypeSpec/PrivateEndpointConnection.tsp
Lines 19 to 20 in 371c2a2
@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> |
There was a problem hiding this comment.
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
:
start is ArmResourceActionAsync< |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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>; |
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:
Ready to Land?