The Guild LogoThe Guild Monogram

Search docs

Search icon

Products by The Guild

Products

Hive logoHive blurred logo

Hive

Schema Registry for your GraphQL Workflows

Skip to main content

SafeInt

This scalar behaves just like the native GraphQLInt scalar, but it allows integers that require more than 32-bits. Any integer that is considered "safe" in JavaScript (i.e. ± 9,007,199,254,740,991) is considered a valid value. But if you need more than 52-bits, you should use BigInt.

The GraphQL spec limits its Int type to 32-bits. Maybe you've seen this error before: Issue on graphql-js

Based on graphql-bigint. Even though stems's implementation looks like the same with BigInt scalar, it is different because our BigInt implementation uses JavaScript's native BigInt type while SafeInt implementation doesn't support more than 52-bit integers.