`itemSchema` is not rendered for sequential media types (OpenAPI 3.2)
Q&A
- OS: macOS
- Browser: Chrome
- Version: 5.33.0
- Method of installation: dist assets (
swagger-ui-dist) - Swagger-UI version: 5.33.0 (also reproduced on 5.32.15)
- Swagger/OpenAPI version: OpenAPI 3.2.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.2.0
info:
title: itemSchema repro
version: 1.0.0
paths:
/stream:
get:
operationId: streamReports
responses:
'200':
description: An open event stream.
content:
text/event-stream:
itemSchema:
$ref: '#/components/schemas/Event'
'401':
description: Unauthorized.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
components:
schemas:
Event:
type: object
properties:
id: { type: string }
status: { type: string }
Problem:
type: object
properties:
status: { type: integer }Swagger-UI configuration options:
SwaggerUIBundle({
url: './openapi.yaml',
dom_id: '#swagger-ui',
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
layout: 'StandaloneLayout',
docExpansion: 'full',
});Describe the bug you're encountering
For a media type whose payload is described with itemSchema — the OpenAPI 3.2 keyword for sequential media types such as text/event-stream, application/jsonl, application/json-seq and multipart/mixed — Swagger UI renders the response as a bare content-type dropdown. There is no Example Value, no Schema tab, and nothing indicating the response has a documented payload shape at all.
The document loads without error, the OAS 3.2 badge appears, and every other part of the operation renders normally, so the omission is silent: the response simply looks undocumented.
The 401 in the definition above is a control. It uses schema and renders its Example Value | Schema tabs as expected, immediately below a 200 that renders none.
To reproduce...
Steps to reproduce the behavior:
- Serve the definition above with
swagger-ui-dist5.33.0 and the configuration above. - Expand
GET /stream. - Scroll to Responses and compare
200with401. - The
200shows onlyMedia type: text/event-stream; the401shows Example Value | Schema and the rendered payload.
Changing itemSchema to schema in that same 200 — the only edit — makes the tabs and the payload appear, which is the second screenshot below.
Expected behavior
A media type carrying itemSchema should render the item's schema and example the way schema does, ideally labelled so it is clear the shape describes one item of the stream rather than the whole body.
At minimum it should not render less than the 3.1 workaround it replaces. Describing the same endpoint as schema: { type: string } with an example containing a few frames produces a more informative page today than the 3.2 keyword intended for exactly this case. That makes adopting itemSchema a downgrade for anyone publishing a rendered reference, which is the position we are currently in.
Screenshots
itemSchema — the 200 renders as a bare media-type dropdown:
The same document with schema — the 200 renders Example Value and Schema:
Additional context or thoughts
- #10575 ("Support OpenAPI 3.2") is closed and 5.33.0 postdates it, which is why this is filed as a gap in shipped 3.2 support rather than a feature request. Happy for it to be relabelled if
itemSchemawas out of scope for that work. - #4761 is related but distinct: it asks for SSE consumption in Try-It-Out, whereas this is only about rendering the documented payload.
- The definition validates cleanly against Redocly CLI 2.52.1, so this is not a malformed-document case.
itemEncodingandprefixEncodingare presumably affected the same way; onlyitemSchemahas been tested.
Source: swagger-api/swagger-ui