Skip to content

Parameter required status is lost after wire round-trip #3854

Open

Description

@romanlutz

Describe the bug

Parameter serializes its computed required flag, but _reconstruct_param_type_from_wire does not use it to restore REQUIRED_VALUE. A required declaration therefore deserializes as optional (default=None, required=False). Clients that round-trip a registry catalog can stop marking or validating the field as required, although backend construction still rejects a missing input.

Steps/Code to Reproduce

from pyrit.common import REQUIRED_VALUE
from pyrit.models.parameter import Parameter

original = Parameter(name="count", description="Required count", param_type=int, default=REQUIRED_VALUE)
restored = Parameter.model_validate_json(original.model_dump_json())
print(original.required, restored.required, restored.default)

Expected Results

The restored declaration remains required and has the same missing-input validation semantics as the original.

Actual Results

The wire JSON contains "required":true, but the restored model reports True False None for original required, restored required, and restored default.

Screenshots

N/A. This is a deterministic model serialization reproduction.

Versions

Python 3.12.3; PyRIT checkout revision 01ce6ca66a315770b36c7dca1f320668c0d92d7c. tests/unit/models/test_parameter.py (228 tests) and registry resolution tests (93 tests) passed; no backend HTTP workflow was run.

Activity

  1. its-amann commented on Nov 3, 2026

    @its-amann
    Contributor

    I would like to take this.

  2. its-amann commented on Nov 5, 2026

    @its-amann
    Contributor

    Opened a fix for this in #3974, would appreciate a look when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions