microsoft / microsoft/typespec
[http-client-csharp] Support composes client option for extension properties
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
## Description
Add support in the C# emitter for a `@clientOptions` option named `"composes"`. It indicates that the decorated model provides extension properties for another client options model.
```tsp
@alternateType(
{ identity: "OpenAI.Responses.CreateResponseOptions" },
"csharp"
)
model OpenAICreateResponseOptions {}
@clientOptions({
name: "composes",
value: OpenAICreateResponseOptions,
scope: "csharp"
})
model FoundryCreateResponseOptions {
agent: AgentReference;
agentConversationId: string;
sessionId: string;
}
```
Model-valued `clientOptions` support is tracked separately in https://github.com/Azure/typespec-azure/issues/5256.
## Expected behavior
The C# emitter should generate the properties declared by `FoundryCreateResponseOptions` as extension properties on the alternate type associated with `OpenAICreateResponseOptions`, `OpenAI.Responses.CreateResponseOptions`. Conceptually, the output should follow this shape:
```csharp
public static class FoundryCreateResponseOptionsExtensions
{
extension (OpenAI.Responses.CreateResponseOptions _)
{
public AgentReference Agent { get; set; }
public string AgentConversationId { get; set; }
public string SessionId { get; set; }
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.