From e6ccb74f77d0d03d33c422ca7dc942422074d7dd Mon Sep 17 00:00:00 2001 From: Physcik Date: Fri, 9 Jan 2026 02:47:26 +0500 Subject: Packages pt. 2 --- engine/Components/Packages/Validation.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 engine/Components/Packages/Validation.go (limited to 'engine/Components/Packages/Validation.go') diff --git a/engine/Components/Packages/Validation.go b/engine/Components/Packages/Validation.go new file mode 100644 index 0000000..04428d2 --- /dev/null +++ b/engine/Components/Packages/Validation.go @@ -0,0 +1,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() +} -- cgit v1.3