我在 AppSync for GraphQL 中有以下架构
input CreateTeamInput {
name: String!
sport: Sports!
createdAt: String
}
enum Sports {
baseball
basketball
cross_country
}
type Mutation{
createTeam(input: CreateTeamInput!): Team
}
但是,当我尝试使用 AWS Amplify 库通过
export const CreateTeam = `mutation CreateTeam($name: String!, $sport: String!){
createTeam(input:{name:$name, sport:$sport}) {
id,
name,
sport
}
}
`;
....
API.graphql(graphqlOperation(CreateTeam, this.state))
我收到以下错误:Validation error of type VariableTypeMismatch: Variable type doesn't match
。
如何更新我的代码以使用此枚举类型?