【发布时间】:2020-12-21 10:45:15
【问题描述】:
我已经从这个模型在 AWS AppSync(使用 CLI)上生成了一个简单的 GraphQL API:
type WalletProperty @model {
id: ID!
title: String!
}
这会生成一个与此类似的 CreateWalletProperty、UpdateWalletProperty 和 DeleteWalletProperty 突变:
mutation CreateWalletProperty(
$input: CreateWalletPropertyInput!
$condition: ModelWalletPropertyConditionInput <<<<<<<<<<<< what is this for?
) {
createWalletProperty(input: $input, condition: $condition) {
id
title
createdAt
updatedAt
}
}
条件的架构是:
input ModelWalletPropertyConditionInput {
title: ModelStringInput
and: [ModelWalletPropertyConditionInput]
or: [ModelWalletPropertyConditionInput]
not: ModelWalletPropertyConditionInput
}
鉴于我总是必须提供强制性的 $input,$condition 参数的用途是什么?
【问题讨论】:
-
未标记为
!,则不是强制性/不需要...用于过滤受影响的行/项目的可选参数 -
@xadm,谢谢。我刚刚对其进行了测试,它似乎与输入参数一起应用。鉴于 $input 已经是强制性的,我想不出一个真正有意义或可以应用的用例?
-
不是为了创建,而是为了更新……
标签: graphql aws-appsync graphql-mutation graphql-codegen