You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(types): AdCPBaseModel's -> Any model_serializer erases every serialization JSON schema #1243
Pydantic derives a model's serialization-mode JSON schema from a wrap serializer's return annotation. Any means "unknown shape", so every AdCPBaseModel subclass now emits {} from model_json_schema(mode="serialization"). Validation-mode schemas are unaffected.
Anyone publishing a response schema built from SDK types gets untyped objects. Embedded Sales Agent exports its management API as OpenAPI: regenerating it on b18 collapses 24 response component schemas to {} (0 on b9), including CreativeFormatDiscoveryError, all five SignalVendor*PricingOption variants, and TrustedMatch. Request schemas stay intact, which is what points at serialization mode. Codegen and response validation against the spec lose all type information for those objects, including error recovery semantics and billing-adjacent pricing fields.
Fix
Drop the return annotation (the reproduction above shows Pydantic then derives the schema from the model's fields), or otherwise give the serializer a return type Pydantic can project. A regression test asserting that a representative subclass's serialization schema is non-empty would keep it fixed.
Classification: Bug Bucket(s): client (client label not in repo — flagged in run summary) Status: ready-to-implement
What the experts said:
code-reviewer: Non-breaking to drop -> Any; -> dict[str, Any] does NOT fix the collapse (Pydantic emits {"type": "object"}, not field schema) and would be a type lie since the method returns non-dict on the early-exit branch. Missing regression test is a blocker. Method name nit: _notification_config_wire_defaults implies narrow scope but fires on every subclass.
dx-expert: Blocker severity — 24 OpenAPI response component schemas silently collapse to {}, breaking codegen and response validation for anyone exporting mode="serialization" schemas (e.g., FastAPI/Starlette routes). Fix A (drop annotation) is correct; regression test assertion should check "properties" or "$defs" is present.
My take: Bug is confirmed via uv run python — model_json_schema(mode="serialization") returns {} on any AdCPBaseModel subclass. Both experts converge: drop the annotation, add a test. Change is non-breaking; runtime serialization is unaffected.
Implementation scope:
src/adcp/types/base.py:278 — remove -> Any from _notification_config_wire_defaults; add a one-line comment: # No return annotation: Pydantic derives the schema from fields. -> Any would collapse model_json_schema(mode="serialization") to {}.
Add tests/test_serialization_schema.py: assert a concrete AdCPBaseModel subclass's model_json_schema(mode="serialization") is non-empty and contains "properties" or "$defs". Failure message should name the wrap serializer annotation as the likely culprit.
Verify src/adcp/types/canonical_creative.py wrap serializer is unaffected (it is — no -> Any on that path).
Use a fix: conventional-commit prefix so release-please generates a CHANGELOG entry.
Non-breaking: serializer runtime behavior is unchanged; SerializerFunctionWrapHandler.__call__ returns Any so mypy infers Any on the unannotated method — no type-checker regression.
Activity
bokelley commentedon Sep 29, 2026
Triage
Classification: Bug
Bucket(s): client (
clientlabel not in repo — flagged in run summary)Status: ready-to-implement
What the experts said:
-> Any;-> dict[str, Any]does NOT fix the collapse (Pydantic emits{"type": "object"}, not field schema) and would be a type lie since the method returns non-dict on the early-exit branch. Missing regression test is a blocker. Method name nit:_notification_config_wire_defaultsimplies narrow scope but fires on every subclass.{}, breaking codegen and response validation for anyone exportingmode="serialization"schemas (e.g., FastAPI/Starlette routes). Fix A (drop annotation) is correct; regression test assertion should check"properties"or"$defs"is present.My take: Bug is confirmed via
uv run python—model_json_schema(mode="serialization")returns{}on anyAdCPBaseModelsubclass. Both experts converge: drop the annotation, add a test. Change is non-breaking; runtime serialization is unaffected.Implementation scope:
src/adcp/types/base.py:278— remove-> Anyfrom_notification_config_wire_defaults; add a one-line comment:# No return annotation: Pydantic derives the schema from fields. -> Any would collapse model_json_schema(mode="serialization") to {}.tests/test_serialization_schema.py: assert a concreteAdCPBaseModelsubclass'smodel_json_schema(mode="serialization")is non-empty and contains"properties"or"$defs". Failure message should name the wrap serializer annotation as the likely culprit.src/adcp/types/canonical_creative.pywrap serializer is unaffected (it is — no-> Anyon that path).fix:conventional-commit prefix so release-please generates a CHANGELOG entry.pytest tests/test_serialization_schema.py,mypy src/,ruff check .,black --check .SerializerFunctionWrapHandler.__call__returnsAnyso mypy infersAnyon the unannotated method — no type-checker regression.Triaged by Claude Code. Session: https://claude.ai/code/session_014W91pZQHLicyffUzzCQbAh
Generated by Claude Code