@
@
@Richswitch2019-05-29 22:47:04
JavaScript
@Richswitch, 2019-05-29 22:47:04

GraphQl schema for object in object?

Hey!
There is such data in .json

{
  "goods": [
    {
      "name": "LeBron XVI Hot Lava White",
      "price": 100,
      "sizes": {
        "39": true,
        "40": false,
        "41": true,
        "42": true,
        "43": true
      }
    }
  ]
}

These are the resolvers
const DATA = require("./fakeData/data");

const mapGood = (good, id) => good && { id, ...good };

const resolvers = {
  goods: () => DATA.goods.map(mapGood),
  good: ({ id }) => mapGood(DATA.goods[id], id),
};

I make a query like this in GraphQl and I get the error How do I output the sizes
5ceee16dc6f42044249193.png
object in this case?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question