Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

different data response for nullable and non-nullable responses #930

Open
lukasGemela opened this issue Mar 21, 2023 · 0 comments
Open

different data response for nullable and non-nullable responses #930

lukasGemela opened this issue Mar 21, 2023 · 0 comments
Labels

Comments

@lukasGemela
Copy link

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:

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):

  • graphql-spring-boot-starter Version 14.0.0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant