Skip to content

Large Integers and GraphQLInt #292

@bringking

Description

@bringking

This is related to mickhansen/graphql-sequelize#144, but I noticed in the spec that GraphQL limits integers to 2^31, and JS "Number" goes up to 2^53. We ran into errors in our application because we were using BigInt columns in the DB, and the GraphQLInt was returning null for those values. So I am wondering the "best" path forward-

  • Implement our own Scalar with GraphQLBigInt that doesn't enforce the spec limit
  • Use GraphQLFloat because in the JS implementation you use parseFloat which as a bug/feature/side-effect returns valid integers for large input integers. e.g
parseFloat("300494988383") // returns 300494988383, not 300494988383.0

Is this something that could be fixed here or is this library meant to stay strictly spec compliant?

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