Validate OSCAL Document
trestle_validateValidate a standalone OSCAL file against the OSCAL schema, enforcing required fields and types, with optional semantic checks for duplicate UUIDs and broken references.
Instructions
Validate a standalone OSCAL file against the OSCAL schema.
This tool loads the OSCAL document through the trestle model classes, which enforces the OSCAL schema (required fields, field types, enums, UUID formats, and nesting). Optionally it also runs trestle's semantic validators (duplicate UUIDs, broken internal references, links, and rule parameters).
It detects the model type from the file's single top-level wrapper key, so it validates any top-level OSCAL model: catalog, profile, component-definition, system-security-plan, assessment-plan, assessment-results, or plan-of-action-and-milestones.
Unlike trestle validate on the CLI, this works on a standalone file that
is not part of a trestle workspace — for example a POA&M JSON produced by an
authoring flow.
Args: params (TrestleValidateInput): Input parameters with: - file (str): Path to the OSCAL .json/.yaml/.yml file (required) - expected_model_type (Optional[str]): Enforce the file is this model type (e.g. 'plan-of-action-and-milestones') - semantic (bool): Run semantic validators too (default: true)
Returns: str: A pass/fail message; on failure, the concrete reasons.
Examples:
- Use when: "Validate this POA&M JSON is valid OSCAL"
file="./poam.json", expected_model_type="plan-of-action-and-milestones"
- Use when: "Check that catalog.json conforms to the OSCAL schema"
- Don't use when: The file is inside a trestle workspace and you want
the full trestle validate workspace checks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |