You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicclassUser(stringname){publicstringName{get;set;}=name;publicstring?Surname{get;set;}publicGenderEnum?Gender{get;set;}}publicenumGenderEnum{Male,Female}publicclassUserMutation{publicstringAddUser(Useruser){return$"{user.Name}{user.Surname} ({user.Gender}) was added!";}}
{
"errors": [
{
"message": "The field `foo` does not exist on the type `UserInput`.",
"path": [
"user"
],
"extensions": {
"type": "UserInput"
}
}
]
}
What is actually happening?
{
"data": {
"addUser": "Oliver Smith (Male) was added!"
}
}
Relevant log output
Additional context
In normal cases, if a variable contains an invalid field, the request returns an error stating that the field does not exist. However, if one of the variables is an enum value, then the invalid field is silently ignored instead of triggering an error.
The issue appears to be in the VariableCoercionHelper class, specifically in the Rewrite method. When it attempts to determine the field type and does not find it, the method removes the invalid field. As a result, the validation step does not detect the issue.
The text was updated successfully, but these errors were encountered:
Product
Hot Chocolate
Version
15.0.3
Link to minimal reproduction
https://github.com/faddiv/graphql-platform/tree/fix-ignored-field-when-enum-is-present
Steps to reproduce
Example model:
Inputs
Execute the following GraphQL mutation:
With the following variables:
What is expected?
What is actually happening?
Relevant log output
Additional context
In normal cases, if a variable contains an invalid field, the request returns an error stating that the field does not exist. However, if one of the variables is an enum value, then the invalid field is silently ignored instead of triggering an error.
The issue appears to be in the
VariableCoercionHelper
class, specifically in theRewrite
method. When it attempts to determine the field type and does not find it, the method removes the invalid field. As a result, the validation step does not detect the issue.The text was updated successfully, but these errors were encountered: