Skip to content

Fix JSON Schema type arrays for nullable fields#96

Merged
adamw merged 1 commit intomasterfrom
fix/issue-92-nullable-json-schema
Feb 5, 2026
Merged

Fix JSON Schema type arrays for nullable fields#96
adamw merged 1 commit intomasterfrom
fix/issue-92-nullable-json-schema

Conversation

@adamw
Copy link
Member

@adamw adamw commented Feb 5, 2026

Summary

  • Fixed Claude API rejecting JSON Schema with type arrays like ["integer", "null"] for optional fields
  • Changed markOptionsAsNullable to false so optional fields use simple types
  • Optionality is now conveyed through the required array instead of type arrays

Test plan

  • Added test should not use type arrays for optional fields in JSON schema that verifies:
    • Optional fields have simple type strings (e.g., "integer") not arrays
    • Required fields are in the required array, optional fields are not
  • All existing tests pass (27/27)

Fixes #92

🤖 Generated with Claude Code

Claude API rejects JSON Schema with type arrays like ["integer", "null"]
for optional fields. Changed markOptionsAsNullable to false so optional
fields use simple types with optionality conveyed through the required
array instead.

Fixes #92

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@adamw adamw merged commit e02643a into master Feb 5, 2026
11 of 12 checks passed
@adamw adamw deleted the fix/issue-92-nullable-json-schema branch February 5, 2026 14:37
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.

Claude API rejects JSON Schema with type arrays for nullable fields

1 participant