2

I am a graphql noob and the first query I have to write turned to be a complex one. Imagine this is the object I'm looking for

{
  name : "ferrari"
  year : "1995"
}

Now, there is a nested object in which this could be present, The object could look like this

{
  "name": "car",
  "year": "1990",
  "morecars": [
    {
      "name": "ferrari",
      "year": "1995"
    },
    {
      "name": "bmw",
      "year": "200"
    }
  ]
}

or this

{
  "name": "car",
  "year": "1990",
  "morecars": [
    {
      "name": "red",
      "year": "1990",
      "morecares": [
        {
          "name": "ferrari",
          "year": "1995"
        }
      ]
    },
    {
      "name": "bmw",
      "year": "200"
    }
  ]
}

How do fetch the ferrari i need

Kiran
  • 97
  • 5
  • graphql is not for finding it for you (filtering is an API role) - it can return any of this structures - type can be used recurently - normalizing cache (apollo client) can store each item separately – xadm Jun 30 '20 at 16:47

0 Answers0