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

get-schema has no consistent order of properties #111

Closed
cloudlena opened this issue Jan 4, 2018 · 6 comments
Closed

get-schema has no consistent order of properties #111

cloudlena opened this issue Jan 4, 2018 · 6 comments

Comments

@cloudlena
Copy link

cloudlena commented Jan 4, 2018

Every time I run graphql get-schema, the values of enums and the parameters of queries and mutations are sorted differently in schema.graphql. This leads to unnecessary changes in git diff when checking in the schema.graphql file. Shouldn't the order of enum values and query/mutation params be alphabetical and therefore consistent?

@schickling
Copy link
Contributor

Good point. Would actually be interesting what should be the source of truth here. The server? A certain strategy in the GraphQL CLI?

@cloudlena
Copy link
Author

That is a good point you're making, @schickling! I just checked using GraphiQL and there the params and enums are also not in alphabetical order. So maybe it's the server who messes the order up every time... I'm using https://github.com/graphql-go/handler. Do you think I should create the issue there instead?

@kbrandwijk
Copy link
Contributor

I think we should strive to reduce diffs to a minimum. That being said, maybe we should aim for a server-independent standard for local schema storage. Alphabetical makes sense, Schema - Query - Mutation - Subscription - Interfaces - Unions - Types - Input Types - Enums, then alphabetical also makes sense.

@cloudlena
Copy link
Author

I just created graphql-go/handler#34 to order the properties coming from the Go library.

@ardatan ardatan closed this as completed Oct 28, 2019
Repository owner deleted a comment from ardatan Oct 29, 2019
@Urigo
Copy link
Owner

Urigo commented Oct 29, 2019

We've just released a new alpha version channel for GraphQL CLI - 4.0.0-alpha.XXX!

We've changed the get-schema command to use GraphQL Code Generator plugin of GraphQL CLI with the Codegen's schema-ast plugin.

And for the diff we use GraphQL Inspector now.

Those tools should provide you with consistent output between runs.

Checkout new instructions in the migration guide and let us know your feedback during that alpha period!

Feel free to contact us by opening a new issue or joining our Discord channel;
https://discord.gg/xud7bH

@Urigo
Copy link
Owner

Urigo commented Oct 29, 2019

I've posted the wrong Discord link, this is the correct one: https://discord.gg/xud7bH9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants