Skip to content

Commit c9356a2

Browse files
Update httpx2 and datamodel-code-generator (#3645)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
1 parent c449255 commit c9356a2

4 files changed

Lines changed: 57 additions & 70 deletions

File tree

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ docs = [
111111
# of the default groups so no other environment installs the client (or the
112112
# legacy httpx it depends on). See i18n/README.md.
113113
translate = ["anthropic>=0.121.0"]
114-
codegen = ["datamodel-code-generator==0.57.0"]
114+
codegen = ["datamodel-code-generator==0.81.0"]
115115

116116
[build-system]
117117
requires = ["hatchling", "uv-dynamic-versioning"]

‎scripts/gen_surface_types.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def run_codegen(schema_path: Path, output_path: Path) -> None:
195195
"--snake-case-field", "--remove-special-field-name-prefix",
196196
"--use-annotated", "--use-field-description", "--use-schema-description",
197197
"--enum-field-as-literal", "all",
198+
"--default-values", '{"ElicitRequestFormParams.mode": "form"}',
198199
"--use-union-operator", "--use-double-quotes",
199200
"--use-type-alias", "--skip-root-model",
200201
"--extra-fields", "ignore",
@@ -252,6 +253,9 @@ def build(entry: dict[str, str]) -> str:
252253
source = raw.read_text(encoding="utf-8")
253254

254255
source = re.sub(r"\A# generated by datamodel-codegen:\n#[^\n]*\n", "", source)
256+
# Explicit __annotations__ hides declared fields under Python 3.14's deferred annotations.
257+
source = source.replace(' __annotations__ = {\n "__pydantic_extra__": Dict[str, Any],\n }\n', "")
258+
source = source.replace(", Dict,", ",")
255259
# Keep named aliases only for recursive types; other aliases remain ordinary Python types and unions.
256260
for node in reversed(ast.parse(source).body):
257261
if not (

‎tests/types/test_methods.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,19 @@ def test_serialize_server_result_preserves_open_type_extras():
960960
assert sieved["tools"][0]["_meta"] == nested_meta
961961

962962

963+
@pytest.mark.parametrize("input_schema", [{}, {"type": "array"}])
964+
def test_serialize_server_result_rejects_invalid_tool_input_schema(input_schema: dict[str, Any]) -> None:
965+
"""The 2026 spec requires a tool's input schema to declare `type="object"`, even though it allows extra keys."""
966+
result = {
967+
"tools": [{"name": "echo", "inputSchema": input_schema}],
968+
"resultType": "complete",
969+
"ttlMs": 0,
970+
"cacheScope": "private",
971+
}
972+
with pytest.raises(pydantic.ValidationError):
973+
methods.serialize_server_result("tools/list", "2026-07-28", result)
974+
975+
963976
def test_serialize_server_result_drops_top_level_server_info_on_discover_but_keeps_the_meta_stamp():
964977
"""Server identity moved from the discover body to result `_meta` (spec PR #3002):
965978
the sieve drops the removed body key and preserves the `_meta` stamp."""

0 commit comments

Comments
 (0)