3.0.0 • Published 4 years ago

graphql-directive-deprecated v3.0.0

Weekly downloads
245
License
MIT
Repository
github
Last release
4 years ago

Build Status Coverage Status dependencies Status devDependencies Status peerDependencies Status semantic-release Dependabot Status

When writing a GraphQL schema with the Schema Definition Language, some flexibility, such as adding a deprecationReason to a field is lost. This package implements a custom directive to make it possible to deprecate a field or enum. This is intended for use in Apollo Server that builds the schema with graphql-tools. See the Apollo graphql-tools docs for more information on schema directives.

Usage

npm install graphql-directive-deprecated

Example

import { makeExecutableSchema } from 'graphql-tools';
import { DeprecatedDirective } from 'graphql-directive-deprecated';

const typeDefs = `
  directive @deprecated(
    reason: String = "No longer supported"
  ) on FIELD_DEFINITION | ENUM_VALUE

  type ExampleType {
    newField: String
    oldField: String @deprecated(reason: "Use newField.")
  }
`;

const schema = makeExecutableSchema({
  typeDefs,
  schemaDirectives: {
    deprecated: DeprecatedDirective
  }
});
3.0.0

4 years ago

2.8.0

4 years ago

2.7.0

4 years ago

2.6.0

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago