Scalars your schema is missing
GraphQL ships with five scalars. GraphQL Scalars adds more than eighty precise, validated types for dates, identifiers, formats, and units, with mocks and TypeScript definitions. Part of the Hive ecosystem by The Guild.
- 80+ scalar types
- Validation on input and output
- Mocks and TypeScript included
Precise types, less validation code
- Validated at the edgeEvery scalar validates values on the way in and out, so resolvers work with data that is already correct.
- Works with any serverAdd the type definitions and resolvers to Apollo Server, GraphQL Yoga, Mercurius, or any graphql-js based server.
- Mocks and typesEvery scalar ships with a mock for testing and a TypeScript type for code generation.
Add a scalar in two lines
Import the type definition and its resolver, add both to the schema, and use the scalar like any built-in one.
Quick startimport { makeExecutableSchema } from '@graphql-tools/schema';
import { DateTimeResolver, DateTimeTypeDefinition, EmailAddressResolver } from 'graphql-scalars';
const schema = makeExecutableSchema({
typeDefs: [
DateTimeTypeDefinition,
'scalar EmailAddress',
`type User { email: EmailAddress!, createdAt: DateTime! }`,
],
resolvers: {
DateTime: DateTimeResolver,
EmailAddress: EmailAddressResolver,
},
});Learn more
All scalars
The full list, from AccountNumber to Void, each with its format and validation rules.
Browse the scalars →Usage
Setup with Apollo Server, GraphQL Yoga, GraphQL Tools, and code generation.
Usage guides →Changelog
Every release and the changes it brought.
Changelog →
Discover the complete ecosystem of tools and libraries
Complete GraphQL Federation Stack
Our libraries to support all your GraphQL needs
Explore the Ecosystem