So i\'m trying to figure out how to pass an array of objects from a POST request to apollo server on AWS lambda.
I\'ve checked this out but it\'s not the same proble
You can only use input types for input (GraphQLInputObjectType) and object types for output (GraphQLObjectType). You are using Specials
as both: As output type for the field specials
in ShoppingItem
and as input type in mutation argument specials
. To do this you need two types. The reason for this is that output types (can) have resolvers (this is actually abstracted away from apollo server in your case). You will have to create two different types:
type ShoppingItem {
description: String
specials: [Specials]
}
type Specials {
description: String
price: String
qty: String
saved: String
}
input SpecialsDraft {
description: String
price: String
qty: String
saved: String
}
type Mutation {
saveNewItem(description: String!, specials: [SpecialsDraft]) : ShoppingItem
}