cic-schema/schema/json/bundle.py
2023-03-09 08:30:47 +00:00

44 lines
903 B
Python

# standard imports
import json
import os
fp = os.path.join('.', 'cic.in.json')
f = open(fp, 'r')
o = json.load(f)
fp = os.path.join('.', 'mime.in.json')
f = open(fp, 'r')
o_mime = json.load(f)
o['mime'] = o_mime
fp = os.path.join('.', 'opensea_part.in.json')
f = open(fp, 'r')
o_opensea = json.load(f)
for k in o_opensea['properties'].keys():
p = {}
for v in o_opensea['properties'][k]:
p[v] = o_opensea['properties'][k][v]
o['properties'][k] = p
o['required'] += o_opensea['required']
o['oneOf'] = o_opensea['oneOf']
fp = os.path.join('.', 'nft.in.json')
f = open(fp, 'r')
o_nft = json.load(f)
for k in o_nft['properties'].keys():
p = {}
for v in o_nft['properties'][k]:
p[v] = o_nft['properties'][k][v]
o['properties'][k] = p
os.makedirs('dist', exist_ok=True)
fp = os.path.join('dist', 'cic.json')
f = open(fp, 'w')
json.dump(o, f)
f.close()