Open yenchieh opened 2 years ago
Hello, I couldn't figure out how to do mock data on nested type. For example: The query:
allPost(sort: { fields: [date] }) { nodes { title excerpt content slug categories { nodes { slug } } } }
The two mock I created:
{ resolve: `gatsby-source-mock`, options: { schema: { slug: (faker) => faker.lorem.slug(), 'categories:[Category!]!': [ { slug: (faker) => faker.lorem.slug(), } ], date: (faker) => faker.date.between('2020-01-01T00:00:00.000Z', '2030-01-01T00:00:00.000Z'), }, type: `LearnPost`, count: 5, } }, { resolve: `gatsby-source-mock`, options: { schema: { slug: (faker) => faker.lorem.slug(), }, type: `Category`, count: 2, } },
But it doesn't create the structure with categories.nodes.slug, it only generates categories.slug.
categories.nodes.slug
categories.slug
Thanks
This isn't supported right now, I think, but I'd have to investigate further.
Hello, I couldn't figure out how to do mock data on nested type. For example: The query:
The two mock I created:
But it doesn't create the structure with
categories.nodes.slug
, it only generatescategories.slug
.Thanks