Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add get_graphql_schema management command

Rafał Pitoń4f315734caae
diff --git a/saleor/graphql/management/__init__.py b/saleor/graphql/management/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/saleor/graphql/management/commands/__init__.py b/saleor/graphql/management/commands/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/saleor/graphql/management/commands/get_graphql_schema.py b/saleor/graphql/management/commands/get_graphql_schema.py
new file mode 100644
index 0000000000..c9a068a94c
--- /dev/null
+++ b/saleor/graphql/management/commands/get_graphql_schema.py
@@ -0,0 +1,11 @@
+from django.core.management.base import BaseCommand
+from graphql.utils.schema_printer import print_schema
+
+from ...api import schema
+
+
+class Command(BaseCommand):
+ help = 'Writes SDL for GraphQL API schema to stdout'
+
+ def handle(self, *args, **options):
+ self.stdout.write(print_schema(schema))