cic-schema/schema/json/bundle.py

44 lines
903 B
Python
Raw Permalink Normal View History

2023-03-05 10:59:41 +01:00
# 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
2023-03-05 20:29:08 +01:00
os.makedirs('dist', exist_ok=True)
2023-03-05 12:18:41 +01:00
2023-03-05 20:29:08 +01:00
fp = os.path.join('dist', 'cic.json')
2023-03-05 12:18:41 +01:00
f = open(fp, 'w')
json.dump(o, f)
f.close()