Skip to content

Commit

Permalink
Fix issue #1055 (#1056)
Browse files Browse the repository at this point in the history
* Fix issue #1055

* Fix if to elif

* Use self.stdout.write instead of print when printing graphql schema

Co-authored-by: leonardo arroyo <[contato@leonardoarroyo.com](mailto:contato@leonardoarroyo.com)>
  • Loading branch information
leonardoarroyo and leonardo arroyo authored Dec 23, 2020
1 parent cc3bd05 commit 0e12343
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion graphene_django/management/commands/graphql_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0e12343

Please sign in to comment.