func filterNodes(g *gen.Graph, op string) ([]*gen.Type, error) {
	c, err := config(g.Config)
	if err != nil {
		return nil, err
	}
	var filteredNodes []*gen.Type
	for _, n := range g.Nodes {
		var p Policy
		ant := &SchemaAnnotation{}
		// If no policies are given follow the global policy.
		if n.Annotations == nil || n.Annotations[ant.Name()] == nil {
			p = c.HandlerPolicy
		} else {
			if err := ant.Decode(n.Annotations[ant.Name()]); err != nil {
				return nil, err
			}
			switch op {
			case opCreate:
				p = ant.CreatePolicy
			case opRead:
				p = ant.ReadPolicy
			case opUpdate:
				p = ant.UpdatePolicy
			case opDelete:
				p = ant.DeletePolicy
			case opList:
				p = ant.ListPolicy
			}
			// If the policy is policy.None follow the globally defined policy.
			if p == None {
				p = c.HandlerPolicy
			}
		}
		if p == Expose {
			filteredNodes = append(filteredNodes, n)
		}
	}
	return filteredNodes, nil
}
// filterNodes returns the nodes a handler for the given operation should be generated for.
filterNodes returns the nodes a handler for the given operation should be generated for.
// filterNodes returns the nodes a handler for the given operation should be generated for .
func filterNodes(g *gen.Graph, op string) ([]*gen.Type, error) {
	c, err := config(g.Config)
	if err != nil {
		return nil, err
	}
	var filteredNodes []*gen.Type
	for _, n := range g.Nodes {
		var p Policy
		ant := &SchemaAnnotation{}
		if n.Annotations == nil || n.Annotations[ant.Name()] == nil {
			p = c.HandlerPolicy
		} else {
			if err := ant.Decode(n.Annotations[ant.Name()]); err != nil {
				return nil, err
			}
			switch op {
			case opCreate:
				p = ant.CreatePolicy
			case opRead:
				p = ant.ReadPolicy
			case opUpdate:
				p = ant.UpdatePolicy
			case opDelete:
				p = ant.DeletePolicy
			case opList:
				p = ant.ListPolicy
			}
			if p == None {
				p = c.HandlerPolicy
			}
		}
		if p == Expose {
			filteredNodes = append(filteredNodes, n)
		}
	}
	return filteredNodes, nil
}
func filterNodes ( g * gen . Graph , op string ) ( [ ] * gen . Type , error ) { c , err := config ( g . Config ) if err != nil { return nil , err } var filteredNodes [ ] * gen . Type for _ , n := range g . Nodes { var p Policy ant := & SchemaAnnotation { } if n . Annotations == nil || n . Annotations [ ant . Name ( ) ] == nil { p = c . HandlerPolicy } else { if err := ant . Decode ( n . Annotations [ ant . Name ( ) ] ) ; err != nil { return nil , err } switch op { case opCreate : p = ant . CreatePolicy case opRead : p = ant . ReadPolicy case opUpdate : p = ant . UpdatePolicy case opDelete : p = ant . DeletePolicy case opList : p = ant . ListPolicy } if p == None { p = c . HandlerPolicy } } if p == Expose { filteredNodes = append ( filteredNodes , n ) } } return filteredNodes , nil }
filterNodes returns the nodes a handler for the given operation should be generated for.
filterNodes returns the nodes a handler for the given operation should be generated for .
// If no policies are given follow the global policy. // If the policy is policy.None follow the globally defined policy.