Skip to content

[http-client-csharp] Support composes client option for extension properties #11715

Description

@JoshLove-msft

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.

@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 Azure/typespec-azure#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:

public static class FoundryCreateResponseOptionsExtensions
{
    extension (OpenAI.Responses.CreateResponseOptions _)
    {
        public AgentReference Agent { get; set; }
        public string AgentConversationId { get; set; }
        public string SessionId { get; set; }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpfeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions