want to display categories (array list) on first render of app. and when user clicks particular category, want to call second graphql query to fetch products under that cateogry.
Basically trying to create fake graphql api to do so.
Current code
current schema:
type Picture {
id: ID
url: String @fake(type:imageUrl, options:{imageKeywords:["car", "bike","yatch","house"]})
}
type ProductItem {
id: ID
title: String @fake(type: productName)
description: String @fake(type:lorem, options:{loremSize:paragraphs})
picture: [Picture!]!
}
type Category {
id: ID
name: String
@examples(
values: [
"car"
"house"
"electronics"
]
)
total: Int
category_picture:String @fake(type:imageUrl, options:{imageKeywords:["car", "bike","yatch","house"]})
category_items: [ProductItem!] @listLength(min: 2, max: 2)
}
type Query {
allCategory: [Category!]
productByItemId(id: ID!): ProductItem
}
current query:
query{
allCategory{
id
name
category_picture
category_items {
id
}
},
productByItemId(id:"NzAyMjA3ODg0MA==") {
id
}
}
productByItemId(id:"NzAyMjA3ODg0MA==").... in this line that id is no where to be found.
I basically want to mock and use fake graphql api in my project...something like fetching category and also fetching products that matches id of particular category. Any solution is highly appreciated.... please also recommend any alternatives to graphql faker if there are any.
trying to create mock api using GraphQl faker.
Trying to achieve:
want to display categories (array list) on first render of app. and when user clicks particular category, want to call second graphql query to fetch products under that cateogry.
Basically trying to create fake graphql api to do so.
Current code
current schema:
current query:
output result:
Problem
productByItemId(id:"NzAyMjA3ODg0MA==").... in this line that id is no where to be found.
I basically want to mock and use fake graphql api in my project...something like fetching category and also fetching products that matches id of particular category. Any solution is highly appreciated.... please also recommend any alternatives to graphql faker if there are any.