I have the following JSON output from my NodeJS Apollo server:
attributes:
[ { id: 8,
name: 'Size',
position: 0,
visible: true,
variation: true,
options: [Array] } ],
Now I want to create a graphql scheme for this. I can access all the items like id, position, visible.. but the options I can't access.
How can I write the graphql scheme for this? Current scheme is:
const ProductAttributes = `
type ProductAttributes {
id: Int!
name: String!
position: String!
visible: Boolean!
Variation: Boolean!
// todo Options: [array] ?
}
`;
I found out the options array looks like this but no key is assigned to it:
[ { id: 8,
name: 'Size',
position: 0,
visible: true,
variation: true,
options:
[ 'L32 W35',
'L32 W36',
'L32 W37',
'L32 W38',
'L28 W22',
'L28 W23',
'L28 W24',
'L28 W25',
'L32 W34' ] } ]
Do I have to assign a key to this with GraphQL ? or do I have to do this in my NodeJS ajax request?
e.g.: options: { name: 'L32 W35', name: 'l32 W36', etc...