|
10 | 10 | if str(ROOT) not in sys.path: |
11 | 11 | sys.path.insert(0, str(ROOT)) |
12 | 12 |
|
| 13 | +from scripts.lib.cedv_objects import load_cedv_objects # noqa: E402 |
13 | 14 | from scripts.lib.protocol_constants import ( # noqa: E402 |
14 | 15 | CANONICAL_RELATION_TYPES, |
15 | 16 | CEDV_ID_PREFIX_TO_OBJECT_TYPE, |
|
20 | 21 | relation_allowed_by_matrix, |
21 | 22 | validate_relation_matrix, |
22 | 23 | ) |
23 | | -from scripts.lib.simple_yaml import parse_simple_yaml # noqa: E402 |
24 | 24 |
|
25 | 25 | BASE = ROOT / 'protocol' / 'cedv' |
26 | 26 | DOC = BASE / 'relation-basis-validation-v1.md' |
@@ -75,27 +75,14 @@ def main() -> int: |
75 | 75 | relation_matrix = load_relation_matrix(RELATION_MATRIX) |
76 | 76 | errors.extend(validate_relation_matrix(relation_matrix)) |
77 | 77 |
|
78 | | - objects: dict[str, dict] = {} |
79 | | - for filename in REQ_EXAMPLES: |
80 | | - text = read(EXAMPLES / filename, errors) |
81 | | - if not text: |
82 | | - continue |
83 | | - obj = parse_simple_yaml(text) |
84 | | - object_id = obj.get('id') |
85 | | - if not isinstance(object_id, str): |
86 | | - errors.append(f'{filename} missing id') |
87 | | - continue |
88 | | - if object_id in objects: |
89 | | - errors.append(f'duplicate object id: {object_id}') |
90 | | - objects[object_id] = obj |
| 78 | + objects = load_cedv_objects((EXAMPLES / filename for filename in REQ_EXAMPLES), errors, ROOT) |
91 | 79 |
|
92 | 80 | for object_id, obj in objects.items(): |
93 | 81 | source_type = obj.get('object_type') |
94 | 82 | if not isinstance(source_type, str): |
95 | 83 | errors.append(f'{object_id} missing object_type') |
96 | 84 | continue |
97 | 85 | if source_type not in CEDV_OBJECT_TYPES: |
98 | | - errors.append(f'{object_id} object_type is not a shared CEDV type: {source_type}') |
99 | 86 | continue |
100 | 87 | links = obj.get('links') |
101 | 88 | if not isinstance(links, list): |
@@ -143,7 +130,7 @@ def main() -> int: |
143 | 130 | print('- CEDV link targets and basis_refs resolve') |
144 | 131 | print('- relation source/target families are admissible through relation-admissibility-matrix-v1.json') |
145 | 132 | print('- shared CEDV prefix and object-type constants are used by this checker') |
146 | | - print('- shared simple YAML parser is used by this checker') |
| 133 | + print('- shared CEDV object loader is used by this checker') |
147 | 134 | print('- evidence, dissent, and verdict objects do not float free') |
148 | 135 | return 0 |
149 | 136 |
|
|
0 commit comments