-
Notifications
You must be signed in to change notification settings - Fork 767
Allow graphql schema export to use a canonical representation #439
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
Conversation
@garyd203 Interested to update this pull request? |
Yes @firaskafri, hopefully in the next day or two |
d3f02df
to
3c3c637
Compare
I have rebased this now @firaskafri |
Thank you @garyd203! |
Given that the current behaviour is essentially defined by dict ordering which until recently has been explicitly something that shouldn’t be depended on, I don’t think this is really breaking anything. I’m strongly in favour of remove this as it simplifies the code significantly. It may be worth keeping a brief note in the documentation to say that keys are sorted as it’s a nice thing to be able to rely on now! |
Completely agree with @danpalmer - this behaviour should be the default. |
3c3c637
to
1ca44b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one. Thanks for the changes!
When we use the
graphql_schema
management command, the output can vary from run to run depending on arbitrary factors (because there is no guarantee made about the order used to output JSON dictionary keys). This makes it difficult to compare two schema's at different points in time.We address this by including a new
canonical
flag to the command, which uses standardjson.dump
funcitonality to sort dictionary keys and force pretty-printed output.