Giter Club home page Giter Club logo

graphql-scalars's Introduction

scalar

npm version Discord Chat

A library of custom GraphQL scalar types for creating precise type-safe GraphQL schemas.

Getting Started

Please refer to our website for all the documentation related to GraphQL Scalars

Contributions

Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!

And if this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.

Code of Conduct

Help us keep GraphQL Scalars open and inclusive. Please read and follow our Code of Conduct as adopted from Contributor Covenant

License

Released under the MIT license.

Thanks

This library was originally published as @okgrow/graphql-scalars. It was created and maintained by the company ok-grow. We, The Guild, took over the maintenance of that library later on.

We also like to say thank you to @adriano-di-giovanni for being extremely generous and giving us the graphql-scalars name on npm which was previously owned by his own library.

And thanks to excitement-engineer for graphql-iso-date, stems for graphql-bigint, taion for graphql-type-json, langpavel for GraphQLTimestamp.js, vespertilian for Duration scalar, maxwellsmart84 for NonEmptyString scalar

graphql-scalars's People

Contributors

ardatan avatar blacksrc avatar capaj avatar carlocorradini avatar ccuilla avatar charlypoly avatar dependabot[bot] avatar dimamachina avatar dotansimha avatar enisdenjo avatar gilgardosh avatar github-actions[bot] avatar kamilkisiela avatar luvies avatar mammadataei avatar mosheboker1 avatar peterleiva avatar pukuba avatar renovate-bot avatar renovate[bot] avatar richardlitt avatar rufman avatar ryanhs avatar saihaj avatar takashimamorino avatar tuvalsimha avatar tvvignesh avatar urigo avatar xavxyz avatar yann1ckv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-scalars's Issues

NonNegativeX -> UnsignedX

Why call it NonNegative? Isn't "unsigned" the correct naming for these kinds of values, or am I missing something?

Convert Emails to lowercase in the EmailAddress custom type

Since emails are not case sensitive, I was wondering if it will be good to convert emails to lowercase in the EmailAddress parseValue and parseLiteral functions. This will be handy for saving the email addresses in databases without having to do any extra parsing. I can make a PR for this if you think this is a useful feature to add

tslint error

Latest version...

node_modules/graphql-scalars/dist/esnext/resolvers/index.d.ts:27:70 - error TS7016: Could not find a declaration file for module 'graphql-type-json'. '/node_modules/graphql-type-json/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/graphql-type-json` if it exists or add a new declaration (.d.ts) file containing `declare module 'graphql-type-json';`

27 import { GraphQLJSON as JSON, GraphQLJSONObject as JSONObject } from 'graphql-type-json';

Use with apollo-server-express and CommonJS

Not really an issue but simply to show what I had to do to make it work with apollo-server-express and CommonJS imports. (Only Apollo Server and ES6 imports in README so far)

In my typeDefs and resolvers:

const { DateTimeResolver, DateTimeTypeDefinition } = require('graphql-scalars')

const typeDefs = [
  DateTimeTypeDefinition,
]

const resolvers = [
  { DateTime: DateTimeResolver }, // <-- Notable difference here
]

Just if someone gets here with the same context... ๐Ÿ‘

What's your workflow for checking urls exist?

Do you have something external set up to make sure the urls actually exist? It's great to validate the shape but being able to tell they don't 404 would be better.

I imagine it's not that difficult to set up something to do this based on a schema. Just curious if you have solved this already somehow.

Integers are not validated when used as input types

If I use any of the Integer scalar types as a part of an input type (ie. PositiveInteger), I'm able to pass in floating-point values (such as 5.5) without encountering an error.

I believe these two lines may need to be flipped, as parseInt is rather permissive with the inputs that it will accept:
https://github.com/Urigo/graphql-scalars/blob/master/src/resolvers/utilities.ts#L97-L98

For that matter, I don't fully understand why we're using parseInt at all here, as it appears that I can also provide numbers wrapped in strings (ie. "5"), as the type-checking that normally happens in parseLiteral doesn't appear to happen for input objects.

GraphQL's built-in Int type throws errors in any of these scenarios, as it performs type-checking and validation in the parseValue function.

Email Regex Doesn't Support RFC 6531

The current Regex for Emails doesn't work any email that has a local part above the 7 bit ASCII table, such as accented characters and Unicode. RCF 6531 provides a standard for handling these email addresses.

Can't load the package.

I can't load the package. I receive the following error using v1.0.3.

const scalars = require('graphql-scalars');

ReferenceError: BigInt is not defined

Works as advertised for v1.0.2

URL scalar is not working in 0.4.7

steps to reproduce:
use URL scalar in Schema, such as:

type Project {
    link: URL
}

Define scalar:

scalar URL

Define resolvers:

import { URL, EmailAddress, DateTime } from 'graphql-scalars';

export default {
  EmailAddress,
  URL,
  DateTime,
  // etc.
}

Only when making graphql query that includes the field with type URL, I get the error response inside the graphql tracing:

"ReferenceError: URL is not defined"
"at GraphQLScalarType.serialize (<PROJECT>/node_modules/graphql-scalars/dist/commonjs/URL.js:13:9)"
  • All is fine when queries do not include fields of type URL
  • All other scalars from this package work just fine (EmailAddress, DateTime, etc.)

big int typing error

Hello!

I'm getting an error when including this module in my TypeScript project on build. The error is:

node_modules/graphql-scalars/dist/esnext/BigInt.d.ts:1:25 - error TS7016: Could not find a declaration file for module 'graphql-bigint'. '/home/jordan/source/phoenix-api/node_modules/graphql-bigint/index.js' implicitly has an 'any' type.
  Try `npm install @types/graphql-bigint` if it exists or add a new declaration (.d.ts) file containing `declare module 'graphql-bigint';`

1 import * as BigInt from 'graphql-bigint';
                          ~~~~~~~~~~~~~~~~


Found 1 error.

I'm using the newest version (0.4.6).

Cheers

Maintainer wanted

We're not able to maintain this any more. If you would like to maintain it please let me know. But I don't want to just transfer it to someone random, to avoid another event-stream incident (not that this package is anywhere near as widely used).

If you have been contributing to this package or have other good contributions to show I'll be happy to recommend your fork.

Using DateTime scalar with a date-time string at UTC.

Hi there! First at all, thanks for this contribution! It's really helful.

I have used this library over Apollo Server and Mongoose as a ORM. At some point, Mongoose converts the date fields to String and the DateTime doesn't catch this. I spent some hours dealing with this issue.

After investigating different approaches to make this, I figure out that DateTime scalar doesn't accept a date-time string at UTC.

Can someone help me to solve this? I found a possible solution here but I have used others scalars of this package.

Thanks in advance!

TSLint error with JSONObject

Sorry to meet this issue, when I use JSONObject schema. Other scalars are okay.

 TS2322: Type '{ JSONObject: typeof GraphQLScalarType; DateTime: GraphQLScalarType; URL: GraphQLScalarType; Query: { ...}' is not assignable to type 'IResolvers<any, any> | IResolvers<any, any>[] | undefined'.
  Type '{ JSONObject: typeof GraphQLScalarType; DateTime: GraphQLScalarType; URL: GraphQLScalarType; Query: { ...}' is not assignable to type 'IResolvers<any, any>[]'.
    Property 'length' is missing in type '{ JSONObject: typeof GraphQLScalarType; DateTime: GraphQLScalarType; URL: GraphQLScalarType; Query: { ...'.

schema

import { DateTimeTypeDefinition, JSONObjectDefinition, URLTypeDefinition } from 'graphql-scalars';
export const SCHEMA = gql`
    ${SCALAR_DEFINITION}
    ${DateTimeTypeDefinition}
    ${URLTypeDefinition}
    ${JSONObjectDefinition}
   ...

Resolvers

import { DateTimeResolver, JSONObjectResolver, URLResolver } from 'graphql-scalars';

export const resolvers = {
    JSONObject: JSONObjectResolver,
};

Could not find a declaration file for module '@okgrow/graphql-scalars'.

Following steps in README gets me to a point where I get the following error

[ts]
Could not find a declaration file for module '@okgrow/graphql-scalars'.  '/Users/<user>/<appPath>/node_modules/@okgrow/graphql-scalars/index.js' implicitly has an 'any' type.
  Try `npm install @types/okgrow__graphql-scalars` if it exists or add a new declaration (.d.ts) file containing `declare module '@okgrow/graphql-scalars';` [7016]

I tried npm install @types/okgrow__graphql-scalars but get error Not Found- probably an oversight on my part but can't pin it down.

Any ideas?

Duplicate schema type name NonNegativeFloat in Resolver

Hi, I am using v1.0.0 and caught this error using a simple apollo server.

Libs

"graphql": "^14.4.2",
"graphql-scalars": "^1.0.0",
"merge-graphql-schemas": "^1.7.0",
"typescript": "^3.5.3"

Server

import { typeDefs as scalarTypeDefs } from 'graphql-scalars';
import { mergeTypes } from 'merge-graphql-schemas';

import { resolvers as scalarResolvers } from 'graphql-scalars';
import { mergeResolvers } from 'merge-graphql-schemas';

const typeDefs = mergeTypes([...scalarTypeDefs]);
const resolvers = mergeResolvers([scalarResolvers]);

const server = new ApolloServer({
  schema: makeExecutableSchema({
    typeDefs,
    resolvers,
    directiveResolvers
  }),
  context
});

Error

Error: Duplicate schema type name NonNegativeFloat

After investigating it, I found that there are 2 resolver definitions that share the same name NonNegativeFloat.

NonNegativeFloat: GraphQLScalarType {
    name: 'NonNegativeFloat',
    description: 'Floats that will have a value of 0 or more.',
    serialize: [Function: serialize],
    parseValue: [Function: parseValue],
    parseLiteral: [Function: parseLiteral],
    astNode: undefined,
    extensionASTNodes: undefined
  },
 UnsignedFloat: GraphQLScalarType {
    name: 'NonNegativeFloat',
    description: 'Floats that will have a value of 0 or more.',
    serialize: [Function: serialize],
    parseValue: [Function: parseValue],
    parseLiteral: [Function: parseLiteral],
    astNode: undefined,
    extensionASTNodes: undefined
  },

EDIT: Also happens with UnsignedInt, NonNegativeInt, BitInt, and Long.

Do I miss something else in my configuration?

Big Int Support

Do you support bigInt numbers? Are you planning for this feature?

Can't Build after update to v0.4.4

After updating to v0.4.4 my angular project fails to build successfully. I am running node version 11.9.0, angular cli version 7.3.1, and typescript 3.2.4. My project builds fine if I rollback to v0.4.3.

The following errors are displayed:

ERROR in node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(4,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(4,17): error TS2451: Cannot redeclare block-scoped variable 'EmailAddress'.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(5,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(6,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(7,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(8,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(9,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(10,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(11,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(12,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(13,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(14,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(14,17): error TS2451: Cannot redeclare block-scoped variable 'EmailAddress'.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(15,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(16,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(17,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] node_modules/@okgrow/graphql-scalars/graphql-scalars.d.ts(19,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.

[1] src/app/shared/interfaces/employee.interface.ts(16,20): error TS2304: Cannot find name 'EmailAddress'.

[1] src/app/shared/interfaces/employee.interface.ts(17,24): error TS2304: Cannot find name 'PhoneNumber'.

[1] src/app/shared/interfaces/employee.interface.ts(18,24): error TS2304: Cannot find name 'PhoneNumber'.

[Bug] error TS7016: Could not find a declaration file for module 'graphql-type-json'

> tsc --project tsconfig.json
node_modules/graphql-scalars/dist/esnext/resolvers/index.d.ts:27:70 - error TS7016: Could not find a declaration file for module 'graphql-type-json'. '/Users/galkin/Projects/gamaya/web-server/node_modules/graphql-type-json/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/graphql-type-json` if it exists or add a new declaration (.d.ts) file containing `declare module 'graphql-type-json';`
27 import { GraphQLJSON as JSON, GraphQLJSONObject as JSONObject } from 'graphql-type-json';

At application level, it can be fixed by npm install -D @types/graphql-type-json
This package has defenition for that https://github.com/Urigo/graphql-scalars/blob/master/types/graphql-type-json.d.ts

Could you fix?

Scalar URL type doesn't support a lot of valid urls

What is the problem?

https://github.com/okgrow/graphql-scalars/blob/37ab0b82ae3810bf85a4a2dd60beb7883728d05b/src/URL.js#L6

I'd like to have image urls saved on S3 of which url should be like https://s3.ap-northeast-1.amazonaws.com/hoge.fuga/foo.jpg.
but got error like this

TypeError: Value is not a valid URL: https://s3.ap-northeast-1.amazonaws.com/hoge.fuga/foo.jpg`

reproduction

How can it be solved?

  • use this library.

  • choose one of them if you like regexp.

[Question] about naming

Why we use:

import { EmailAddressResolver } from 'graphql-scalars';

instead

import { EmailAddress } from 'graphql-scalars';

Can we have both?

How to custom error message of RegularExpression

I want to change error message of my scalar created by RegularExpression. I want to hide the regex in my production. Can you provide the way to change it easily.

In example

const options = {
  errMessage: (regex, value) => {
    if (process.env.NODE_ENV === 'production')
      return `Value is invalid format: ${value} `
    else
      return `Value does not match the regular expression ${regex}: ${value}`
  }
}
const MyRegexType = new RegularExpression('MyRegexType', /^ABC$/, options);

[Bug] TS2304: Cannot find name 'URL'

> tsc --project tsconfig.json

node_modules/graphql-scalars/dist/esnext/mocks.d.ts:14:30 - error TS2304: Cannot find name 'URL'.

14 declare const URLMock: () => URL;

At application level, it can be fixed by

  1. adding dom to compilerOptions.lib array
  2. copy pasting URL from typescript/lib/lib.dom.d.ts

Could you fix this bug on package level?

PhoneNumber doesn't support many valid E164 numbers

For example:

  • Singapore phone numbers are formatted as +6569701665 (that's 10 numeric characters).
  • Solomon Islands, the number +67734700 is 8 numeric characters long.
  • In Niue, +6834999, at 7 numeric characters

The regex used in this library, /^\+\d{11,15}$/, doesn't satisfy these numbers. The quickest solution would be to change to regex to /^\+\d{7,15}$/ or more simply /^\+\d{1,15}$/.

Ideally, numbers can be passed through libphonenumber (either google's or catamphetamine's which is smaller) to check if they're possible. While that would require including a relatively large library (130kB+), this package is only expected to run on the server (I believe) so that could be allowable?

If the preferred solution is quickly fixing the regex, I can submit a PR, with updated tests.

Example for Apollo Federation

Hi, Im new to Apollo, and in my Accounts Service I use Apollo Federation, the thing is typeDefs in buildFederatedSchema expects a DocumentNode and makeExecutableSchema expects a GraphQLSchema, so thats invalidate the provided example. So, anyone can provide an example for this?

Duplicate type names for aliased types

Perhaps this issue is related to me using graphql-modules, but I'm getting errors for each of the aliased types (UnsignedInt, UnsignedFloat, Long) when importing all the types into my GraphQLModule:

There can be only one type named "BigInt".
There can be only one type named "NonNegativeFloat".
There can be only one type named "NonNegativeInt".

They're exported as aliases here:

NonNegativeInt as UnsignedInt,

But they still have an explicitly set name property here:

name: 'NonNegativeInt',

Obviously, I can work around this by only importing the types I need, but I prefer to import everything at once.

Any idea why this is not working like in the README? If it's only broken when using graphql-modules, why does it work in "plain Apollo mode"? Is the name property not used in that case?

GraphQL 14 is released

GraphQL 14 has been released but it's still asking for "graphql": "^0.13.1" in the peer dependencies

Modularize scalars

A possible future improvement would be to enable cherry picking specific scalars to import. This could be similar tolodash which publishes both the complete package and per method packages.

Having this library is great for standardization across the community, but some scalars are more niche and something I would prefer to be able to exclude if possible.

import merge from 'lodash.merge';

import URLResolver from 'graphql-scalars.url';

Non-fully qualified URLs

The current regex for URLs excludes examples without fully qualified hostnames - such as http://server/dir.

The regex author agreed in the gist, and in the comments that they are valid, but that the code met the requirements (for a URL shortener).

Are we open to fixing this?

Timestamp

I'm working with Firestore which has a Timestamp class. I ended up using that instead of putting Date.toISOString() everywhere.

Not sure if you want to add dependencies on outside projects so I'm doing this as an issue first vs. a PR ... here is my code...

import {Kind} from 'graphql/language';
import {GraphQLScalarType} from 'graphql';
import * as admin from "firebase-admin";
import Timestamp = admin.firestore.Timestamp;

export const TimestampScalar = new GraphQLScalarType({
	name: 'Timestamp',
	serialize(date: Timestamp) {
		return date.toDate().toJSON();
	},
	parseValue(value) {
		const date = new Date(value);
		// eslint-disable-next-line no-restricted-globals
		if (Number.isNaN(date.getTime())) {
			throw new TypeError(`Value is not a valid Date: ${JSON.stringify(value)}`);
		}
		return Timestamp.fromDate(date);
	},
	parseLiteral(ast) {
		if (ast.kind === Kind.INT) {
			return Timestmap.fromDate(new Date(parseInt(ast.value, 10)));
		} else if (ast.kind === Kind.STRING) {
			if (this.parseValue)
				return this.parseValue(ast.value);
		}
		return null;
	},
});

Bug: URL Scalar doesn't support localhost, 0.0.0.0, etc

As the title says, the URL scalar will return null for URLs that contain localhost, 127.0.0.1:8000 or whatever variant thereof. While this likely wouldn't be a problem for production environments, it breaks local development when referencing locally served assets. The only solution I've found is to revert back to using String.

Update Documentation for Spread Syntax Option

Hey there! Ran into this issue following the given documentation and the option to use the default export of the library in my resolver map using the spread operator. The problem is that if you do that, your GraphQL server will complain at you for having three missing scalar types: UnsignedInt, UnsignedFloat and RegularExpression. These need to be added to the list of scalars that need to be added to the schema because the documentation isn't clear on this. Here's an updated list you can just copy over into the docs:

scalar DateTime

scalar NonPositiveInt

scalar PositiveInt

scalar NonNegativeInt

scalar UnsignedInt

scalar NegativeInt

scalar NonPositiveFloat

scalar PositiveFloat

scalar NonNegativeFloat

scalar UnsignedFloat

scalar NegativeFloat

scalar EmailAddress

scalar URL

scalar PhoneNumber

scalar PostalCode

scalar RegularExpression

Additionally, I'd like to suggest a process for making this simpler: in my own project I have all of my definitions in separate .gql files, which I then export from a index.js file, which looks something like this:

export { default as DateTime } from "./dateTime.gql"
// ... other exports ...

I then import this single index in my schema.js file where I use it like so:

import { makeExecutableSchema } from "graphql-tools"
import OKGGraphQLScalars from '@okgrow/graphql-scalars'
import * as types from "./types"
import * as enums from "./types/enums"
import * as inputs from "./types/inputs"
import * as interfaces from "./types/interfaces"
import * as scalars from "./types/scalars"
import * as unions from "./types/unions"
import * as resolvers from "./resolvers"

export const schema = makeExecutableSchema({
  typeDefs: [
    ...Object.values(types),
    ...Object.values(enums),
    ...Object.values(inputs),
    ...Object.values(interfaces),
    ...Object.values(scalars),
    ...Object.values(unions)
  ],
  resolvers: { ...OKGGraphQLScalars, ...resolvers }
})

This helps to keep my schema modular and easy to manage. While this may be overkill to make individual files for each scalar definition, you could still do something similar where you export a single OKGScalarDefinitions file as a named export that people can use in a similar fashion as I have above. That way they can quickly add all of the custom scalars to their schema in one place in only three lines of code, and updates to this package such as adding new scalars/resolvers will stay in sync, whereas right now any additions will break servers where the spread technique is used.

PostalCode

Hi, quick question,
How do you verify they postal code? Does it take into account non-American postal codes?

Same question for phonenumber

non mandatory URL throw an error when it not set

i have a graphql with the following schema:

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
  }

the response:

{
  "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
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.