and if the request does not pass the validation in GQL mutation controller, we throw user-exception:
public class GraphQLException extends RuntimeException implements GraphQLError {
....
}
what we noticed is, if we make Partner type not-nullable in schema and we throw this user exception, response looks different than if this field is nullable:
For nullable:
"data": { "deletePartner": null }
For non-nullable:
"data": null
This started to break our front-end at some point, as code always expected consistent response. We are not sure what exactly is expected here, but I'd say when there is error of any kind thrown from underlying code, data object should be set to null?
Expected behavior
I would expect in case of errors, I always get consistent response
"data": null
Desktop (please complete the following information):
Describe the bug We are not really sure whether this is a bug, but we raise this anyway. We have an mutation endpoint:
deletePartner(partnerId: ID!, year: Int!): Partner
and if the request does not pass the validation in GQL mutation controller, we throw user-exception:
what we noticed is, if we make Partner type not-nullable in schema and we throw this user exception, response looks different than if this field is nullable:
For nullable:
"data": { "deletePartner": null }
For non-nullable:
"data": null
This started to break our front-end at some point, as code always expected consistent response. We are not sure what exactly is expected here, but I'd say when there is error of any kind thrown from underlying code, data object should be set to null?
Expected behavior I would expect in case of errors, I always get consistent response
"data": null
Desktop (please complete the following information):