Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant export schema to stdout in graphql format #1055

Closed
leonardoarroyo opened this issue Nov 4, 2020 · 2 comments · Fixed by #1056
Closed

Cant export schema to stdout in graphql format #1055

leonardoarroyo opened this issue Nov 4, 2020 · 2 comments · Fixed by #1056
Labels

Comments

@leonardoarroyo
Copy link
Contributor

The format for the schema(json or graphql SDL) is defined by the extension of the --out flag. If --out=-(stdout), there's no way to generate a GraphQL SDL representation of the schema.

leonardoarroyo added a commit to leonardoarroyo/graphene-django that referenced this issue Nov 4, 2020
@perryjrandall
Copy link

@leonardoarroyo rather than special case the out name further, perhaps it is more clear to split the format and the output name

I'd imagine ssomething like ./manage.py graphql_schema --format graphql without out would default to stdout, then you can pipe / redirect if you'd like but really just specify the format you want

Also I think it would make sense to make the default format in that case graphql instead of json

@leonardoarroyo
Copy link
Contributor Author

@leonardoarroyo rather than special case the out name further, perhaps it is more clear to split the format and the output name

I'd imagine ssomething like ./manage.py graphql_schema --format graphql without out would default to stdout, then you can pipe / redirect if you'd like but really just specify the format you want

Also I think it would make sense to make the default format in that case graphql instead of json

I much prefer this solution. I think --out can be removed entirely in favor of pipe redirection, but that would lead to a breaking change.
I believe mixing --out=filename.{format} inference and adding --format would lead to confusion, so that's why I implemented #1056 the way I did.

Can we have some input from the project team about how to proceed here?

zbyte64 pushed a commit that referenced this issue Dec 23, 2020
* 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)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants