This is a request for comments and advice rather than a bug report.
I will use the example setup of this issue again.
I would like to be able to create a new person with new dogs at once, like so:
mutation NewPersonWithDogs($person: PersonWithDogsCreateInput!) {
createPerson(input: [$person]) {
id
name
dogs {
name
}
}
}
$var = {
person => {
name => "Joe",
dogs => [
{
name => "Betsy"
},
{
name => "Barkley"
},
{
name => "Barney"
}
]
}
}
This works "out of the box", if I replace the schema created by GraphQL::Plugin::Convert::DBIC with the following:
type Person {
dogs: [Dog]
id: Int!
name: String!
}
type Dog {
id: Int!
name: String!
owner: Person!
}
type Query {
people(id: [Int!]!): [Person]
}
input PersonWithDogsCreateInput {
name: String!
dogs: [PersonalDogCreateInput!]!
}
input PersonalDogCreateInput {
name: String!
}
type Mutation {
createPerson(input: [PersonWithDogsCreateInput!]!): [Person]
}
However, there are some limitations for doing this outside of GraphQL::Plugin::Convert::DBIC:
-
I see no easy way to amend the schema generated by GraphQL::Plugin::Convert::DBIC other than completely replacing it.
-
The mutation has to be named createPerson due to how the resolver determines the method and the source name. The name should better be taken from $info->{return_type}->name.
Do you think that such mutations are a good idea and should be included? Any other comments? Thank you!
This is a request for comments and advice rather than a bug report.
I will use the example setup of this issue again.
I would like to be able to create a new person with new dogs at once, like so:
This works "out of the box", if I replace the schema created by
GraphQL::Plugin::Convert::DBICwith the following:However, there are some limitations for doing this outside of
GraphQL::Plugin::Convert::DBIC:I see no easy way to amend the schema generated by
GraphQL::Plugin::Convert::DBICother than completely replacing it.The mutation has to be named
createPersondue to how the resolver determines the method and the source name. The name should better be taken from$info->{return_type}->name.Do you think that such mutations are a good idea and should be included? Any other comments? Thank you!