We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to run mutations like the following, passing an array of objects in my input parameters:
mutation { people_insert(input: { people: [{ name: "Bob", age: 25 }]}) { success, message } }
I have defined my schema inputs and return objects like so:
final personInsertInput = inputObjectType("person_input", inputFields: [ inputField("name", graphQLString.nonNullable()), inputField("age", graphQLInt.nonNullable()) ]); final peopleInsertInput = inputObjectType("people_insert_input", inputFields: [ inputField("people", listOf(personInsertInput.nonNullable()).nonNullable()) ]); final peopleInsertResult = objectType("people_insert_result", fields: [ field("success", graphQLBoolean.nonNullable()), field("message", graphQLString.nonNullable()) ]);
And a mutation object for inserting like this:
var mutationType = objectType("Mutation", fields:[ field( "people_insert", peopleInsertResult, inputs: [ GraphQLFieldInput("input", peopleInsertInput) ], resolve: (obj, args) async { // insert records from args return { 'success': true, 'message': 'record(s) inserted.' }; } )]);
When I run the above mutation I get the following response:
{ "errors": [ { "message": "Type coercion error for value of argument \"input\" of field \"people_insert\". [{people: [{name: Bob, age: 25}]}]", "locations": [ { "line": 1, "column": 25 } ] }, { "message": "type 'List<dynamic>' is not a subtype of type 'List<Map<String, dynamic>>' of 'input'", "locations": [ { "line": 1, "column": 25 } ] } ] }
Have I missed something in my schema definitions or is this not possible yet?
The text was updated successfully, but these errors were encountered:
Ideally I'd like to run mutations like this:
mutation($input: people_insert_input!) { people_insert(input: $input) { success, message } }
Passing variables like so:
{ "input": { "people" : [{ "name": "Tom", "age": 25 }] } }
But this also results in an error:
{ "errors": [ { "message": "type 'List<dynamic>' is not a subtype of type 'List<Map<String, dynamic>>' of 'input'" } ] }
Sorry, something went wrong.
I've found that if I change my peopleInsertInput to:
final peopleInsertInput = inputObjectType("people_insert_input", inputFields: [ inputField("people", listOf(personInsertInput.nonNullable())) ]);
Mutations like this work now:
But if I try to run mutations like this (passing in the $input type):
I get a stack overflow exception on the GraphQL.makeLazy() method. Looks to be in an infinite loop in the recursive function.
Will take a look at this issue
dukefirehawk
No branches or pull requests
I am trying to run mutations like the following, passing an array of objects in my input parameters:
I have defined my schema inputs and return objects like so:
And a mutation object for inserting like this:
When I run the above mutation I get the following response:
Have I missed something in my schema definitions or is this not possible yet?
The text was updated successfully, but these errors were encountered: