Skip to content

openapi: sequential media types derive the wrong item type #630

Closed

Description

@OmarAlJarrah

Problem

openapi: 3.2.0
…
      responses:
        "200":
          description: ok
          content:
            application/jsonl: {schema: {type: array, items: {$ref: '#/components/schemas/Event'}}}

The operation streams with responseStream.events set to the anonymous array, not Event. Each frame of a JSON Lines stream is one Event; the schema describes the sequence as a whole.

            application/json: {itemSchema: {$ref: '#/components/schemas/Event'}}

itemSchema on application/json, which isn't a sequential media type, becomes a stream with no diagnostic.

Expected

  • For a sequential media type whose schema is an array, the item type is the array's items.
  • itemSchema on a media type that isn't sequential draws a warning.

Activity

  1. added
    priority:P2Rarer spec shapes, or an IR decision to settle before the emitter
    priority:P3Later emitters, M4 and up, 3.2-only, streaming, webhooks, rare constructs
    and removed
    priority:P2Rarer spec shapes, or an IR decision to settle before the emitter
    on Oct 19, 2026
  2. OmarAlJarrah commented on Oct 30, 2026

    @OmarAlJarrah
    MemberAuthor

    #1167 landed with this open, and landing this changes no emitter plan (docs/emitters/plan/streams.md, main @7e1e3fc8). On a side framed by its media type, Element already reads the Elem of a content Type whose root is a list, ahead of StreamDetail.Events, so one frame's type is the same whether Events names the list or its Elem.

    The second expected item, a warning for itemSchema on a media type that isn't sequential, is the compiler's and #1167 doesn't touch it.

  3. OmarAlJarrah commented on Nov 1, 2026

    @OmarAlJarrah
    MemberAuthor

    A constraint on the first bullet, found while working on #1191: the list can't be read during the operation walk. applyStreaming runs mid-walk, and a $ref target need not be in the registry yet, since a target another document holds is built when Finish fulfils its promise, so a mid-walk read would follow declaration order. Reading it from a settlement is the shape that works, and that has to move the comparison in classifyStream with it: whether two contents name the same element depends on the resolved Elem, so ambiguous can't be decided before the registry is whole.

    No consumer is waiting on this: docs/emitters/plan/streams.md already reads a list's Elem from the content's Type, so the plan's element is right either way, and this only changes what Events states.

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

    priority:P3Later emitters, M4 and up, 3.2-only, streaming, webhooks, rare constructstype:bugDefect in shipped behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions