this is my schema mode:type urlCommentData {  id: ...
# orm-help
l
this is my schema mode:type urlCommentData {  id: ID!  start: Int!  end: Int!  url: String!  count: Int!  kind: String!  comments: [Comment] @relation(name: "CommentUrls") } type Comment {  id: ID! @unique @id  text: String  imgs: [String] @scalarList(strategy: RELATION)  urls: [urlCommentData] @relation(name: "CommentUrls")  gif: String  createdAt: DateTime! @createdAt  updatedAt: DateTime! @updatedAt  commentOn: Caption! @relation(name: "CommentToCaption", onDelete: SET_NULL)  user: User! @relation(name: "CommentToUser", onDelete: SET_NULL)  replys: [Reply] @relation(name: "ReplyToComment", onDelete: CASCADE) } And this is my mutation which takes and array of objects: const CREATE_COMMENT = gql
Copy code
mutation CreateComment($comment: String!, $caption: ID!,$gif:String,$imgs:[String!],$urls:[urlCommentData!]) {
  createComment(
   data: {
    text: $comment
    imgs:{
     set:$imgs
    }
    urls:{
     create:$urls
    }
    gif:$gif
    user: { connect: { id: "ckg1dmbhk010707759dqhz5rq" } }
    commentOn: { connect: { id: $caption } }
   }
  ) {
  
   id
   text
 user{
  id
  name
 }
 commentOn{
  id
    text
   }
  }
 }
But I am getting this error: ”index.js:26 Uncaught (in promise) Error: Variable '$urls' cannot be non input type '[urlCommentData!]'. (line 1, column 97): mutation CreateComment($comment: String!, $caption: ID!, $gif: String, $imgs: [String!], $urls: [urlCommentData!]) {“
r
As per your schema, I have created this mutation in the Playground and it’s working:
Copy code
# Write your query or mutation here
mutation {
  createComment(
    data: {
      text: "ddadasd"
      gif: "gif"
      imgs: { set: ["image1", "image2"] }
      urls: {
        create: [
          { start: 1, end: 10, url: "url1", count: 10, kind: "url" }
          { start: 1, end: 10, url: "url2", count: 10, kind: "url" }
        ]
      }
    }
  ) {
    text
    imgs
    urls {
      id
    }
  }
}
I would suggest checking the inputs properly and see if they match what Prisma requires.