[Bug]: SSEStream response examples are not emitted on OpenAPI 3.2.0 · Issue #11090 · microsoft/typespec · GitHub
Skip to content

[Bug]: SSEStream response examples are not emitted on OpenAPI 3.2.0 #11090

Open

Description

Describe the bug

I have an operation that returns SSEStream<T> and I attached a response example with @@opExample.
When I emit with @typespec/openapi3 targeting OpenAPI 3.2.0, the example is missing from the output: the text/event-stream response has itemSchema but no examples.
There's no error or warning, so the example just silently disappears.

The example itself is valid. If I switch the emitter to OpenAPI 3.0.0, the same example shows up fine (under examples, next to schema: { type: string }, with the expected streams-not-supported warning). So it only gets dropped on the 3.2.0 stream output.

Versions:

  • @typespec/compiler: 1.13.0
  • @typespec/http: 1.13.0
  • @typespec/openapi3: 1.13.0
  • @typespec/sse: 0.83.0
  • @typespec/events: 0.83.0
  • @typespec/streams: 0.83.0

Reproduction

https://typespec.io/playground/?tspconfig=ZW1pdDoKICAtICJAdHlwZXNwZWMvb3BlbmFwaTMiCm9wdGlvbnPEItQgxBggIMcPLXZlcnPILsQBLSAiMy4yLjAi&c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZc3Nl1RhldmVudHMiOwoKdXNpbmcgSHR0cDvHDFR5cGVTcGVjLlNTRdEURcU5OwoKQHNlcnZpY2UoI3sgdGl0bGU6ICJTU0UgZXhhbXBsZSBkcm9wcGVkIiB9KQpuYW1lc3BhY2UgUmVwcm87Cgptb2RlbCBNZXNzYWdlIHsKICDkAJs6ICJtxhMiO8QTZXh0OiBzdHJpbmc7Cn0KCkDmALcKdW5pb24g5gCLxT3HSSzFJXJvdXRlKCIvc3RyZWFtIikKQGdldApvcMRKZWFtKCk6IFNTRVPFDTzGRT7kANFAb3BF5gC9KMYqLAogICPEXyAgcmV0dXJu5AEGOsgTICBjb250ZW50xhYi5ACu5gFYLcd6xEDEAWJvZHk6ICJkYXRhOiB7XCLkAOtcIjpc6ADtXCIsXMU%2FxRVoZWxsb1wifVxuXG7HQ33EB8UF6wFt5wCs5wDWIiB9Cik7&vs=%7B%7D

Checklist

Activity

  1. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    🎯 Issue Triage

    When using @@opExample`` on an operation returning SSEStream<T>, the example is silently dropped in the OpenAPI 3.2.0 output of the `openapi3` emitter, while it emits correctly under OpenAPI 3.0.0.

    Category: Bug
    Area: emitter:openapi3

    🔗 [Playground Reproduction]((typespec.io/redacted)

    🔍 Analysis
    • Affected component: typespec/openapi3 emitter — specifically the SSE/streaming response rendering path for OpenAPI 3.2.0.
    • Behavior difference: In OpenAPI 3.0.0 mode the emitter falls back to a flat schema: { type: string } for event stream content, where examples are attached. In 3.2.0 mode it outputs an itemSchema structure for native stream support, but the example-emission code path likely doesn't handle this case and silently discards the example.
    • Root cause hypothesis: The code that emits examples for text/event-stream responses was not updated to handle the OpenAPI 3.2.0-specific streaming schema representation (itemSchema), so examples are lost silently.
    • No duplicate issues found.
    📝 Suggested next steps
    • Locate the openapi3 emitter code handling text/event-stream media types for 3.2.0 and compare it with the 3.0.0 path to find where examples are dropped.
    • Extend example-emission logic so @@opExample`` values are included alongside the itemSchema in 3.2.0 output.
    • Add a test covering @@opExample`` on SSEStream operations for both 3.0.0 and 3.2.0 targets.

    Generated by Agentic Triage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions