Summary
validation/validate.py can raise AttributeError after JSON Schema has already identified an invalid YAML shape. The exception prevents the existing validation reporter from showing the useful schema errors it collected.
This occurs when the document root is empty or not a mapping. It can also occur when semantic_model has an invalid nested shape because the semantic checks assume schema-valid mappings and lists.
Reproduction
From the repository root at 8c410f904c9bb20f683ef31292442e7bc432a8f6:
uv run validation/validate.py /dev/null --schema core-spec/osi-schema.json
The command exits with an internal exception:
AttributeError: 'NoneType' object has no attribute 'get'
Other affected inputs include a sequence root ([]), a scalar root, and a malformed nested value such as semantic_model: invalid.
Expected behavior
The command should exit 1 through the existing validation reporter:
Validation FAILED with 1 error(s):
[Schema] (root): None is not of type 'object'
It should not emit an internal traceback.
Proposed scope
- Report the schema errors already collected for structurally invalid documents.
- Run semantic checks only after schema validation has established their expected nested shapes.
- Add focused regression coverage for empty, sequence, scalar, and malformed nested inputs.
- Keep the specification, public CLI, and dependency set unchanged.
Summary
validation/validate.pycan raiseAttributeErrorafter JSON Schema has already identified an invalid YAML shape. The exception prevents the existing validation reporter from showing the useful schema errors it collected.This occurs when the document root is empty or not a mapping. It can also occur when
semantic_modelhas an invalid nested shape because the semantic checks assume schema-valid mappings and lists.Reproduction
From the repository root at
8c410f904c9bb20f683ef31292442e7bc432a8f6:The command exits with an internal exception:
Other affected inputs include a sequence root (
[]), a scalar root, and a malformed nested value such assemantic_model: invalid.Expected behavior
The command should exit 1 through the existing validation reporter:
It should not emit an internal traceback.
Proposed scope