Integration with [GraphQL Scalars](https://www.graphql-scalars.dev/)
npm install @graphql-ez/plugin-scalarsIntegration 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
``ts
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.
`ts`
ezScalars('*');
`ts`
ezScalars(['DateTime', 'JSONObject']);
`ts1
ezScalars({
// You can use | 0true
DateTime: 1,
// or | false`
JSONObject: true,
});
You can specify custom scalars or override the existing scalars resolvers with the second options parameter:
`ts
import { GraphQLScalarType } from 'graphql';
ezScalars(
{
DateTime: 1,
},
// Custom Scalars / Override
{
DateTime: new GraphQLScalarType({
name: 'DateTime',
// ...
}),
// New Custom Scalar
IntID: new GraphQLScalarType({
name: 'IntID',
// ...
}),
}
);
``