I just devised an example of Spring Boot with the usage of Graphql.
I tried to update the department by id but I got an error in id part.
Here is my error message which is shown below.
The field at path '/updateDepartment/hospital/id' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'ID' within parent type 'Hospital'
Here are my mutation and query variables snippets which is shown below.
mutation updateDepartment($departmentInput: DepartmentInput!) {
updateDepartment(id: 10,department: $departmentInput){
name
hospital{
id
}
}
}
{
"departmentInput": {
"name": "Department 10 Update",
"hospitalId": 3
}
}
Here is my project link : Project Link
How can I fix that error?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…