mirror of
https://github.com/chemistry-software/Periodic-Table-JSON.git
synced 2026-11-07 09:17:31 +00:00
* added: group, wxpos (wide x position), wypos(wide y position), block * update: README.md
21 lines
611 B
Python
Executable File
21 lines
611 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Validate that the JSON data is correctly formatted according
|
|
to the template in the 'schemas' directory.
|
|
"""
|
|
|
|
import json
|
|
import jsonschema
|
|
|
|
PERIODIC_TABLE_JSON = "../PeriodicTableJSON.json"
|
|
PERIODIC_TABLE_SCHEMA = "../schemas/periodicTableJSON.schema"
|
|
|
|
print(f"Validating {PERIODIC_TABLE_JSON} against {PERIODIC_TABLE_SCHEMA}")
|
|
with open(PERIODIC_TABLE_JSON) as jfile, open(PERIODIC_TABLE_SCHEMA) as sfile:
|
|
data = json.load(jfile)
|
|
schema = json.load(sfile)
|
|
# Raises an exception in case of failure
|
|
jsonschema.validate(instance=data,schema=schema)
|
|
|
|
print("Validation passed")
|