-
Notifications
You must be signed in to change notification settings - Fork 317
Open
Labels
bugSomething isn't workingSomething isn't workingemitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp
Description
Describe the bug
Generated .NET client methods do not compile when using @convenientAPI(foo, false) with operations that have enum query parameters. The problem is that the corresponding protocol method is generated with an enum parameter, but the enum itself is not generated. I suspect other non-body parameter might have a similar issue.
Reproduction
I have the following TypeSpec. The important detail here is the include query parameter, which is an enum.
op getConversationItem(
@path
conversation_id: string,
@path
item_id: string,
@query(#{ explode: true })
include?: IncludeEnum[],
): ItemResource;Here is the IncludeEnum definition:
enum IncludeEnum {
`file_search_call.results`,
`web_search_call.results`,
`web_search_call.action.sources`,
`message.input_image.image_url`,
`computer_call_output.output.image_url`,
`code_interpreter_call.outputs`,
`reasoning.encrypted_content`,
`message.output_text.logprobs`,
}If I then use @@convenientAPI(getConversationItem, false); in client.tsp, the following C# method is generated:
public virtual ClientResult GetConversationItem(
string conversationId,
string itemId,
IEnumerable<IncludeEnum> include = null,
RequestOptions options = null);This looks correct to me. However, the issue is that the IncludeEnum type is not generated (i.e., it does not exist), so the above fails to compile.
Checklist
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingemitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp