Update schema generation

This commit is contained in:
Christian Cueni 2020-05-04 09:31:44 +02:00
parent b7e929e9dd
commit 9a2991961c
3 changed files with 18 additions and 17839 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,9 +7,23 @@ import os
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
filename = 'schema.json' schemas = [
{
'filename': 'schema.json',
'schema': 'api.schema.schema'
},
{
'filename': 'schema_public.json',
'schema': 'api.schema_public.schema'
}
]
for schema in schemas:
self.create_schema(schema['filename'], schema['schema'])
def create_schema(self, filename, schema):
cypress_path = os.path.join(settings.BASE_DIR, '..', 'client', 'cypress', 'fixtures', filename) cypress_path = os.path.join(settings.BASE_DIR, '..', 'client', 'cypress', 'fixtures', filename)
call_command('graphql_schema', schema='api.schema.schema', out=filename, indent=4) call_command('graphql_schema', schema=schema, out=filename, indent=4)
with open(filename) as f: with open(filename) as f:
initial_json = json.loads(f.read()) initial_json = json.loads(f.read())