Skip to content

GlobalEvent / Event OpenAPI schemas list every EventSessionNext* event twice #28826

@faern

Description

@faern

Description

In GET /doc (OpenCode 1.15.7) the event-union schemas contain the entire EventSessionNext* schema family twice.

GlobalEvent.payload is an anyOf of 136 members, but only 110 are distinct - 26 duplicates. Every duplicate is an EventSessionNext* schema (EventSessionNextPrompted, EventSessionNextTextDelta, EventSessionNextToolCalled, ...): the same 26-schema block is $ref'd a second time later in the list.

The per-instance Event schema has the identical defect: 103 members, 77 distinct, the same 26 EventSessionNext* duplicates.

anyOf does not require its members to be unique, so this is not strictly invalid OpenAPI - a value matching a duplicate matches its twin identically, so the extra members are pure noise. But:

  • It inflates the spec.
  • Codegen that maps each anyOf member to a named type/variant without deduplicating emits that type twice. Where duplicate symbols are an error (eg a Rust enum getting two EventSessionNextPrompted variants) the generated client fails to compile unless the generator or a post-processing step dedups.

This looks like a generation bug - the streaming EventSessionNext* event group appears to be registered into the union twice.

Related

#28825 - sync events on /global/event mismatch the spec; same GlobalEvent schema, different defect.
#20666 - SyncEvent OpenAPI schema has required infinite recursion; same area.

Plugins

No response

OpenCode version

1.15.7

Steps to reproduce

  1. opencode serve
  2. Fetch GET /doc.
  3. jq '.components.schemas.GlobalEvent.properties.payload.anyOf | [length, ([.[]."$ref"] | unique | length)]' -> [136, 110].
  4. The 26-entry gap is the EventSessionNext* family, each schema listed twice. Same holds for .components.schemas.Event.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions