Skip to content
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

Allow @deprecated directive on field args #243

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,24 @@ func TestDeprecatedDirective(t *testing.T) {
})
}

type testDeprecatedArgsResolver struct{}

func (r *testDeprecatedArgsResolver) A(ctx context.Context, args struct{ B *string }) int32 {
return 0
}

func TestDeprecatedArgs(t *testing.T) {
graphql.MustParseSchema(`
schema {
query: Query
}

type Query {
a(b: String @deprecated): Int!
}
`, &testDeprecatedArgsResolver{})
}

func TestInlineFragments(t *testing.T) {
gqltesting.RunTests(t, []*gqltesting.Test{
{
Expand Down
14 changes: 8 additions & 6 deletions internal/common/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (

// http://facebook.github.io/graphql/draft/#InputValueDefinition
type InputValue struct {
Name Ident
Type Type
Default Literal
Desc string
Loc errors.Location
TypeLoc errors.Location
Name Ident
Type Type
Default Literal
Desc string
Loc errors.Location
TypeLoc errors.Location
Directives DirectiveList
}

type InputValueList []*InputValue
Expand All @@ -37,6 +38,7 @@ func ParseInputValue(l *Lexer) *InputValue {
l.ConsumeToken('=')
p.Default = ParseLiteral(l, true)
}
p.Directives = ParseDirectives(l)
return p
}

Expand Down