Skip to content

Validating a schema-valid McpWebhookPayload / AsyncResponseData raises TypeError instead of validating (min_length applied to a Losses model) #1616

Description

@bokelley

Observed

Every one of the four bundle examples in core/mcp-webhook-payload.json, and the synthesized documents for it and for core/async-response-data.json, make the generated model raise a TypeError from inside pydantic rather than return a model or a ValidationError:

TypeError: Unable to apply constraint 'min_length' to supplied value
  (pydantic/_internal/_validators.py min_length_validator: object of type 'Losses' has no len())

Reproduce:

import json
from adcp.validation.schema_loader import get_named_validator
from tests.conformance._round_trip import model_for, schema_root

schema = "core/mcp-webhook-payload.json"
doc = json.loads((schema_root() / schema).read_text())["examples"][0]
assert get_named_validator(schema).is_valid(doc)
model_for(schema).model_validate_json(json.dumps(doc))   # TypeError

Found by the wire round-trip sweep in #1610's PR; 40 schema-valid documents are refused this way (python -m tests.conformance._round_trip).

Likely cause

A min_length/min_items constraint that the schema places on an array is being applied to a field whose generated annotation is the Losses model (fix_legacy_purchase_accepted_losses or the surrounding allOf flattening in scripts/post_generate_fixes.py). The constraint survives on the Field(...) while the annotation no longer names a sized type.

Expected

A schema-valid document validates; an invalid one raises ValidationError. The round-trip suite records these as refusals and skips them; it does not assert on them because they are the schema/model parity suite's domain (tests/conformance/test_schema_model_parity.py), which does not currently cover non-task schemas.

Activity

  1. added
    no-triage
    on Oct 25, 2026
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-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions