Validate manual schema
This commit is contained in:
1 parent
c9c45d7f03
commit
9044f540bb
6 files changed
+271
-45
No files matched your search
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
import jsonschema
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: {} MANUAL_FILE ...".format(sys.argv[0]))
|
||||
|
||||
with open("manual_schema.yml", "r") as schema_file:
|
||||
manual_schema = yaml.safe_load(schema_file)
|
||||
|
||||
for path in sys.argv[1:]:
|
||||
with open(path, "r") as manual_file:
|
||||
manual_data = yaml.safe_load(manual_file)
|
||||
try:
|
||||
jsonschema.validate(instance=manual_data, schema=manual_schema)
|
||||
except jsonschema.exceptions.ValidationError as e:
|
||||
print("Failed to validate:", path, file=sys.stderr)
|
||||
sys.exit(e)
|
||||
Reference in new issue
Block a user