I use GraphQL Transform as part of AWS Amplify. Now I want to create the following mutation. However, it seems the to
integer is too long. Reading the documentation it should be able to be much longer. Do you know why I always receive the error: Validation error of type WrongType: argument 'input.to' with value 'IntValue{value=49160381234}' is not a valid 'Int' @ 'createNumber
mutation createNumber {
createNumber(input: {
username: "mymail@gmail.com"
to: 49160381234
}) {
username
to
}
}
Here my schema:
type Message
@model
@auth(rules: [{ allow: owner }])
@key(fields: ["to", "from"]) # `to` as primary index and `from` as sort key.
@key(
name: "byToByTimestamp"
fields: ["to", "timestamp"]
queryField: "messagesByToByTimestamp"
) {
to: Int!
from: String!
medium: String!
messageBody: String!
timestamp: Int!
}
type Number
@model
@key(fields: ["to"]) # Each number can only exist once.
@key(
name: "byUserByTo"
fields: ["username", "to"]
queryField: "numberByUserByTo"
) {
username: String!
to: Int!
messages: [Message] @connection(keyName: "byToByTimestamp", fields: ["to"])
}
type User @model @key(fields: ["username"]) {
username: String!
numbers: [Number] @connection(keyName: "byUserByTo", fields: ["username"])
}
From the spec:
The Int scalar type represents a signed 32‐bit numeric non‐fractional value. Response formats that support a 32‐bit integer or a number type should use that type to represent this scalar... If the integer internal value represents a value less than -2^31 or greater than or equal to 2^31, a field error should be raised.
Since an Int has to be a 32-bit value, its value cannot be greater than 2147483647. For fields that may have values higher than that, the spec suggests:
Numeric integer values larger than 32‐bit should either use String or a custom‐defined Scalar type, as not all platforms and transports support encoding integer numbers larger than 32‐bit.