Fields order
See original GitHub issueI am building GraphQL API and I really like code-first style so thank you for this tool.
While code-first style is more convenient and eliminates duplication the generated schema and introspection query (used by GraphiQL) doesn’t look as good as handwritten. So I would like to improve it.
First think is order of fields. Currently introspection query returns fields in no particular order. I think they should be at least sorted alphabetically but even better would be possibility to specify their order. Since order in source code is not much useful here (fields can come from different classes) I would add some annotation which could be used to list names of fields in required order, something simitar to @XmlType.propOrder
.
In 680f20d
commit I added @GraphQLType.propOrder
but it could be for example @GraphQLType.fieldOrder
or separate annotation. It should also be added to @GraphQLInterface
.
Does this feature make sense for you and should I finish it and create PR? If yes, how exactly the annotation should look like?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
I think you’re right… This does end up being the documentation for the human as well. As such if should be nice. So, yes, if you’re interested in developing this feature please go forward. As for the attribute name, I’d go for
fieldOrder
to be consistent with the GraphQL terminology.Thanks for merging my PR.