Closed ShivamMattoo33 closed 2 years ago
I'm assuming that the JobStatusID
is an enum. In that case, you can just pass the string value that you want, e.g. "Pending". The same goes for scalars, but they can take any primitive data type and it's up to the server to pass them correctly.
So in the end you're always limited to json data types, arrays, objects, primitives, which are lists, maps, and appropriate primitives in dart.
I hope this makes sense.
Passing a string “pending” doesn’t work it needs Pending without string
Try and write the string "Pending"
and see if it works.
It does not work. Also FYI we are working on a 3rd party API and just consuming it. Attaching the exception
{
"errors": [
{
"message": "Argument 'status' on InputObject 'UpdateJobStatusJobInput' has an invalid value (\"Pending\"). Expected type 'JobStatus!'.",
"locations": [
{
"line": 5,
"column": 10
}
],
"path": [
"mutation UpdateJobStatus",
"updateJobStatus",
"input",
"job",
"status"
],
"extensions": {
"code": "argumentLiteralsIncompatible",
"typeName": "InputObject",
"argumentName": "status"
}
}
]
}
Here is the request I typed
mutation UpdateJobStatus {
updateJobStatus(input: {
job: {
id: "5du2ZM84qIJmwR9rG7CFgH",
status: "Pending" }}) {
job {
id
status
coverage {
result
}
}
}
Okay, but the example you're posting here is not what you asked about.
In
mutation UpdateJobStatus {
updateJobStatus(input: {
job: {
id: "5du2ZM84qIJmwR9rG7CFgH",
status: "Pending" }}) {
job {
id
status
coverage {
result
}
}
}
You don't have any variables, so it should be
mutation UpdateJobStatus {
updateJobStatus(input: {
job: {
id: "5du2ZM84qIJmwR9rG7CFgH",
status: Pending }}) {
job {
id
status
coverage {
result
}
}
}
in your original question, you had the query:
String updateJobStatusPending = r'''
mutation UpdateJobStatus($jobId: ID!, $status: JobStatusId! ) {
updateJobStatus(input: {
job: {
id: $jobId,
status:$status
}}) {
job {
id
status
coverage {
result
}
}
}
}
then the variables should be
final MutationOptions options = MutationOptions(
document: gql(updateJobStatusPending),
variables: <String, String>{
'jobId': jobId,
'status': "Pending"
},
Thank you for helping me out I really appreciate it. This is the first thing i tried as it made sense and it didnt work then but its working now hehe
Hello I am new to GraphQl and flutter and I have a question and I put this under enhancement because I dont see any documentation for it or any examples on how to do this so not sure if it exists
I have this query
The status here is not a primitive data type but of type JobStatusID which can take different values
Now In flutter/dart I have this
My Question is : How do i pass this in variable here