I'm looking a the documentation for Laravel Lighthouse and I am seeing two types of mutations.
- A mutation that includes the string
input:
(found here)
mutation {
createPost(input: { # <-- the "input:" I'm talking about
title: "My new Post"
author: {
connect: 123
}
}){
id
author {
name
}
}
}
And another mutation without the input:
(found here)
mutation CreateTaskWithNotes {
createTask( # <-- no "input:" here
id: 45
name: "Do something"
notes: [
{
content: "Foo bar",
link: "http://foo.bar"
},
{
content: "Awesome note"
}
]
) {
id
}
}
My question is: How do I get the mutations without input:
to work?
I try to copy (an modify) the examples from the documentation. But if I write a mutation like this:
type Mutation {
createTask(input: CreateTaskInput! @spread): Task! @create
}
When I try to omit input:
, graphql-playground complains: "Field createTask argument input of type CreateTaskInput is required but not provided"
Now I try to change the schema to this:
type Mutation {
createTask(CreateTaskInput! @spread): Task! @create
}
But then the server gives a ParseException
.
I do prefer the syntax without input:
because that is a lot less repetitive.
Can anybody help?