trestle.core.oscal_backward_compatibility
trestle.core.oscal_backward_compatibility ¤
Pre-parse OSCAL backward-compatibility checker.
Inspects the raw JSON dict of an OSCAL document before Pydantic parsing and reports constructs that are incompatible with OSCAL 1.2.x. This allows trestle to emit clear, actionable error messages instead of cryptic Pydantic validation errors when older documents are loaded.
Attributes¤
logger = logging.getLogger(__name__) module-attribute ¤
Classes¤
CompatIssue ¤
Bases: NamedTuple
flowchart TD
trestle.core.oscal_backward_compatibility.CompatIssue[CompatIssue]
click trestle.core.oscal_backward_compatibility.CompatIssue href "" "trestle.core.oscal_backward_compatibility.CompatIssue"
A single backward-compatibility issue found in a raw OSCAL document.
Source code in trestle/core/oscal_backward_compatibility.py
43 44 45 46 47 48 49 50 51 | |
Functions:¤
check_file(path) ¤
Load a JSON file and run the backward-compatibility checks on it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | Path | Path to a JSON OSCAL document. | required |
Returns:
| Type | Description |
|---|---|
List[CompatIssue] | A list of CompatIssue. Empty list means no issues detected. |
List[CompatIssue] | Returns an empty list if the file cannot be read or is not valid JSON — |
List[CompatIssue] | the subsequent model load will fail and report the error. |
Source code in trestle/core/oscal_backward_compatibility.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
check_raw_oscal(raw) ¤
Inspect a raw OSCAL JSON dict and return all backward-compatibility issues.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw | Dict[str, Any] | The top-level parsed JSON dict of an OSCAL document. | required |
Returns:
| Type | Description |
|---|---|
List[CompatIssue] | A list of CompatIssue. Empty list means no issues detected. |
Source code in trestle/core/oscal_backward_compatibility.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
handler: python