Skip to content

Investigate generator support for client-typed ProcessMessage<TClient> calls #1116

@christothes

Description

@christothes

Follow-up from PR #1105 review thread.

In custom protocol code (e.g. src/Custom/Evals/EvaluationClient.Protocol.cs), ProcessMessage/ProcessMessageAsync is invoked with an explicit client type parameter:

return ClientResult.FromResponse(Pipeline.ProcessMessage<EvaluationClient>(message, options));

This routes error deserialization to the more specific DeserializeInternal<Foo>ErrorResponse for that client, yielding better-typed error responses. Generated methods, however, call ProcessMessage without the client type argument, so they don't benefit from the specialized error model.

Investigate

  • Whether the TypeSpec/ClientModel generator should emit ProcessMessage<TClient>/ProcessMessageAsync<TClient> calls by default.
  • Trade-offs: consistency of error model deserialization across all operations vs. any perf/size costs or generator complexity.
  • Whether current manually-authored usages (Evals and any others) should be unified with generator output, or if the custom pattern should continue to be used selectively.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions