diff options
| author | Physcik <mynameisgennadiy@vk.com> | 2026-01-09 02:47:26 +0500 |
|---|---|---|
| committer | Physcik <mynameisgennadiy@vk.com> | 2026-01-09 02:47:26 +0500 |
| commit | e6ccb74f77d0d03d33c422ca7dc942422074d7dd (patch) | |
| tree | d6c04f5a2824f69792c326b192d89bd458ccbbeb /engine/Components/Packages/Validation.go | |
| parent | a6abcd529522c6682a4c2a1f25b1eaf6bd74d53d (diff) | |
Packages pt. 2
Diffstat (limited to 'engine/Components/Packages/Validation.go')
| -rw-r--r-- | engine/Components/Packages/Validation.go | 15 |
1 files changed, 15 insertions, 0 deletions
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() +} |
