Skip to content

Commit

Permalink
Support for multiple @key directives in federation (reworked) (#1723)
Browse files Browse the repository at this point in the history
* Support for multiple @key directives in federation (reworked)

* address review comments

- reworked code generation for federation.go
- better checking for missing/incorrect parameters to entity resolver functions
- better tests for generated entity resolvers

Still missing: 
- suggested test for autobind vs non-autobind generation
- could probably clean up generated code spacing, etc
- not sure @multi cases are handled completely (if they apply)
  • Loading branch information
carldunham authored Dec 13, 2021
1 parent 2747bd5 commit 14cfee7
Show file tree
Hide file tree
Showing 21 changed files with 1,759 additions and 469 deletions.
93 changes: 68 additions & 25 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.

9 changes: 9 additions & 0 deletions example/federation/products/graph/entity.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ func (r *entityResolver) FindProductByManufacturerIDAndID(ctx context.Context, m
return nil, nil
}

func (r *entityResolver) FindProductByUpc(ctx context.Context, upc string) (*model.Product, error) {
for _, hat := range hats {
if hat.Upc == upc {
return hat, nil
}
}
return nil, nil
}

// Entity returns generated.EntityResolver implementation.
func (r *Resolver) Entity() generated.EntityResolver { return &entityResolver{r} }

Expand Down
131 changes: 104 additions & 27 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.

Loading

0 comments on commit 14cfee7

Please sign in to comment.