Use case
An OpenAPI operation can declare several successful response media types, such as JSON, SSE and binary.
The generated HTTP client selects a preferred representation, so other declared representations may not be accessible through the generated operation.
Binary responses also need two consumption modes: buffered and live streaming.
Area
Generated HTTP or SSE client
Representative OpenAPI fragment
openapi: 3.1.0
info:
title: Response representations example
version: 1.0.0
paths:
/render:
post:
operationId: render
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
status:
type: string
text/event-stream:
schema:
type: string
application/octet-stream:
schema:
type: string
format: binary
Desired generated API or behavior
Expose the supported response representations through distinct generated call shapes.
Preserve existing buffered methods and the current SSE transport. Add live binary streaming without buffering the full successful response body.
Generated methods should share the same source operation identity and parameter planning, while keeping response representation identity independent of Rust method names.
The exact generated API and streaming return types are open for discussion.
Alternatives considered
Keeping only the preferred representation leaves other declared response modes inaccessible through the generated client.
Always buffering binary responses prevents incremental consumption of large downloads.
Reconstructing requests manually duplicates generated authentication, parameter serialization and error handling.
Replacing the existing SSE transport with a raw byte stream would lose its event parsing and reconnection behavior. This proposal should build on that transport, not replace it.
Compatibility
Use case
An OpenAPI operation can declare several successful response media types, such as JSON, SSE and binary.
The generated HTTP client selects a preferred representation, so other declared representations may not be accessible through the generated operation.
Binary responses also need two consumption modes: buffered and live streaming.
Area
Generated HTTP or SSE client
Representative OpenAPI fragment
Desired generated API or behavior
Expose the supported response representations through distinct generated call shapes.
Preserve existing buffered methods and the current SSE transport. Add live binary streaming without buffering the full successful response body.
Generated methods should share the same source operation identity and parameter planning, while keeping response representation identity independent of Rust method names.
The exact generated API and streaming return types are open for discussion.
Alternatives considered
Keeping only the preferred representation leaves other declared response modes inaccessible through the generated client.
Always buffering binary responses prevents incremental consumption of large downloads.
Reconstructing requests manually duplicates generated authentication, parameter serialization and error handling.
Replacing the existing SSE transport with a raw byte stream would lose its event parsing and reconnection behavior. This proposal should build on that transport, not replace it.
Compatibility