Skip to content

Commit

Permalink
Allow @deprecated directive on arguments and input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia authored Sep 2, 2024
1 parent 39f86b2 commit e3ba8f0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ You can find and compare releases at the [GitHub release page](https://github.co

## Unreleased

## v6.44.0

### Added

- Allow `@deprecated` directive on arguments and input fields https://github.com/nuwave/lighthouse/pull/2607

## v6.43.1

### Changed
Expand Down
13 changes: 6 additions & 7 deletions docs/6/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -1165,17 +1165,16 @@ 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://commonmark.org).
Explains why this element was deprecated.
It is also beneficial to suggest what to use instead.
Formatted in Markdown, as specified by [CommonMark](https://commonmark.org).
"""
reason: String = "No longer supported"
) on FIELD_DEFINITION | ENUM_VALUE
) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
```
You can mark fields as deprecated by adding the [@deprecated](#deprecated) directive.
It is recommended to provide a `reason` for the deprecation, as well as a suggestion on
how to move forward.
You can indicate schema elements are no longer supported by adding the [@deprecated](#deprecated) directive.
It is recommended to provide a `reason` for the deprecation, as well as suggest a replacement.
```graphql
type Query {
Expand Down
13 changes: 6 additions & 7 deletions docs/master/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -1165,17 +1165,16 @@ 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://commonmark.org).
Explains why this element was deprecated.
It is also beneficial to suggest what to use instead.
Formatted in Markdown, as specified by [CommonMark](https://commonmark.org).
"""
reason: String = "No longer supported"
) on FIELD_DEFINITION | ENUM_VALUE
) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
```
You can mark fields as deprecated by adding the [@deprecated](#deprecated) directive.
It is recommended to provide a `reason` for the deprecation, as well as a suggestion on
how to move forward.
You can indicate schema elements are no longer supported by adding the [@deprecated](#deprecated) directive.
It is recommended to provide a `reason` for the deprecation, as well as suggest a replacement.
```graphql
type Query {
Expand Down
8 changes: 4 additions & 4 deletions src/Schema/Directives/DeprecatedDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public static function definition(): string
"""
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).
Explains why this element was deprecated.
It is also beneficial to suggest what to use instead.
Formatted in Markdown, as specified by [CommonMark](https://commonmark.org).
"""
reason: String = "No longer supported"
) on FIELD_DEFINITION | ENUM_VALUE
) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
GRAPHQL;
}
}

0 comments on commit e3ba8f0

Please sign in to comment.