added realm to jspg processing
This commit is contained in:
33
scripts/update_fixtures.py
Normal file
33
scripts/update_fixtures.py
Normal file
@ -0,0 +1,33 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
fixtures_dir = 'fixtures'
|
||||
|
||||
for filename in os.listdir(fixtures_dir):
|
||||
if not filename.endswith('.json'):
|
||||
continue
|
||||
filepath = os.path.join(fixtures_dir, filename)
|
||||
with open(filepath, 'r') as f:
|
||||
try:
|
||||
data = json.load(f)
|
||||
except json.JSONDecodeError:
|
||||
print("Failed to parse", filepath)
|
||||
continue
|
||||
changed = False
|
||||
for suite in data:
|
||||
db = suite.get('database', {})
|
||||
if 'schemas' in db:
|
||||
if 'types' not in db:
|
||||
db['types'] = []
|
||||
for id_str, schema in db['schemas'].items():
|
||||
target_type = {
|
||||
'name': id_str,
|
||||
'schemas': { id_str: schema }
|
||||
}
|
||||
db['types'].append(target_type)
|
||||
del db['schemas']
|
||||
changed = True
|
||||
if changed:
|
||||
with open(filepath, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
print("Updated", filepath)
|
||||
Reference in New Issue
Block a user