lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Extend support for @deprecated directive

Open wimski opened this issue 3 years ago • 1 comments

The @deprecated directive currently is only allowed on FIELD_DEFINITION and ENUM_VALUE:

"""
Marks an element of a GraphQL schema as no longer supported.
"""
directive @deprecated(
  """
  Explains why this element was deprecated, usually also including a
  suggestion for how to access supported similar data. Formatted
  in [Markdown](https://daringfireball.net/projects/markdown/).
  """
  reason: String = "No longer supported"
) on FIELD_DEFINITION | ENUM_VALUE

However any schema element could become deprecated at some point, like an obsolete/unused input field for example. Would it be possible to add the following to the supported types of the @deprecated directive?

  • ARGUMENT_DEFINITION
  • INPUT_FIELD_DEFINITION

wimski avatar Mar 09 '22 11:03 wimski

Looks like this will be possible in an upcoming version of the GraphQL specification - see https://github.com/graphql/graphql-spec/pull/805#issuecomment-1029319320

We have to implement this in the base library first though, see https://github.com/webonyx/graphql-php/issues/110

spawnia avatar Mar 09 '22 11:03 spawnia