Last active
June 19, 2019 12:50
-
-
Save hugoledoux/4002869e257c56341722f0302a37c73e to your computer and use it in GitHub Desktop.
stitch diff JSON schemas into one (in this case CityJSON)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import json | |
import jsonschema | |
import jsonref | |
root_schema = os.path.abspath('../schemas/cityjson.schema.json') | |
print (root_schema) | |
fins = open(root_schema) | |
sys.exit() | |
abs_path = os.path.abspath(os.path.dirname(root_schema)) | |
base_uri = 'file://{}/'.format(abs_path) | |
js = jsonref.loads(fins.read(), jsonschema=True, base_uri=base_uri) | |
# -- output stitched_schema | |
json_str = json.dumps(js) | |
f = open('../schemas/cityjson.min.schema.json', "w") | |
f.write(json_str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment