hasura / hasura/graphql-engine

Action nullable response

Open
#9,534 1 comment 0 reactions 0 assignees View on GitHub
k/bug t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.22.0 (2.19.0)
CLI Version (for CLI related issue): 2.22.0

### Environment

Docker container

### What is the current behaviour?

I guess, the regression happened somewhere because it seems to be fixed already in
[4405](https://github.com/hasura/graphql-engine/issues/4405
)

So, when my REST backend returns an empty JSON ("{}") for a nullable custom type, Hasura rises an error, saying that the non-nullable field is not found in the response

Action definition:
type Query {
"""
Requests softphone settings for a particular user and his device
"""
getSettings: Settings
}

Custom type:
type Settings {
url: String!
password: String!
display_name: String!
}

### What is the expected behaviour?

When the backend server replies with an empty JSON, Hasura should reply to GraphQL with null and not to rise an error

### Any possible solutions/workarounds you're aware of?

Currently, I have to avoid using non-nullable fields in my custom type

### Keywords

- Action
- Nullable reponse

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.