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
feat(codegen): consume x-adcp-open-payload in generated models #902
The schema PR adds x-adcp-open-payload to mark intentionally open JSON payload surfaces and adds schema-authoring validation that the keyword is boolean. The Python SDK generator path should consume this intentionally rather than relying on generic additionalProperties heuristics.
Expected work:
Add a codegen/post-processing rule for x-adcp-open-payload: true so datamodel-code-generator output preserves the intended open payload model.
Ensure x-adcp-open-payload: false does not collapse structured-but-extension-tolerant fields into generic payload types.
Add a smoke test using at least one annotated field from the 3.1 schema set.
Rationale: datamodel-code-generator will ignore this custom keyword by default, so without explicit SDK handling the annotation is documentation only for Python consumers.
Classification: Feature request Bucket(s): client (codegen pipeline — no codegen label exists; noted for label-gap list) Status: deferred Milestone: omitted — no version target in issue body
What the experts said:
code-reviewer: Non-breaking, additive; scripts/post_generate_fixes.py is the correct insertion point using the existing schema-walk → class-injection pattern. x-adcp-open-payload: false requires only a skip/log, not a separate code path. Blocked: the keyword is absent from every schema bundle on main (including 3.1.0-beta.7), so the smoke test has no target until PR chore(protocol): update to AdCP 3.1 rc2 #901 lands and make sync-schemas re-caches the 3.1 schemas.
ad-tech-protocol-expert: The true case is a protocol conformance requirement — without it, extension fields on open-payload surfaces are silently dropped by extra='ignore'. false should be a guard assertion in test_extra_policy.py to prevent accidental widening, not a new code path. Raises two open questions the implementation must resolve (see below).
My take: This is a clean, well-scoped follow-up — experts converge on scope and insertion point. Deferring until #901 merges; the two open questions below should be settled before the implementation PR is filed.
scripts/post_generate_fixes.py: add apply_open_payload_config() — walk source schema files for x-adcp-open-payload: true, locate the corresponding generated class, inject model_config = ConfigDict(extra='allow') if absent. Follow the add_deprecated_field_metadata pattern at line ~230.
Verify flatten_schemas() in scripts/generate_types.py does not strip the x-adcp-open-payload extension key during the JSON copy step (extension properties currently pass through; confirm this holds).
tests/test_extra_policy.py: extend _schema_allows_extra / TestGeneratedCodeMatchesSchemas to recognize x-adcp-open-payload: true as an authoritative signal alongside additionalProperties: true; add a test_no_spurious_extra_allow guard for the false case.
Open questions to resolve before implementation PR:
Does x-adcp-open-payload apply only at schema root or also on $ref-resolved sub-schemas? The _schema_allows_extra walker follows $ref chains — the new rule must match its traversal depth.
Precedence: when additionalProperties: true and x-adcp-open-payload: false appear on the same schema object, which wins? The post-gen rule needs an explicit tie-break.
Already implemented on main. apply_open_payload_config() in scripts/post_generate_fixes.py consumes x-adcp-open-payload: true and applies extra='allow' to named generated classes (81 uses across the rc.9 schema set), with smoke tests in tests/test_extra_policy.py (test_named_open_payload_schema_injects_extra_allow, test_open_payload_field_preserves_extension_data). Closing as implemented. (Stale branch origin/issue-902-rc-3 can be pruned.)
Activity
bokelley commentedon May 30, 2026
Triage
Classification: Feature request
Bucket(s): client (codegen pipeline — no
codegenlabel exists; noted for label-gap list)Status: deferred
Milestone: omitted — no version target in issue body
What the experts said:
scripts/post_generate_fixes.pyis the correct insertion point using the existing schema-walk → class-injection pattern.x-adcp-open-payload: falserequires only a skip/log, not a separate code path. Blocked: the keyword is absent from every schema bundle onmain(including 3.1.0-beta.7), so the smoke test has no target until PR chore(protocol): update to AdCP 3.1 rc2 #901 lands andmake sync-schemasre-caches the 3.1 schemas.truecase is a protocol conformance requirement — without it, extension fields on open-payload surfaces are silently dropped byextra='ignore'.falseshould be a guard assertion intest_extra_policy.pyto prevent accidental widening, not a new code path. Raises two open questions the implementation must resolve (see below).My take: This is a clean, well-scoped follow-up — experts converge on scope and insertion point. Deferring until #901 merges; the two open questions below should be settled before the implementation PR is filed.
Blocked-on: #901 — resurfaces on merge
Implementation brief (for when #901 lands):
scripts/post_generate_fixes.py: addapply_open_payload_config()— walk source schema files forx-adcp-open-payload: true, locate the corresponding generated class, injectmodel_config = ConfigDict(extra='allow')if absent. Follow theadd_deprecated_field_metadatapattern at line ~230.flatten_schemas()inscripts/generate_types.pydoes not strip thex-adcp-open-payloadextension key during the JSON copy step (extension properties currently pass through; confirm this holds).tests/test_extra_policy.py: extend_schema_allows_extra/TestGeneratedCodeMatchesSchemasto recognizex-adcp-open-payload: trueas an authoritative signal alongsideadditionalProperties: true; add atest_no_spurious_extra_allowguard for thefalsecase.Open questions to resolve before implementation PR:
x-adcp-open-payloadapply only at schema root or also on$ref-resolved sub-schemas? The_schema_allows_extrawalker follows$refchains — the new rule must match its traversal depth.additionalProperties: trueandx-adcp-open-payload: falseappear on the same schema object, which wins? The post-gen rule needs an explicit tie-break.Triaged by Claude Code. Session: https://claude.ai/code/cse_01QxdZunWwWsZUdsMaatDb73
Generated by Claude Code
bokelley commentedon Jun 6, 2026
Already implemented on main.
apply_open_payload_config()inscripts/post_generate_fixes.pyconsumesx-adcp-open-payload: trueand appliesextra='allow'to named generated classes (81 uses across the rc.9 schema set), with smoke tests intests/test_extra_policy.py(test_named_open_payload_schema_injects_extra_allow,test_open_payload_field_preserves_extension_data). Closing as implemented. (Stale branchorigin/issue-902-rc-3can be pruned.)