-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Ready: Add @deprecated validation for input object fields, field arguments, directive arguments #3591
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
Conversation
@Override | ||
public TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField inputObjectField, TraverserContext<GraphQLSchemaElement> context) { | ||
// There can only be at most one @deprecated, because it is not a repeatable directive | ||
GraphQLAppliedDirective deprecatedDirective = inputObjectField.getAppliedDirective("deprecated"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Directives.Deprecated.getName()
perhaps to stop string spread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's a better idea, I'll add that. Don't want a random string hanging out here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed both strings in the commit after your review
@Override | ||
public TraversalControl visitGraphQLArgument(GraphQLArgument argument, TraverserContext<GraphQLSchemaElement> context) { | ||
// There can only be at most one @deprecated, because it is not a repeatable directive | ||
GraphQLAppliedDirective deprecatedDirective = argument.getAppliedDirective("deprecated"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string constant suggestion as abovee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!
Fixes #3590
From the GraphQL specification:
This PR adds the schema validation rule to enforce this line of the spec.