Skip to content

[reporting] Encode control-value and checksum discriminants in JSON Schema #6995

Description

@bokelley

Summary

The managed-reporting schemas in #6953 leave two byte/value integrity rules in prose or x-adcp-validation, even though both are expressible in Draft-07 JSON Schema:

  1. reporting-control-total.value_type set to integer still accepts a decimal value such as "1.5".
  2. A physical_checksums entry accepts either 64 or 128 hex characters regardless of whether algorithm is sha256 or sha512.

The TypeScript implementation for adcontextprotocol/adcp-client#2744 had to add handwritten predicates for both. Without those overlays, generated Zod/AJV validators accept evidence that reconciliation must later reject.

Proposed schema changes

  • Add a conditional to reporting-control-total.json:
    • value_type integer => integer-only canonical string
    • value_type decimal => retain the canonical base-10 pattern.
  • Make each physical_checksums item a discriminated oneOf, or add if/then branches:
    • sha256 => exactly 64 hex characters
    • sha512 => exactly 128 hex characters.
  • Add protocol contract tests proving invalid algorithm/length and integer/decimal combinations fail.
  • Include generated-validator smoke tests so both SDK generators preserve the conditionals.

Acceptance signal

The protocol JSON Schema, generated TypeScript Zod schema, and generated Python validator all reject:

  • value_type integer with value "1.5"
  • algorithm sha256 with 128 hex characters
  • algorithm sha512 with 64 hex characters

Valid canonical integer/decimal values and correctly sized digests remain accepted.

Related: #6953, adcontextprotocol/adcp-client#2744.

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.schemaJSON Schema source-of-truth: definitions, codegen artifacts, validation, hygiene

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions