# GraphQL validation using directives

DevFeed: [GraphQL validation using directives](<https://devfeed.tech/articles/graphql-validation-using-directives-23351.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/graphql-validation-using-directives>)

Author: James Mortemore

Published: 2018-06-06T04:17:39Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [API](<https://devfeed.tech/topics/api.md>), [backend-development](<https://devfeed.tech/topics/backend-development.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [backend](<https://devfeed.tech/tags/backend.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [guest-post](<https://devfeed.tech/tags/guest-post.md>), [schema](<https://devfeed.tech/tags/schema.md>), [sdl](<https://devfeed.tech/tags/sdl.md>), [server](<https://devfeed.tech/tags/server.md>), [validation](<https://devfeed.tech/tags/validation.md>)

## AI overview

A guest tutorial explains how to use GraphQL schema directives, including graphql-constraint-directive, to express validation rules for inputs such as string lengths and email addresses in SDL. It notes that state-dependent validation must remain in application code.

## Source excerpt

This is a guest post by James Mortemore, who is a software engineer at YLD. He has an extensive background in API development & enterprise integration architecture. Out of the box, GraphQL supports validating your inputs based on type information. For example, you can ensure that an argument is a particular scalar type, such as String or Int. You can also enforce the shape of object arguments using input object types.