Problem
There is no specification on whether EnumTypeDefinition are sorted by Name, and it causes friction for GQL clients who presume there is order.
Context
- EnumTypeDefinition makes no indication of ordering
- Ordering very is significant to clients who convert the stringly-GQL DSL to typed client SDKs
As observed from the above, ordering matters during codegen to GQL consumers. If a schema maintainer changed the enum to enum { Yy Xx Zz }, some clients would see this as a breaking change in the status quo.
Discussion
- To help consumers/clients of GQL succeed, the spec should disambiguate ordering on
EnumTypeDefinition.
Personal recommendation: enums and tagged unions alike are Sets, thus intrinsically unordered. We should state as much. Equipped with this assertion, client libraries whom seek to do type generation should apply stable sorting.
Problem
There is no specification on whether EnumTypeDefinition are sorted by
Name, and it causes friction for GQL clients who presume there is order.Context
enum { Xx Zz Yy }union Foo = Xx | Zz | Yypublic struct AsXxOrZzOrYy: GraphQLSelectionSet {As observed from the above, ordering matters during codegen to GQL consumers. If a schema maintainer changed the enum to
enum { Yy Xx Zz }, some clients would see this as a breaking change in the status quo.Discussion
EnumTypeDefinition.Personal recommendation:
enums and tagged unions alike areSets, thus intrinsically unordered. We should state as much. Equipped with this assertion, client libraries whom seek to do type generation should apply stable sorting.