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

import utils "github.com/DegustatorPonos/RuinesOfRafdolon/Utils"

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 = utils.ReadJSONfromFile(fileLocation, v)
	if err != nil {
		return err
	}
	return v.IsValid()
}