2

I need to enter multiple Ids to a field in my mutations. How can I achieve that seeing array is not included in the scalar type. I'm using Laravel lighthouse package.

I have tried to use [] to pass in the Ids but not working.

    mutation{
      syncPermissions(roleId: 1 permissions: [1, 2, 3]){
      name
   }
 }

I expect to access the permissions (in this case Ids) as an array in my resolve method.

obi patrick
  • 73
  • 1
  • 11
  • Did the answer solve the problem for you? Then mark it as solved. Else we will gladly help you and see if we can find the your issue. – Oliver Nybroe Sep 02 '19 at 10:56

1 Answers1

2

You simply wrap the type in [], in your schema.

Example:

extend type Mutation {
    syncPermissions(roleId: Int!, permissions: [Int!])
    @field(resolver: "MyResolver@update")
}
Albert Haff
  • 358
  • 2
  • 7