-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate and document schemas #106
Conversation
Format schema files with "python3 -m json.tool"
This appears to be the way to validate a given JSON blob against a schema with Python: import json
import pathlib
import jsonschema
import jsonref # to expand `$ref`
blob = json.loads(pathlib.Path("port-data.json").read_text())
schema_file = pathlib.Path("port-schema.json")
schema = jsonref.loads(schema_file.read_text(), base_uri = schema_file.absolute().as_uri())
jsonschema.validate(blob, schema) With some changes (correct datamodel/schemas/Service.json Lines 15 to 24 in 2548a8e
Perhaps that could be removed? The draft Data Model 2.0.0 spec has no mention of a |
Tthis can be commented out for now. Noticing the 'not' key, it was asked by FIU to be able to exclude certain vendor's equipments for security reasons. |
Sadly JSON do not have "real" comment syntax. And it is the
I'm guessing it should be |
Pull Request Test Coverage Report for Build 5903673856
💛 - Coveralls |
Yes, this should work: "not": { "anyOf" : [...] }" |
This tool is cool. I guess it's relatively new. I googled around and didn't find such a tool two years ago! |
Fixes #105. Changes:
$ref
values refer to the correct external files, and other things that surfaced when testing.python3 -m json.tool <infile> <outfile
. I just like mechanically formatted files. ;-)