Home > database >  laravel-lighthouse get unknown argument error when use @spread
laravel-lighthouse get unknown argument error when use @spread

Time:02-07

im using laravel-lighthouse package.

please look the method 2:

when i use input and @spread for my login mutation i will get some errors that you can see below:

enter image description here

but if i use method 1 it works without problem and return the token. why? (im using latest package.)

method: 1 (will return token. work correctly)

type Mutation {
  login(
    email: String!
    password: String!
  ): String @field(resolver: "AuthMutator@resolve")
}

method: 2 (return errors!)

input LoginInput {
    email: String!
    password: String!
}


type Mutation {
    login(input: LoginInput! @spread): String
        @field(resolver: "AuthMutator@resolve")

}

CodePudding user response:

The error message shown in your screenshot is perfectly clear and tells you exactly what is wrong. @spread only changes how the arguments are received internally, but for a client the schema appears exactly as defined. In method 2, the field login expects a single argument input.

  •  Tags:  
  • Related