`HttpApiSchema` streams: declare every media type a stream can be sent as
Los mantenedores suelen responder en 1 día
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Problem
Some APIs send one stream under one of several media types, depending on the resource or the API version:
- Docker's container logs answer
200withapplication/vnd.docker.raw-streamwhen the container has a TTY, and withapplication/vnd.docker.multiplexed-streamotherwise. - Docker's
GET /eventsis NDJSON sent asapplication/jsonup to API 1.51, and asapplication/jsonlfrom API 1.52 (measured on Docker 29).
OpenAPI describes this directly: a response's content maps each media type to its schema, and Docker's own API document lists both stream types under the logs' 200. A stream schema has exactly one contentType, though. So the generated OpenAPI document lists one media type the API may not send. For logs, declared as StreamUint8Array, it lists application/octet-stream, which the API never sends:
HttpApiEndpoint.get("logs", "/containers/:id/logs", {
params: { id: Schema.String },
success: HttpApiSchema.WithHeaders(HttpApiSchema.StreamUint8Array(), {
"content-type": Schema.Literals([
"application/vnd.docker.raw-stream",
"application/vnd.docker.multiplexed-stream"
])
})
})
// OpenAPI: 200 → content: { "application/octet-stream": … }
Declaring two stream successes instead isn't allowed ("Multiple streaming success responses are not supported", HttpApiEndpoint.ts L1403), and would need a way for a handler to pick one.
Proposal
Let StreamUint8Array and StreamNdjson take a list of media types:
success: HttpApiSchema.WithHeaders(
HttpApiSchema.StreamUint8Array({
contentType: ["application/vnd.docker.raw-stream", "application/vnd.docker.multiplexed-stream"]
}),
{
"content-type": Schema.Literals(["application/vnd.docker.raw-stream", "application/vnd.docker.multiplexed-stream"])
}
)
HttpApiSchema.StreamNdjson({ schema: EventMessage, contentType: ["application/jsonl", "application/json"] })
- OpenAPI: each media type is listed under the status, with the same stream schema.
- Client: unchanged. A status with one stream alternative is decoded whatever its
Content-Typetoday, so any of the listed types is read the same way. - Server: the first media type is the default. A handler that sets a
content-typedeclared withWithHeaderssends that one. This already works today: a handler's header replaces the stream's defaultContent-Type(tested withNodeHttpServer). - Payloads: a streaming request payload with several media types accepts any of them.
It's still one stream per status, so there's no new handler API and no union of stream types.
Scope
In scope: StreamUint8Array and StreamNdjson, as successes and as payloads.
Out of scope: StreamSse (always text/event-stream), and several stream schemas for one status.
Open questions
- Should the server check that a handler's
content-typeis one of the listed types, or leave that to the declared header's schema?
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 10 h 21 min
- PR fusionados (30 d)
- 834
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
`Schedule.fixed` repeats with no delay when the clock is a tiny fraction before a boundaryPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#10250 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Cluster: A way to remove processed requests from storagePosiblemente ocupada @effect-bot la tomó hace 1 día. Abiertoenhancement
Effect-TS/effect#10239 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Cluster: an interrupted request whose handler dies stalls every other entity on the runnerPosiblemente ocupada @effect-bot la tomó hace 1 día. Abiertobug
Effect-TS/effect#10238 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Let OTLP log and trace exporters leave no timer pending while idlePosiblemente ocupada @effect-bot la tomó hace 1 día. Abierto
Effect-TS/effect#10234 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Otlp.layerFromConfig exports nothing when only OTEL_EXPORTER_OTLP_ENDPOINT is setPosiblemente ocupada @effect-bot la tomó hace 2 días. Abierto
Effect-TS/effect#10231 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
Add: Class TV ModaAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
GiganticMinecraft/seichi-playguide#183 ·
Los mantenedores suelen responder en 1 día
-
area: core complexity: easy impact: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
ueberdosis/tiptap#8668 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
longbridge/nsh#804 ·
Los mantenedores suelen responder en 1 día