summaryrefslogtreecommitdiff
path: root/engine/Components/Packages/Validation.go
blob: 04428d21d6cbf0942beab84cb2e8596801bcd56d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package packages

type Validatable interface {
	// If the object is returned invalid this function should return the reason
	IsValid() error
}

// Reads object fron the file and validates it
func ReadValidJSONfromFile(fileLocation string, v Validatable) error {
	var err = ReadJSONfromFile(fileLocation, v)
	if err != nil {
		return err
	}
	return v.IsValid()
}