openai / openai/openai-openapi

Add explicit discriminator mappings for Realtime session configuration unions

Open Beginner friendly
#566 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement specification
Dominant language
No language data
Stars
2.5k
Forks
527
Avg merge
1h 46m
Merged PRs (30d)
2

Description

The Realtime session configuration union is currently represented using oneOf in:

  • RealtimeClientEventSessionUpdate.properties.session
  • RealtimeCreateClientSecretRequest.properties.session

Both referenced schemas require a type property with distinct constant values:

  • RealtimeSessionCreateRequestGA: type: realtime
  • RealtimeTranscriptionSessionCreateRequestGA: type: transcription

However, the union does not explicitly declare its discriminator. This prevents some OpenAPI consumers and code generators from recognizing it as a discriminated union.

Could the schema include an explicit discriminator mapping?

session:
  type: object
  description: |
    Update the Realtime session. Choose either a realtime
    session or a transcription session.
  oneOf:
    - $ref: "#/components/schemas/RealtimeSessionCreateRequestGA"
    - $ref: "#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA"
  discriminator:
    propertyName: type
    mapping:
      realtime: "#/components/schemas/RealtimeSessionCreateRequestGA"
      transcription: "#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA"

Alternatively, the union could be extracted into a reusable component and referenced from both properties.

This would preserve the existing wire format while making the intended polymorphism explicit for OpenAPI tooling.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the schemas for RealtimeClientEventSessionUpdate.properties.session and RealtimeCreateClientSecretRequest.properties.session, then read the referenced RealtimeSessionCreateRequestGA and RealtimeTranscriptionSessionCreateRequestGA definitions. Add the explicit type discriminator mapping to both unions, or identify a reusable component if the repository structure supports it. Done means the existing wire format is unchanged and both session variants are recognized as a discriminated union.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
Half a day
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.