It often happens that the input argument has an extra field, resulting in an error:
"The specified input object field myField does not exist."
How can I ignore extra fields?
My query:
mutation {
create(author: {id:0, name:"example", myField:0}){
id
}
}
result:
{
"errors": [
{
"message": "The specified input object field `myField` does not exist.",
"locations": [
{
"line": 2,
"column": 41
}
],
"path": [
"create"
],
"extensions": {
"field": "myField",
"specifiedBy": "http://spec.graphql.org/October2021/#sec-Input-Object-Field-Names"
}
}
]
}
For example, when receiving data in Appollo, the client adds an additional service field, and after sending this object for saving, we immediately get an error. Well, we can tell Appollo not to add this service field, although it needs it for caching, but several times from the developer's frontend a service value is added to the object, as a result of which nothing works again. It turns out that you need to do data mapping, and write a bunch of additional code, and so every time.
For example, in js I got the author then author.myField = true; and that's all I can't save it anymore. I understand that it's not very good to pass an extra field, but it turns out that you need to upgrade the frontend service every time that interacts with graphql, as soon as the service field is added. As a result, you just have to figure out why everything broke down.