Skip to content

Update to new OpenAI OpenAPI spec#418

Closed
nezhyborets wants to merge 8 commits into
mainfrom
update-openapi-spec-components
Closed

Update to new OpenAI OpenAPI spec#418
nezhyborets wants to merge 8 commits into
mainfrom
update-openapi-spec-components

Conversation

@nezhyborets
Copy link
Copy Markdown
Collaborator

Summary

  • Regenerate Components.swift from the latest OpenAI OpenAPI spec
  • Update ResponseStreamEvent and OutputItem for new schema shapes
  • Update manual types to match renamed/new generated types:
    • IncludableIncludeEnum, TextPayloadResponseTextParam, ToolChoicePayloadToolChoiceParam
    • LocalShellToolLocalShellToolParam; add new Tool cases: computerTool, computerUsePreviewTool, webSearchTool, webSearchPreviewTool, functionShellTool, customTool, namespaceTool, toolSearchTool, applyPatchTool
    • Rename codeInterpretercodeInterpreterTool for consistency
  • Fix test failures caused by new required fields (responseId on ResponseAudioDoneEvent, logprobs on ResponseTextDeltaEvent)

Test plan

  • swift build passes with no errors
  • swift test — all tests pass

🤖 Generated with Claude Code

nezhyborets and others added 8 commits May 15, 2026 20:27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove 32 invalid redeclarations: duplicate primitive typealiases
(Bool/String/Int/Double = Swift.X) within the same struct scope, and
six `typealias String = [Swift.String]` entries that shadowed Swift.String
in CodingKeys raw type position, breaking compilation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename reasoning event types: ResponseReasoningDelta/DoneEvent →
  ResponseReasoningTextDelta/DoneEvent; ResponseReasoningSummaryDelta/DoneEvent →
  ResponseReasoningSummaryTextDelta/DoneEvent
- Reorder decoder chain to match new value indices (value29–50): new
  ReasoningText events inserted at 29/30 pushed Refusal, OutputText,
  WebSearch, ImageGen, MCP events down by 2; MCP call-arguments events
  moved from value40/41 to value42/43, freeing 40/41 for the two
  previously-missing ImageGen events
- Add decoder entries for value40/41 (ImageGenCallInProgress/PartialImage)
  and value49 (MCPListToolsInProgress), which were absent in the old mapping
- Update guard indices to match: value40/41 → value42/43, value49 → value51
- Update case comments to match spec wording

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generated OutputItem changed from a OneOf struct (value1…value12) to a
discriminated enum with named cases. Rewrite init(from:) to decode the
generated enum and switch on its cases.

Also adds the 13 new cases introduced in the spec:
functionToolCallOutputResource, computerToolCallOutputResource,
toolSearchCall, toolSearchOutput, compactionBody, localShellToolCallOutput,
functionShellCall, functionShellCallOutput, applyPatchToolCall,
applyPatchToolCallOutput, mcpApprovalResponseResource, customToolCall,
customToolCallOutputResource.

Updates existing comments to use absolute URLs and aligns wording with
the spec descriptions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The generated type now has readable case names, making the facade unnecessary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename Includable → IncludeEnum, TextPayload → ResponseTextParam, ToolChoicePayload → ToolChoiceParam
- Replace LocalShellTool → LocalShellToolParam in Tool enum
- Add new Tool cases: computer, computerUsePreview, webSearch, webSearchPreview, functionShell, custom, namespace, toolSearch, applyPatch
- Drop Tool suffix from all enum case names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Restore Tool suffix on all enum cases; rename codeInterpreter → codeInterpreterTool
- Add required responseId param to ResponseAudioDoneEvent in test
- Add logprobs:[] to mock SSE JSON for ResponseTextDeltaEvent (now required by spec)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants