Validation error of type SubSelectionRequired: Sub selection required for type null of field

0

I'm trying to getUser with Id through Amplify.API

My schema :

type User @model @searchable @auth(rules: [{ allow: owner,ownerField: "id", operations: [create, read, delete, update]}, { allow: public, operations: [read, update] }]){
    id: ID!
    name:String!
    username: String!

    posts: [Post]!@hasMany

    notification: [Notification]!@hasMany

    searchHistory: [Search]!@hasMany

}

type Notification @model @auth(rules: [{ allow: owner,ownerField: "forUser", operations: [create, read, delete, update]},{ allow: public , operations: [create, read, delete, update]}]) {
    content: String!

    byUser: User

    forUser: User! @belongsTo
}


type Search @model @searchable @auth(rules: [{ allow: owner,ownerField: "user", operations: [create, read, delete, update]},{ allow: public , operations: [create, read, delete, update]}]) {
    id: ID!
    searchValue: String!
    user: User! @belongsTo
}

type Post @model @searchable @auth(rules: [{ allow: owner,ownerField: "byUser", operations: [create, read, delete, update]}, { allow: public, operations: [create, read, delete, update] }]){
    id: ID!

    title: String!

    byUser: User! @belongsTo


}

Error:

[{"locations":[{"column":9,"line":10}],"message":"Validation error of type SubSelectionRequired: Sub selection required for type null of field forUser @ \u0027getUser/notification/items/forUser\u0027"},{"locations":[{"column":9,"line":38}],"message":"Validation error of type SubSelectionRequired: Sub selection required for type null of field user @ \u0027getUser/searchHistory/items/user\u0027"}]

Look I'm getting this when I'm adding auth rules, but why I'm not getting for Post model, post has also byUser: User! @belongsTo as a owner? why I'm getting for only notification and search?

답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠