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(http-client-csharp): add InputOperation.OperationId #5479

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

archerzz
Copy link
Member

@archerzz archerzz commented Jan 3, 2025

  • add InputOperation.OperationId
  • invoke resolveOperationId() to initialize it

part of Azure/autorest.csharp#5117

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Jan 3, 2025
@archerzz archerzz force-pushed the http-client-csharp/add-operation-id branch from 45c7044 to 994d614 Compare January 3, 2025 06:53
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

- add `InputOperation.OperationId`
- invoke `resolveOperationId()` to initialize it

part of Azure/autorest.csharp#5117
@archerzz archerzz force-pushed the http-client-csharp/add-operation-id branch from 994d614 to de848fc Compare January 3, 2025 07:16
@@ -74,6 +75,7 @@ export function fromSdkServiceMethod(
getResourceOperation(sdkContext.program, method.operation.__raw.operation)?.resourceType
.name ??
getOperationGroupName(sdkContext, method.operation, sdkContext.sdkPackage.rootNamespace),
OperationId: resolveOperationId(sdkContext.program, method.operation.__raw.operation),
Copy link
Member Author

Choose a reason for hiding this comment

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

there are 3 ways to resolve the operation id:

  1. @typespec/openapi will use the original resource name, e.g. ignoring renaming by @clientName:
    export function resolveOperationId(program: Program, operation: Operation) {
  2. @typespec-azure/typespec-generator-client-core will honor renaming: https://github.com/Azure/typespec-azure/blob/9d16af124e507f7194d4f378637c9ca557bd6d2e/packages/typespec-client-generator-core/src/example.ts#L142
  3. @typespec-azure/typespec-autorest will honor renaming and make it pascal: https://github.com/Azure/typespec-azure/blob/9d16af124e507f7194d4f378637c9ca557bd6d2e/packages/typespec-autorest/src/utils.ts#L72

I thought we should use option 1 which should be closest to original operation id in swagger. Any thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants