1

I am using schemagen (run via gradle) to generate my .graphqls and .json schema files. However, when I run schemagen it doesn't include the reason on deprecated fields and gives me an ESLint error (ESLint: Directive "@deprecated" must have a reason! (@graphql-eslint/require-deprecation-reason).

Java code looks like:

final GraphQLFieldDefinition oldField = field(
    newFieldDefinition()
        .name( "oldField" )
    .description( "an old field" )
    .type( GraphQLDate )
        .deprecate( "deprecated, use newField" )
    .build() );

type( ModelBuilder.fromTransferable( "Example", "Example Description", Example.class )
    .field( oldField )
    .field( "newField", "newField Description", GraphQLDate )
    .buildObject() );

The schema.graphqls output:

"Example Description"
type Example {
  "an old field"
  oldField: ISO8601Date @deprecated
  "newField Description"
  newField: ISO8601Date
}

Error: ESLint: Directive "@deprecated" must have a reason! (@graphql-eslint/require-deprecation-reason)

The expected output would be:

"Example Description"
type Example {
  "an old field"
  oldField: ISO8601Date @deprecated(reason: "deprecated, use newField")
  "newField Description"
  newField: ISO8601Date
}
Tom Delebo
  • 21
  • 2

0 Answers0