Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONB returned as String returning field of a mutation iff it includes nested fields #3682

Closed
fvieira opened this issue Jan 11, 2020 · 2 comments
Labels
c/server Related to server

Comments

@fvieira
Copy link

fvieira commented Jan 11, 2020

When doing update, insert or delete mutations and requesting a JSONB field inside the returning field, it will either return as JSON or as a String depending on whether I request some nested field or not.

Example without nested field (area is the JSONB field):

mutation {
  update_zone(_set: {name: "Test"}, where: {id: {_eq: 21}}) {
    returning {
      area
    }
  }
}
{
  "data": {
    "update_zone": {
      "returning": [
        {
          "area": [
            [
              -8.019762,
              39.5492578
            ],
            [
              -8.0088615,
              39.5483313
            ],
            [
              -8.005085,
              39.5497873
            ]
          ]
        }
      ]
    }
  }
}

Example with nested field:

mutation {
  update_zone(_set: {name: "Test"}, where: {id: {_eq: 21}}) {
    returning {
      area
      ambassador {
        id
      }
    }
  }
}
{
  "data": {
    "update_zone": {
      "returning": [
        {
          "area": "[[-8.019762, 39.5492578], [-8.0088615, 39.5483313], [-8.005085, 39.5497873]]",
          "ambassador": {
            "id": 1
          }
        }
      ]
    }
  }
}

I'm on version 1.0.0 of Hasura, and while I found a PR (#3375) which seems to tackle this exact problem and that I think has been merged in this version already, I'm still seeing this behaviour...

@marionschleifer marionschleifer added the c/server Related to server label Jan 13, 2020
@rikinsk
Copy link
Member

rikinsk commented Jan 13, 2020

@fvieira PR (#3375) fixes this issue as you mentioned. This fix has been merged to master but has not made it to a release yet. This will be going out in v1.1.0 which should be released quite soon.

@rikinsk rikinsk closed this as completed Jan 13, 2020
@fvieira
Copy link
Author

fvieira commented Jan 13, 2020

You're right, I misread the git history, the PR was merged to master before the 1.0.0 release, but the release didn't include it, sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/server Related to server
Projects
None yet
Development

No branches or pull requests

3 participants