We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3d493c3 + 85527e1 commit f76f38eCopy full SHA for f76f38e
graphene_django/management/commands/graphql_schema.py
@@ -21,7 +21,7 @@ def add_arguments(self, parser):
21
type=str,
22
dest="out",
23
default=graphene_settings.SCHEMA_OUTPUT,
24
- help="Output file (default: schema.json)",
+ help="Output file, --out=- prints to stdout (default: schema.json)",
25
)
26
27
parser.add_argument(
@@ -64,9 +64,12 @@ def handle(self, *args, **options):
64
65
indent = options.get("indent")
66
schema_dict = {"data": schema.introspect()}
67
- self.save_file(out, schema_dict, indent)
+ if out == '-':
68
+ self.stdout.write(json.dumps(schema_dict, indent=indent))
69
+ else:
70
+ self.save_file(out, schema_dict, indent)
71
- style = getattr(self, "style", None)
- success = getattr(style, "SUCCESS", lambda x: x)
72
+ style = getattr(self, "style", None)
73
+ success = getattr(style, "SUCCESS", lambda x: x)
74
- self.stdout.write(success("Successfully dumped GraphQL schema to %s" % out))
75
+ self.stdout.write(success("Successfully dumped GraphQL schema to %s" % out))
0 commit comments