Docs

GraphQL EZ

Get Started

Plugin Hub > GraphQL Scalars

npm version
yarn add @graphql-ez/plugin-scalars

@graphql-ez/plugin-scalars#

Integration with GraphQL Scalars

Currently this plugin requires the presence of Schema Plugin or GraphQL Modules Plugin in the same EZ App.

Usage#

Check the GraphQL Scalars website docs to see all available scalars, of you can inspect the types of the plugin

import { ezScalars } from '@graphql-ez/plugin-scalars'; const ezApp = CreateApp({ ez: { plugins: [ // ... ezScalars({ // ... }), ], }, // ... });

This plugin accepts different syntaxes:

Wildcard#

If you specify "*", every scalar is added to you GraphQL Schema.

ezScalars('*');

Array#

ezScalars(['DateTime', 'JSONObject']);

Object#

ezScalars({ // You can use `1` | `0` DateTime: 1, // or `true` | `false` JSONObject: true, });

Custom Scalars / Override Resolvers#

You can specify custom scalars or override the existing scalars resolvers with the second options parameter:

import { GraphQLScalarType } from 'graphql'; ezScalars( { DateTime: 1, }, // Custom Scalars / Override { DateTime: new GraphQLScalarType({ name: 'DateTime', // ... }), // New Custom Scalar IntID: new GraphQLScalarType({ name: 'IntID', // ... }), } );

Plugin Details

Identifier
@graphql-ez/plugin-scalars
License
MIT
Version
0.7.6
Updated
Dec 18th, 2022