func()

in pkg/topology/types.go [64:85]


func (v *validator) validate(t *Topology) error {
	for _, root := range t.Services {
		v.walk(root)
	}

	var messages []string
	if v.duplicates.Len() > 0 {
		messages = append(messages, fmt.Sprintf("the following pipelines had duplicate entries: %v", sets.List(v.duplicates)))
	}
	for _, entrypoint := range t.Entrypoints {
		if entrypoint.Identifier == "" {
			messages = append(messages, "entrypoint identifier cannot be empty")
		}
		if !v.seen.Has(entrypoint.Identifier) {
			messages = append(messages, fmt.Sprintf("entrypoint %s was not found in the dependency tree", entrypoint.Identifier))
		}
	}
	if len(messages) > 0 {
		return fmt.Errorf("dependency tree invalid: %s", strings.Join(messages, ", "))
	}
	return nil
}