Skip to content

Loosening object identification GraphQL spec #1061

@calebmer

Description

@calebmer

On a project I'm working on we are automatically generating a GraphQL server from a SQL server and many of our tables have an integer column named id. When serving this table through GraphQL we would like to make the id column queryable, however we also want our rows to implement a Node type in accordance to the Relay GraphQL spec. According to the spec an id field that is globally unique is required for compliance. This puts us in a binding position. Do we not allow columns to be named id? Do we rename id to rowId in GraphQL? These solutions aren't ideal as we also have many more foreign key columns like authorId which reference an id primary key.

The optimal solution would be if Relay allowed the id field to be renamed, either to _id or maybe gid (for global ID). Would it be possible to update the specification and Relay to allow for this? Is there a solution I'm not seeing?

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