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

Bump gqlparser to v2.2.0 #1514

Merged
merged 3 commits into from
Apr 14, 2021
Merged
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
4 changes: 2 additions & 2 deletions codegen/testserver/directive.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ directive @toNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINI
directive @directive1 on FIELD_DEFINITION
directive @directive2 on FIELD_DEFINITION
directive @unimplemented on FIELD_DEFINITION
directive @order1(location: String!) on FIELD_DEFINITION | OBJECT
directive @order1(location: String!) repeatable on FIELD_DEFINITION | OBJECT
directive @order2(location: String!) on OBJECT

extend type Query {
Expand Down Expand Up @@ -42,7 +42,7 @@ input InnerDirectives {
message: String! @length(min: 1, message: "not valid")
}

type ObjectDirectives @order1(location: "ObjectDirectives_object_1") @order2(location: "ObjectDirectives_object_2") {
type ObjectDirectives @order1(location: "order1_1") @order1(location: "order1_2") @order2(location: "order2_1") {
text: String! @length(min: 0, max: 7, message: "not valid")
nullableText: String @toNull
order: [String!]!
Expand Down
5 changes: 3 additions & 2 deletions codegen/testserver/directive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,9 @@ func TestDirectives(t *testing.T) {
require.Equal(t, "Ok", resp.DirectiveObject.Text)
require.True(t, resp.DirectiveObject.NullableText == nil)
require.Equal(t, "Query_field", resp.DirectiveObject.Order[0])
require.Equal(t, "ObjectDirectives_object_2", resp.DirectiveObject.Order[1])
require.Equal(t, "ObjectDirectives_object_1", resp.DirectiveObject.Order[2])
require.Equal(t, "order2_1", resp.DirectiveObject.Order[1])
require.Equal(t, "order1_2", resp.DirectiveObject.Order[2])
require.Equal(t, "order1_1", resp.DirectiveObject.Order[3])
})
t.Run("when directive returns nil & custom go field is not nilable", func(t *testing.T) {
var resp struct {
Expand Down
63 changes: 55 additions & 8 deletions codegen/testserver/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions codegen/testserver/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,24 @@ func TestInput(t *testing.T) {
require.NoError(t, err)
require.False(t, resp.InputNullableSlice)
})

t.Run("coerce single value to slice", func(t *testing.T) {
check := func(ctx context.Context, arg []string) (b bool, e error) {
return len(arg) == 1 && arg[0] == "coerced", nil
}
resolvers.QueryResolver.InputSlice = check
resolvers.QueryResolver.InputNullableSlice = check

var resp struct {
Coerced bool
}
var err error
err = c.Post(`query { coerced: inputSlice(arg: "coerced") }`, &resp)
require.NoError(t, err)
require.True(t, resp.Coerced)

err = c.Post(`query { coerced: inputNullableSlice(arg: "coerced") }`, &resp)
require.NoError(t, err)
require.True(t, resp.Coerced)
})
}
40 changes: 40 additions & 0 deletions example/chat/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions example/config/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions example/dataloader/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions example/federation/accounts/graph/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading