UnsignedInt — GraphQL Custom Scalar

Author – ChilliCream

Date – 2026-01-09

1Overview

The UnsignedInt scalar type represents an unsigned 32-bit integer. It is intended for scenarios where values are constrained to the range 0 to 4,294,967,295, such as representing counts, sizes, indices, or other non-negative integer values.

Unlike the built-in Int scalar which represents signed 32-bit integers with a range of -2,147,483,648 to 2,147,483,647, UnsignedInt provides stronger type safety for values that must be non-negative and can represent larger positive values.

3Result spec

An UnsignedInt scalar must serialize to an integer value in the range 0 to 4,294,967,295 (inclusive).

3.1Examples

These are valid result values:

Value Explanation
0 Minimum unsigned int value.
4294967295 Maximum unsigned int value.
2147483648 A value exceeding signed int maximum.

These are invalid result values:

Value Why is it invalid
-1 Negative values are not allowed.
4294967296 Exceeds maximum unsigned int value.
3.14 Fractional values are not allowed.
"1000" Must be a number, not a string.

4Input spec

An UnsignedInt scalar accepts integer values in the range 0 to 4,294,967,295 (inclusive), both as GraphQL literals and as JSON input values.

Implementations should validate:

4.1Examples

Valid input values:

GraphQL Literal:

query {
  items(limit: 100, offset: 50) {
    id
  }
}

JSON input:

{
  "limit": 100,
  "offset": 50
}
{
  "count": 4294967295
}

Invalid input values:

Value Why is it invalid
-1 Negative values are not allowed.
4294967296 Exceeds maximum unsigned int value.
3.14 Fractional values are not allowed.
"1000" Must be a number, not a string.

5References

  1. 1Overview
  2. 2Recommended name
  3. 3Result spec
    1. 3.1Examples
  4. 4Input spec
    1. 4.1Examples
  5. 5References