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] [LRO] lroMetadata.pollingStep.responseBody.usage is not correct when polling operation is defined in different namespace #1752

Open
Tracked by #2931
haolingdong-msft opened this issue Oct 28, 2024 · 0 comments · May be fixed by #1887
Assignees
Labels
lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@haolingdong-msft
Copy link
Member

haolingdong-msft commented Oct 28, 2024

Issue

I believe this is an edge case. See below test case, PollResponse model in namespace Cadl.ServiceNamespace has usage === 0`, but it is actually used in polling operation.

import "@typespec/rest";
import "@azure-tools/typespec-client-generator-core";
import "@azure-tools/typespec-azure-core";


using TypeSpec.Rest;
using TypeSpec.Http;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;


@service({
  title: "ServiceNamespace",
})
@versioned(ApiVersions)
@route("/servicenamespace")
namespace Cadl.ServiceNamespace {
  enum ApiVersions {
    @useDependency(global.Azure.Core.Versions.v1_0_Preview_2)
    v2022_06_01_preview: "2022-06-01-preview",
  }

  model PollResponse {
    operationId: string;
    status: Azure.Core.Foundations.OperationState;
  }

  @pollingOperation(NonService.poll)
  @post
  @route("/post")
  op longRunning(): AcceptedResponse;

}

@useDependency(Azure.Core.Versions.v1_0_Preview_2, Cadl.ServiceNamespace.ApiVersions.v2022_06_01_preview)
namespace Cadl.NonService {
  @route("/poll")
  @get
  op poll(): Cadl.ServiceNamespace.PollResponse;
}

Image

Solution

PollResponse should be public access + output usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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