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

Optionally render entity requires populator function for advanced @requires use cases #2884

Merged
merged 14 commits into from
Feb 23, 2024
Prev Previous commit
Next Next commit
Adding ordering fix.
  • Loading branch information
mentat committed Feb 21, 2024
commit c19c9486c60291faf68b35ee458a8210638c225f
4 changes: 4 additions & 0 deletions plugin/federation/federation.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ func (f *federation) GenerateCode(data *codegen.Data) error {
populators = append(populators, populator)
}

sort.Slice(populators, func(i, j int) bool {
return populators[i].FuncName < populators[j].FuncName
})

requiresFile := data.Config.Federation.Dir() + "/federation.requires.go"
existingImports := rewriter.ExistingImports(requiresFile)
for _, imp := range existingImports {
Expand Down