nikitastupin / clairvoyance

Obtain GraphQL API schema even if the introspection is disabled
Apache License 2.0
968 stars 87 forks source link

Sort fields by name in JSON output #14

Closed nikitastupin closed 3 years ago

nikitastupin commented 3 years ago

We sort JSON schema by keys:

https://github.com/nikitastupin/clairvoyance/blob/26eecd1aac2b61c0c688aff630bb4ebfcc731bb0/clairvoyance/graphql.py#L96

but it's not enough for fields to be sorted by name. So we should first sort self.types.keys() and then iterate through them instead of:

https://github.com/nikitastupin/clairvoyance/blob/26eecd1aac2b61c0c688aff630bb4ebfcc731bb0/clairvoyance/graphql.py#L93

i-tsaturov commented 3 years ago

For the reason, that we use graphql-voyager as the tool for displaying the generated schema, i think we can close this issue, because there already has functionality for sort in alphabetically