Skip to content

test(codegen): lock deprecation-decorator generation on deprecated JSON Schema properties #778

Closed

Description

@bokelley

Filed in response to adcontextprotocol/adcp#4904 (the 3.1 additive-deprecate on `CreateMediaBuySuccess` / `UpdateMediaBuySuccess` body-level `status`). The expert review on that PR flagged that JSON Schema `deprecated: true` propagation through codegen is partially reliable across Python toolchains; the storyboard certification gate is doing the real enforcement work but the SDK side should lock its part of the contract.

What's needed

A unit test that asserts a deprecation surface (typically `deprecated=True` on `pydantic.Field(...)` for Pydantic v2, or a `warnings.warn`-style decorator on field accessors) is emitted on Python types regenerated from AdCP schemas where the source schema declares `deprecated: true` on a property.

Anchor case: `CreateMediaBuySuccess.status` and `UpdateMediaBuySuccess.status` in AdCP 3.1+. Both fields are marked `deprecated: true` (description-level + the JSON Schema 2020-12 `deprecated` keyword) on the source schema.

The test should:

  1. Regen types from the schema set that contains these properties (latest AdCP schemas).
  2. Inspect the generated model (e.g., via Pydantic's `model_fields` and the field's `json_schema_extra` or `deprecated` attribute).
  3. Assert that the `status` member on `CreateMediaBuySuccess` and `UpdateMediaBuySuccess` carries the deprecation marker.

Why the toolchain matters

The protocol-side expert review flagged `datamodel-code-generator` (a common JSON-Schema-to-Pydantic generator) as having uneven deprecation-keyword support — emits the marker only on v2+ recent releases; older pinned versions silently drop it. If `adcp-client-python` uses `datamodel-code-generator` or a similar tool, the version pin matters; if the test asserts deprecation surfaces in the generated output, regressions get caught at CI rather than in production.

This locks the contract that the JSON Schema deprecation marker continues to surface in generated types as the field rotates through 3.1 (additive) → 3.2 (legacy removal) → 4.0 (nested cascade renames).

Related

Activity

  1. added
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    and removed
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on May 21, 2026
  2. bokelley commented on May 21, 2026

    @bokelley
    ContributorAuthor

    Triage

    Classification: Feature request (new test)
    Bucket(s): validation
    Status: drafting-pr
    Milestone: omitted — test-only change, no version target specified

    What the experts said:

    • code-reviewer: approved — 2 nits fixed (duplicate docstring bullet, pending import path corrected to public adcp.types)
    • ad-tech-protocol-expert: approved after blocker fixed — corrected an inaccurate comment claiming one assertion covered all four bundled schema occurrences; public TargetingOverlay resolves to the core schema class, not the structurally identical bundled variants

    My take: The codegen pin already emits deprecated=True correctly for the current 3.0.7 schema bundle; the test locks that contract so a silent pin bump or schema refresh can't regress it undetected. The 3.1 anchor cases (CreateMediaBuySuccessResponse.status, UpdateMediaBuySuccessResponse.status) are documented as a commented-out block ready to activate when adcp#4904 schema sync lands.

    Draft PR: #781


    Triaged by Claude Code. Session: https://claude.ai/code/session_0169cPJV4qE4hxoLvkJsm2mg


    Generated by Claude Code

  3. bokelley commented on May 23, 2026

    @bokelley
    ContributorAuthor

    Housekeeping: closed stale draft PR #781 as deferred. The underlying contract remains valid, but #781 only pinned older 3.0.7 deprecated fields and left the real 3.1 anchor cases commented out. Recommendation: keep this issue open and re-cut after the 3.1 schema/codegen cleanup lands, using CreateMediaBuySuccessResponse.status and UpdateMediaBuySuccessResponse.status as live assertions.

  4. added a commit that references this issue on Jun 7, 2026
    b5e91e8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions