Unhandled Rejection (Error): Variable type provided [About!] is incompatible with expected type [AboutRef!]

type Product  {
	id: ID! 
	name: String! @search(by:[hash]) 
	quantity: Int! 
	availability: Boolean! 
	price: Float! 
	image_src: String! 
	category: [Category] 
	brand: Brand 
	specification: [About!] 
	description_shot: String 
	description_long: String 
}

type Brand  {
	name: String! @id
	isSelected: Boolean 
}

type Category  {
	name: String! @id
	isSelected: Boolean 
}

type About  {
	id: ID! 
	title: String! 
	description: String! 
}

export const ADD_PRODUCT = gql`
    mutation AddProduct($name: String!, $quantity: Int!, $availability: Boolean!, $price: Float!, $specification: [About!],
                        $image_src: String!, $brand: Brand, $category: [Category], $description_shot: String,
                        $description_long: String) 
    {
        addProduct(input: {
            name: $name,
            quantity: $quantity,
            availability: $availability,
            price: $price,
            specification: $specification,
            image_src: $image_src,
            brand: $brand,
            category: $category,
            description_long: $description_long,
            description_shot: $description_shot}) {
            numUids
            product {
                name
            }
        }
    }

`;

You can change this:

$specification: [About!]

to this:

$specification: [AboutRef!]

And it should work if you are passing in an array of objects that each have an About ID.

1 Like