type Product {
id: ID!
name: String!
tagline: String!
description: String!
image: URL!
type: ProductType!
googlePlayLink: URL!
appStoreLink: URL!
websiteLink: URL!
bannerType: BannerType!
bannerContent: String!
excerpt: String!
termsCondition: String!
slug: String!
websiteLinkLabel: String!
}
input ProductCreateInput {
name: String!
tagline: String!
description: String!
image: URL!
type: ProductType!
googlePlayLink: URL
appStoreLink: URL
websiteLink: URL
bannerType: BannerType!
bannerContent: URL!
excerpt: String!
termsCondition: String!
slug: String!
websiteLinkLabel: String!
}
type Mutation {
createProduct(product: ProductCreateInput!): Product!
}
but when i send query without set the non mandatory URL, its give me an error.
createProduct(product:{
name:"maucash",
tagline:"pinjaman online",
description:"pinjaman online",
image:"http://coba.com/img.jpg",
type:WEBSITE,
websiteLink:"http://google.gom",
websiteLinkLabel:"dapatkan sekarang",
bannerType:IMAGE,
bannerContent:"http://coba.com/banner.jpg",
excerpt:"pinjaman online",
termsCondition:"ini pinjaman online",
slug:"maucash1"
}){
id
name
tagline
description
image
type
googlePlayLink
appStoreLink
websiteLink
bannerType
bannerContent
excerpt
termsCondition
slug
websiteLinkLabel
}
{
"errors": [
{
"locations": [
{
"line": 298,
"column": 5
}
],
"path": [
"createProduct",
"googlePlayLink"
],
"message": "Invalid URL: ",
"code": "E_UNKNOWN_ERROR",
"httpStatusCode": 500,
"stack": [
"TypeError [ERR_INVALID_URL]: Invalid URL: ",
" at onParseError (internal/url.js:219:17)",
" at parse (internal/url.js:228:3)",
" at new URL (internal/url.js:311:5)",
" at coerceURL (/home/novianto/Documents/finser/node/node_modules/graphql-scalars/index.cjs.js:399:12)",
" at GraphQLScalarType.serialize (/home/novianto/Documents/finser/node/node_modules/graphql-scalars/index.cjs.js:405:16)",
" at completeLeafValue (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:635:37)",
" at completeValue (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:579:12)",
" at completeValue (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:557:21)",
" at completeValueCatchingError (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:495:19)",
" at resolveField (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:435:10)",
" at executeFields (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:275:18)",
" at collectAndExecuteSubfields (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:713:10)",
" at completeObjectValue (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:703:10)",
" at completeValue (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:591:12)",
" at completeValue (/home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:557:21)",
" at /home/novianto/Documents/finser/node/node_modules/graphql/execution/execute.js:492:16",
" at <anonymous>"
]
}
],
"data": null
}