{"id":47972,"library":"graphql-type","title":"graphql-type","description":"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.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/ilearnio/graphql-type","tags":["javascript"],"install":[{"cmd":"npm install graphql-type","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-type","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-type","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS-only; use require() or named import with ESM bundlers. ESM users: the package does not export ESM modules; use dynamic import or bundler config.","wrong":"","symbol":"createStringType","correct":"import { createStringType } from 'graphql-type'"},{"note":"Same import pattern as other create* functions.","wrong":"","symbol":"createIntType","correct":"import { createIntType } from 'graphql-type'"},{"note":"Available for float scalars.","wrong":"","symbol":"createFloatType","correct":"import { createFloatType } from 'graphql-type'"}],"quickstart":{"code":"const { createStringType } = require('graphql-type');\nconst EmailType = createStringType({\n  name: 'EmailAddress',\n  min: 5,\n  max: 100,\n  regexp: /^\\w+@\\w+\\.[a-z]{2,}$/i\n});\nconsole.log(EmailType.name); // EmailAddress","lang":"javascript","description":"Creates a custom GraphQL scalar type for email validation using createStringType."},"warnings":[{"fix":"Consider using GraphQL's built-in custom scalars or a more maintained library like graphql-constraint-directive.","message":"Package has not been updated since 2018. May not work with latest GraphQL versions.","severity":"deprecated","affected_versions":">=1.1.1"},{"fix":"For string validation, 'min' and 'max' refer to character length; for int types, they refer to numeric range.","message":"The 'validate' object inside createStringType uses 'min' and 'max' for string length, not for integer boundaries.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use const { createStringType } = require('graphql-type') instead of const graphqlType = require('graphql-type').","message":"Default export is not recommended; always use named imports.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2018':114 'api':95 'bi':36 'bi-direct':35 'built':25 'built-in':24 'cadenc':118 'compar':79 'consist':97 'creat':82 'creation':12 'custom':61,65,83 'defin':19 'direct':37,47 'error':66 'featur':56 'float':32,78 'function':16,63 'graphql':2,5,10,20,86,90 'graphql-typ':1,4,89 'graphqlscalartyp':88 'helper':13 'includ':57 'input':39,49 'input-on':48 'integ':30,74 'javascript':119 'key':55 'length':59 'licens':103 'low':116 'mainten':117 'manual':81 'maxdecim':76 'messag':67 'min/max':58,70 'mit':102 'offer':92 'output':41,53 'output-on':52 'packag':105 'pattern':99 'plus':75 'provid':15 'quick':18 'regex':60 'releas':100 'scalar':21,84 'seen':111 'simpler':94 'sinc':113 'stabl':107 'string':29,69 'suggest':115 'support':34 'test':62,72 'type':3,6,11,22,91 'uni':46 'uni-direct':45 'updat':112 'v1.1.1':7 'valid':27,38,98 'well':43","created_at":"2026-06-07T16:54:16.665307+00:00","updated_at":"2026-06-07T16:54:16.665307+00:00","problems":[{"fix":"Run npm install graphql-type and ensure import path is correct: require('graphql-type') or import from 'graphql-type'.","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'graphql-type'"},{"fix":"Use named import: const { createStringType } = require('graphql-type').","cause":"Using default import incorrectly (e.g. import graphqlType from 'graphql-type' for a CJS module).","error":"TypeError: createStringType is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ilearnio/graphql-type","github":"https://github.com/ilearnio/graphql-type","docs":null,"changelog":null,"pypi":null,"npm":"graphql-type","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}