diff --git a/raillabel_providerkit/validation/validate_schema/validate_schema.py b/raillabel_providerkit/validation/validate_schema/validate_schema.py index 4853238..81f9124 100644 --- a/raillabel_providerkit/validation/validate_schema/validate_schema.py +++ b/raillabel_providerkit/validation/validate_schema/validate_schema.py @@ -30,6 +30,8 @@ def _make_errors_readable(errors: ValidationError) -> list[str]: readable_errors.append(_convert_literal_error_to_string(error)) elif error["type"] in ["bool_type", "bool_parsing"]: readable_errors.append(_convert_false_type_error_to_string(error, "bool")) + elif error["type"] in ["int_type", "int_parsing"]: + readable_errors.append(_convert_false_type_error_to_string(error, "int")) else: raise ValueError diff --git a/tests/test_raillabel_providerkit/validation/validate_schema/test_validate_schema.py b/tests/test_raillabel_providerkit/validation/validate_schema/test_validate_schema.py index 36ab020..64ddf2c 100644 --- a/tests/test_raillabel_providerkit/validation/validate_schema/test_validate_schema.py +++ b/tests/test_raillabel_providerkit/validation/validate_schema/test_validate_schema.py @@ -81,5 +81,15 @@ def test_wrong_type_bool(): assert "NOT A BOOLEAN" in actual[0] +def test_wrong_type_int(): + data = {"openlabel": {"metadata": {"schema_version": "1.0.0"}, "frames": {"NOT AN INT": {}}}} + + actual = validate_schema(data) + assert len(actual) == 1 + assert "$.openlabel.frames" in actual[0] + assert "int" in actual[0] + assert "NOT AN INT" in actual[0] + + if __name__ == "__main__": pytest.main([__file__, "-v"])