-
Notifications
You must be signed in to change notification settings - Fork 2k
Improvements to AS3 docs that are not related to differences from AS2 #5340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
6b851b3
bc7b5e8
2bc10b6
af2e220
0cc0246
380ca6b
9c34bbc
296922b
c168386
cc4af63
5ecc21c
5ce0b0e
846cee6
e8a3cba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,16 +29,37 @@ For example, here's the GraphQL spec's definition of the `@deprecated` directive | |
```graphql | ||
directive @deprecated( | ||
reason: String = "No longer supported" | ||
) on FIELD_DEFINITION | ENUM_VALUE | ||
) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @glasser I did make the recommended update and agree with it, but it's worth noting that this is not in the spec yet (even in the working draft, surprisingly, though it's implemented in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, this is the current PR: graphql/graphql-spec#805 |
||
``` | ||
|
||
This indicates that `@deprecated` can decorate either a schema `FIELD_DEFINITION` (as shown at the top of the article) or a schema `ENUM_VALUE` definition (as shown here): | ||
This indicates that `@deprecated` can decorate any of the four listed locations. Also note that its `reason` argument is optional and provides a default value. Usage examples of each location are provided below: | ||
|
||
```graphql:title=schema.graphql | ||
# ARGUMENT_DEFINITION | ||
# Note: @deprecated arguments _must_ be optional. | ||
directive @withDeprecatedArgs( | ||
deprecatedArg: String @deprecated(reason: "Use `newArg`"), | ||
newArg: String | ||
) on FIELD | ||
|
||
type MyType { | ||
# ARGUMENT_DEFINITION (alternate example on a field's args) | ||
fieldWithDeprecatedArgs(name: String! @deprecated): String | ||
# FIELD_DEFINITION | ||
deprecatedField: String @deprecated | ||
} | ||
|
||
enum MyEnum { | ||
# ENUM_VALUE | ||
OLD_VALUE @deprecated(reason: "Use `NEW_VALUE`.") | ||
NEW_VALUE | ||
} | ||
|
||
input SomeInputType { | ||
nonDeprecated: String | ||
# INPUT_FIELD_DEFINITION | ||
deprecated: String @deprecated | ||
} | ||
``` | ||
|
||
If `@deprecated` appears elsewhere in a GraphQL document, it produces an error. | ||
|
Uh oh!
There was an error while loading. Please reload this page.