Skip to content
This repository was 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

Description

@lukasGemela

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions