graphql-type v1.1.1 is a GraphQL type creation helper that provides functions to quickly define GraphQL scalar types with built-in validation for strings, integers, and floats. It supports bi-directional validation (input and output) as well as uni-directional (input-only or output-only). Key features include min/max length, regex, custom test functions, and custom error messages for strings; min/max and test for integers; plus maxDecimals for floats. Compared to manually creating custom scalars with GraphQL's GraphQLScalarType, graphql-type offers a simpler API and consistent validation patterns. Released under MIT license, the package is stable but has not seen updates since 2018, suggesting low maintenance cadence.
npm install graphql-typeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a custom GraphQL scalar type for email validation using createStringType.
Consider using GraphQL's built-in custom scalars or a more maintained library like graphql-constraint-directive.
For string validation, 'min' and 'max' refer to character length; for int types, they refer to numeric range.
Use const { createStringType } = require('graphql-type') instead of const graphqlType = require('graphql-type').Run npm install graphql-type and ensure import path is correct: require('graphql-type') or import from 'graphql-type'.Use named import: const { createStringType } = require('graphql-type').No dependency data recorded yet.