Problem
The new beta.5 make_versioned_base() gives non-required fields a None
default and nullable Python annotation, but its bundled-schema validator sends
an explicitly supplied None into JSON Schema as null. Most AdCP optional
fields permit omission, not null.
Released-wheel reproduction:
from adcp.types.versioned import make_versioned_base
ListCreatives31 = make_versioned_base("3.1", "ListCreativesRequest")
assert ListCreatives31.model_fields["account"].default is None
ListCreatives31(account=None)
Result:
pydantic.ValidationError: account: None is not of type 'object'
The same occurs for context=None, filters=None, and other omittable
top-level fields. This is surprising for a generated Pydantic base whose field
advertises T | None = None, and it breaks normal adopter construction that
passes optional function arguments directly into the request model.
Expected behavior
For a non-required field whose JSON Schema does not admit null, explicit
Python None should normalize to omission before bundled-schema validation and
wire serialization:
request = ListCreatives31(account=None)
assert "account" not in request.model_dump()
Required nullable fields must still preserve None on the wire, so a global
exclude_none=True is insufficient. The factory already computes required
fields and has each property schema; it can distinguish omittable-only fields
from required nullable ones when normalizing the top-level payload.
Please add tests for both sides:
- optional non-nullable
ListCreativesRequest.account=None is omitted; and
- a required field whose schema explicitly permits null remains present.
Problem
The new beta.5
make_versioned_base()gives non-required fields aNonedefault and nullable Python annotation, but its bundled-schema validator sends
an explicitly supplied
Noneinto JSON Schema asnull. Most AdCP optionalfields permit omission, not null.
Released-wheel reproduction:
Result:
The same occurs for
context=None,filters=None, and other omittabletop-level fields. This is surprising for a generated Pydantic base whose field
advertises
T | None = None, and it breaks normal adopter construction thatpasses optional function arguments directly into the request model.
Expected behavior
For a non-required field whose JSON Schema does not admit
null, explicitPython
Noneshould normalize to omission before bundled-schema validation andwire serialization:
Required nullable fields must still preserve
Noneon the wire, so a globalexclude_none=Trueis insufficient. The factory already computes requiredfields and has each property schema; it can distinguish omittable-only fields
from required nullable ones when normalizing the top-level payload.
Please add tests for both sides:
ListCreativesRequest.account=Noneis omitted; and