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

Cleaning up extra return in federation generated code #1713

Merged
merged 1 commit into from
Nov 13, 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: 0 additions & 4 deletions example/federation/accounts/graph/generated/federation.go

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

4 changes: 0 additions & 4 deletions example/federation/products/graph/generated/federation.go

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

4 changes: 0 additions & 4 deletions example/federation/reviews/graph/generated/federation.go

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

7 changes: 2 additions & 5 deletions plugin/federation/federation.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,13 @@ func (ec *executionContext) __resolve_entities(ctx context.Context, representati
{{- end -}}
list[idx[i]] = entity
}
return nil
{{ end }}
{{- end }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget what this does again?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For removing new lines. Formatting of the generated code.

{{ end }}
{{- end }}
default:
return errors.New("unknown type: "+typeName)
}

return nil
}

resolveEntityGroup := func(typeName string, reps []map[string]interface{}, idx []int) {
Expand Down Expand Up @@ -217,7 +216,5 @@ func (ec *executionContext) __resolve_entities(ctx context.Context, representati
g.Wait()
return list
}

return list
}
{{end}}
1 change: 1 addition & 0 deletions plugin/federation/federation_entityresolver_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:generate go run ../../testdata/gqlgen.go -config testdata/entityresolver/gqlgen.yml
package federation

import (
Expand Down
4 changes: 2 additions & 2 deletions plugin/federation/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ There are several different tests. Some will process the configuration file dire

Running entity resolver tests.
1. Go to `plugin/federation`
2. Run the command `go run github.com/99designs/gqlgen --config testdata/entityresolver/gqlgen.yml`
2. Run the command `go generate`
3. Run the tests with `go test ./...`.

# Architecture
Expand All @@ -33,7 +33,7 @@ That allows the federation plugin to generate `GetMany` resolver function that c
From that entity type, the resolver function would be

```
func (r *entityResolver) FindManyMultiHellosByName(ctx context.Context, reps []*generated.EntityResolverfindManyMultiHellosByNameInput) ([]*generated.MultiHello, error) {
func (r *entityResolver) FindManyMultiHellosByName(ctx context.Context, reps []*generated.ManyMultiHellosByNameInput) ([]*generated.MultiHello, error) {
/// <Your code to resolve the list of items>
}
```

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