Skip to content

Parsing "integer" double causes "GraphQL only supports 32-bit signed integers" error #295

Description

@gitmodimo

When js number is converted to JSON using JSON.stringify we cannot control output format. Big number intended to be floating point can resemble integer number. This triggers "GraphQL only supports 32-bit signed integers" in JSONResponse.cpp.
We probably should guess that integers bigger than int32 are in fact double?

	bool Uint(unsigned int i)
	{
		if (i > static_cast<unsigned int>(std::numeric_limits<int>::max()))
		{
			return Double(static_cast<double>(i));
		}
		return Int(static_cast<int>(i));
	}

	bool Int64(int64_t i)
	{
		return Double(static_cast<double>(i));
	}

	bool Uint64(uint64_t i)
	{
		return Double(static_cast<double>(i));
	}


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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