Skip to content

On specifying ordered vs unordered enum definitions #1062

Closed
@cdaringe

Description

@cdaringe

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions