Skip to content

fix: support list-form JSON schema types - #1766

Open
nightcityblade wants to merge 1 commit into
anthropics:mainfrom
nightcityblade:fix/issue-1764
Open

fix: support list-form JSON schema types#1766
nightcityblade wants to merge 1 commit into
anthropics:mainfrom
nightcityblade:fix/issue-1764

Conversation

@nightcityblade

Copy link
Copy Markdown

Fixes #1764

Summary

  • canonicalize list-form JSON Schema types into anyOf branches
  • keep shared descriptions, titles, and enums on the union while applying sibling constraints to non-null branches
  • add regression coverage for simple and constrained nullable schemas

Test plan

  • uv run pytest tests/lib/_parse -n0 (24 passed)
  • uv run ruff check src/anthropic/lib/_parse/_transform.py tests/lib/_parse/test_transform.py
  • uv run ruff format --check src/anthropic/lib/_parse/_transform.py tests/lib/_parse/test_transform.py
  • uv run pyright src/anthropic/lib/_parse/_transform.py

@nightcityblade
nightcityblade requested a review from a team as a code owner July 18, 2026 03:15
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.

transform_schema raises AssertionError on valid list-form types, e.g. {"type": ["string", "null"]}

1 participant