Summary
Generated Pydantic models do not enforce all semantics in the canonical JSON Schemas. In particular, allOf + if/then/else conditionals and x-adcp-validation invariants can silently disappear from runtime model validation.
Reproduction from reporting
The reporting revision schema requires finality_basis, finality_policy_id, and finalized_at when finality == "official", and forbids that evidence for non-official revisions. The generated ReportingRevision Pydantic model accepted an official revision without those fields.
The same implementation also had to enforce canonical media-buy set ordering manually because that behavioral invariant is not represented by the generated model.
Impact
An adopter can construct or accept a Python object that appears validated but is rejected by the canonical protocol schema. For billing/reporting this can turn an unsupported finality assertion into apparently valid application state.
Decision needed
Choose and document one supported boundary:
- generated Pydantic models have validation parity with canonical JSON Schema, including conditionals and selected
x-adcp-validation rules; or
- Pydantic models are structural application types only, and every wire boundary runs a provided canonical-schema validator in addition.
Expected work
- Add differential fixtures that validate the same payload with Pydantic and the bundled canonical JSON Schema.
- Cover conditional required/forbidden fields, discriminated unions, dependent constraints, numeric/string/array bounds, and selected behavioral extensions.
- Fail SDK CI when a generated model accepts a canonical negative fixture unless the divergence is explicitly allowlisted and documented.
- Provide an ergonomic validation helper if full codegen parity is not practical.
Discovered while implementing #1095 against adcontextprotocol/adcp#6953.
Summary
Generated Pydantic models do not enforce all semantics in the canonical JSON Schemas. In particular,
allOf+if/then/elseconditionals andx-adcp-validationinvariants can silently disappear from runtime model validation.Reproduction from reporting
The reporting revision schema requires
finality_basis,finality_policy_id, andfinalized_atwhenfinality == "official", and forbids that evidence for non-official revisions. The generatedReportingRevisionPydantic model accepted an official revision without those fields.The same implementation also had to enforce canonical media-buy set ordering manually because that behavioral invariant is not represented by the generated model.
Impact
An adopter can construct or accept a Python object that appears validated but is rejected by the canonical protocol schema. For billing/reporting this can turn an unsupported finality assertion into apparently valid application state.
Decision needed
Choose and document one supported boundary:
x-adcp-validationrules; orExpected work
Discovered while implementing #1095 against adcontextprotocol/adcp#6953.