fix: support list-form JSON schema types - #1813
Conversation
|
I reimplemented this diff verbatim against It works, including the case that separates a correct fix from a plausible one. The risk with this bug is a fix that copies {"type": ["object", "null"], "properties": {"o": {...}}, "required": ["a"]}
# ->
{"anyOf": [{"type": "object", "properties": {...}, "additionalProperties": False, "required": ["a"]},
{"type": "null"}]}
One regression, and it changes a loud failure into a silent one. {"type": []} # before: AssertionError
# after: {"anyOf": []}An empty The two new tests don't reach the paths the summary claims. Worth knowing on the A pre-existing interaction this makes easier to hit (verified separately with no list-form type, so not caused by this PR): a branch carrying All of the above is checkable offline — |
f7ac16c to
6147091
Compare
|
Thanks for the thorough validation. I updated the current head (
Local validation passed: all 17 transformer tests, plus the repository's full lint suite (ruff, dependency-cap check, pyright, mypy, and import check). |
Fixes #1764
Summary
typevalues intoanyOfbranchesanyOf,oneOf, andallOfschemasTests
uv run pytest -n0 tests/lib/_parse/test_transform.py(16 passed)uv run ruff check src/anthropic/lib/_parse/_transform.py tests/lib/_parse/test_transform.pyuv run ruff format --check src/anthropic/lib/_parse/_transform.py tests/lib/_parse/test_transform.pyuv run pyright src/anthropic/lib/_parse/_transform.py tests/lib/_parse/test_transform.py./scripts/lint