INNER CODE UNIT · Go
filterDefinition
movio/bramble · auth.go:164
func filterDefinition(sourceSchema *ast.Schema, visited map[string]bool, types map[string]*ast.Definition, def *ast.Definition, allowedFields AllowedFields) *ast.Definition {
if def == nil {
return nil
}
resDef := *def
resDef.Fields = nil
if allowedFields.AllowAll {
if visited == nil {
// visited keeps track of already visited subfields, so that we
// don't enter into an infinite recursion
visited = make(map[string]bool)
}
resDef.Fields = def.Fields
// copy recursively all the subtypes for every field into the result schema
for _, f := range def.Fields {