diff --git a/graphene_django/management/commands/graphql_schema.py b/graphene_django/management/commands/graphql_schema.py index dcef73c8f..bd1c8e600 100644 --- a/graphene_django/management/commands/graphql_schema.py +++ b/graphene_django/management/commands/graphql_schema.py @@ -60,8 +60,10 @@ def save_graphql_file(self, out, schema): def get_schema(self, schema, out, indent): schema_dict = {"data": schema.introspect()} - if out == "-": + if out == "-" or out == "-.json": self.stdout.write(json.dumps(schema_dict, indent=indent, sort_keys=True)) + elif out == "-.graphql": + self.stdout.write(print_schema(schema)) else: # Determine format _, file_extension = os.path.splitext(out)