summaryrefslogtreecommitdiff
path: root/engine/Dynamic/Validation.go
blob: dfe1d5cc7791960fabc6c4df7e13b0dbcea59456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package dynamic

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()
}