GraphQL Scalars is a library of validated scalar types for dates, identifiers, formats, and units. Each scalar includes resolvers, mocks, and TypeScript definitions for schema authors.
Overview
GraphQL Scalars extends the default GraphQL type system with a large catalog of custom scalar types. Where base GraphQL only provides a handful of scalars, this library adds dozens of precise types for common domains such as dates, emails, and structured identifiers.
Every scalar validates values on input and output so resolvers receive data that already matches the declared format. Scalars ship with type definitions, resolver implementations, mock generators for testing, and TypeScript types for code generation workflows.
You import the definition and resolver for each scalar and add them to a schema built with graphql-js compatible servers. Documentation describes setup with Apollo Server, GraphQL Yoga, Mercurius, GraphQL Tools, and similar stacks.
The library is maintained as part of The Guild’s Hive ecosystem and absorbed the earlier ok-grow scalar package. It is intended as a shared dependency rather than a standalone service.
Key features
- Large catalog of custom scalar types
- Input and output validation per scalar
- Mocks for each scalar
- TypeScript types for codegen
- Works with graphql-js servers
- Type definitions bundled with resolvers
- Usage guides for major servers
- Maintained by The Guild
Use cases
- Type-safe dates and emails in GraphQL
- Reducing hand-written scalar validation
- Test data generation with scalar mocks
- Codegen-friendly GraphQL schemas
- Extending schemas beyond built-in scalars