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

[TCGC][Feature gap] SdkPackage misses information for whether generate convenient/protocol method #980

Closed
Tracked by #3994 ...
haolingdong-msft opened this issue Jun 11, 2024 · 0 comments · Fixed by #1152
Assignees
Labels
feature New feature or request lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@haolingdong-msft
Copy link
Member

haolingdong-msft commented Jun 11, 2024

Issue background

Previously TCGC has helper functions like shouldGenerateConvenient to check whether generate convenient method, similar as protocol method. Majorly the helper function will check @convenientApi and @protocolApi decorators.

export function shouldGenerateProtocol(context: TCGCContext, entity: Operation): boolean {
  const value = getScopedDecoratorData(context, protocolAPIKey, entity);
  return value ?? Boolean(context.generateProtocolMethods);
}

export function shouldGenerateConvenient(context: TCGCContext, entity: Operation): boolean {
  const value = getScopedDecoratorData(context, convenientAPIKey, entity);
  return value ?? Boolean(context.generateConvenienceMethods);
}

Code

But when switching to using sdkPackage, there is no flag to indicate whether to generate convenient/protocol API.

Solution

I think we could add two flags shouldGenerateConvenient and shouldGenerateProtocol under SdkServiceMethod in TCGC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants