Skip to content

Schema-driven validation: client hooks + opt-in server middleware #249

Closed

Description

@bokelley

Why

Companion to adcontextprotocol/adcp-client#688. Field-name drift between server responses and the AdCP spec is being caught late — by running storyboards, not by the SDK. Two recent examples (TS side):

  • `targeting` vs `targeting_overlay` (response drift)
  • `catalog_type` vs `type` (request drift)

The bundled JSON schemas published with each AdCP release are the source of truth. SDKs are the leveraged place to enforce them.

What

Mirror the TS validator shape so the three SDKs converge:

Core

  • Load bundled schemas from `dist/schemas//bundled/*.json` (self-contained `$ref`s).
  • Compile once (jsonschema or fastjsonschema), cache by task + direction.
  • Emit `VALIDATION_ERROR` with JSON Pointer, message, schema path. Match the existing AdCP L3 error envelope.
  • Non-strict on `additionalProperties` for extension safety.

Client hooks (on by default)

  • Validate outgoing requests before send.
  • Validate incoming responses on receive.
  • `strict` (raise) vs `warn` (log + continue); strict in dev/test, warn in prod.

Server middleware (opt-in)

  • Wrapper for SDK-built agents at dispatcher layer.
  • Request rejects with `VALIDATION_ERROR` pre-handler.
  • Response validation: raise in dev/test, log + metric in prod.

Async response variants

  • Select schema by response shape (`task_id`/`status`), not task name, for `-async-response-` cases.

Scope

  • Published AdCP tools only.
  • Shape validation only — does not replace semantic checks.
  • Version pinned to SDK's declared AdCP version.

Sequence

TS (adcontextprotocol/adcp-client#688) prototypes first. Python ports shape, error code, and pointer format.

Activity

  1. added a commit that references this issue on May 13, 2026
    a38ff57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions