admin管理员组文章数量:1122832
I'm defining my data model in the schema.graphql
file for my Flutter app, seemingly without any syntax errors and following the rules of GraphQL v2, but then when I try to push the changes (amplify push
) I get the following error: "id field is not of type Boolean
".
A screenshot of my Terminal: The command "amplify push" has been entered, and the terminal returns the error "id field is not type Boolean"
I cannot for the life of me figure out why this is happening. I believe with GraphQL transformer v2 the id field should be type ID!
as I've made it, but the error is suggesting that there's- what, a mismatch between the expected field type for the id field in one of my models?
I wish to push my changes to Amplify, but I cannot, until this error is solved.
Here's the code in question (aka the schema.graphql
file), containing my three models:
type UserAuthInfo
@model # In Amplify: Create a DynamoDB table and a GraphQL API for the model
@auth(
rules: [
{ allow: public, provider: identityPool, operations: [create] } # Allow public sign-up
{ allow: owner, operations: [read, update] } # Users can view & edit only their own records
{ allow: groups, groups: ["admin"], operations: [read, update, delete] } # Admins have full access
]
) {
id: ID!
email: AWSEmail!
password: String!
username: String!
}
# User model
type User
@model
@auth(
rules: [
{ allow: owner, operations: [create, update, delete] } # Only the owner can create, update, or delete their user record
{ allow: groups, groups: ["admin"], operations: [create, update, delete] } # Admins can create, update, or delete any user record
]
) {
id: ID!
username: String! @index(name: "byUsername", queryField: "userByUsername")
email: AWSEmail!
# Challenges created by the user:
challenges: [Challenge]
@hasMany(
indexName: "byOwner" # Matches the index name in the Challenge model, allows querying challenges by owner
fields: ["id"]
)
}
# Challenge model
type Challenge
@model
@auth(
rules: [
{
allow: owner
ownerField: "owner" # Use user ID for ownership tracking
identityClaim: "sub" # Use the unique user ID (sub) from the identity provider
operations: [create, update, delete]
}
{ allow: groups, groups: ["admin"], operations: [create, update, delete] } # Allow admin to delete challenges
]
) {
id: ID!
title: String!
lifeAspects: [String!]!
details: String
startDate: AWSDate!
targetDate: AWSDate
reminderDetails: String
associatedGoalId: ID! # Goal linked to challenge, if any
isCompleted: Boolean! # Tracks if the challenge is completed
owner: ID! # ID of user who created the challenge
createdAt: AWSDateTime # Automatically managed field for creation time
isClosed: Boolean # Tracks if the challenge is closed
@index(
name: "byOwner"
queryField: "challengesByOwner" # Allows querying challenges by user's owner field
sortKeyFields: ["createdAt"]
)
}
Any help would be appreciated.
本文标签: flutterGraphQL schema file error quotid field is not of type BooleanquotStack Overflow
版权声明:本文标题:flutter - GraphQL schema file error: "id field is not of type Boolean" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736310660a1934459.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论