Skip to content

fix(client): accept explicit null in nested structured output schemas - #1441

Open
WangRui-OpenAI wants to merge 1 commit into
mainfrom
wangrui/fix-nullable-enum-validation
Open

WangRui-OpenAI wants to merge 1 commit into
mainfrom
wangrui/fix-nullable-enum-validation

Conversation

@WangRui-OpenAI

Copy link
Copy Markdown

An Optional<Enum> field can generate a nested anyOf with an explicit {"type":"null"} alternative. Building a ResponseTextConfig from that class failed before HTTP because the local validator rejected the null branch. The Structured Outputs guide uses this same form for a nullable field. Documented schema example

Validate a nested null through the existing simple-schema checks. A root null still takes the unsupported-type path. The tests cover both the public builder and the root restriction. Original regression test

Verification

  • Reproduced the failure on 8bd89da with the original regression. The failing path was #/properties/value/anyOf[0]/type.
  • All 98 tests in StructuredOutputsTest passed with the fix, including the original regression.
  • All 1,169 tests selected by :openai-java-core:test --tests 'com.openai.core.*' passed on JDK 21. Core assembly and repository Kotlin and Java lint passed.

Co-authored-by: Rogier Slag <2778689+rogierslag@users.noreply.github.com>
@WangRui-OpenAI
WangRui-OpenAI requested a review from a team as a code owner November 25, 2026 07:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T07:32:28.077546Z 0976071 PR opened
🔒 Security Review ✅ Completed 2026-11-25T07:33:04.798760Z 0976071 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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.

1 participant