【发布时间】:2020-04-08 08:03:52
【问题描述】:
我使用 GraphQL Transform 作为 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"])
}
【问题讨论】:
标签: graphql aws-amplify