GraphQL:整数太长? (AWS Amplify/GraphQL 转换)

GraphQL: Integer too long? (AWS Amplify/GraphQL Transform)

我使用 GraphQL 转换作为 AWS Amplify 的一部分。现在我想创建以下突变。但是,to 整数似乎太长了。阅读文档它应该可以更长。你知道为什么我总是收到错误: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
  }
}

这是我的架构:

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"])
}

来自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.

由于 Int 必须是 32 位值,因此其值不能大于 2147483647。对于值可能高于该值的字段,规范建议:

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.