yarn add @graphql-ez/plugin-scalars
pnpm add @graphql-ez/plugin-scalars
npm install @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.
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:
If you specify "*", every scalar is added to you GraphQL Schema.
ezScalars('*');
ezScalars(['DateTime', 'JSONObject']);
ezScalars({
// You can use `1` | `0`
DateTime: 1,
// or `true` | `false`
JSONObject: true,
});
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',
// ...
}),
}
);
@graphql-ez/plugin-scalars
MIT
0.7.6
Dec 18th, 2022