generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ocm | ||
|
||
import ( | ||
"fmt" | ||
|
||
commonerrors "github.com/kyma-project/modulectl/internal/common/errors" | ||
) | ||
|
||
type ModuleDefinition struct { | ||
Name string | ||
Version string | ||
SchemaVersion string | ||
|
||
// TODO: Define Layer struct based on the new ocm and remember to add the raw-manifest layer | ||
// Layers []Layer | ||
|
||
} | ||
|
||
func (d *ModuleDefinition) ValidateModuleDefinition() error { | ||
if d.Name == "" { | ||
return fmt.Errorf("%w: module name must not be empty", commonerrors.ErrInvalidArg) | ||
} | ||
|
||
if d.Version == "" { | ||
return fmt.Errorf("%w: module version must not be empty", commonerrors.ErrInvalidArg) | ||
} | ||
|
||
if d.SchemaVersion == "" { | ||
return fmt.Errorf("%w: module schema version must not be empty", commonerrors.ErrInvalidArg) | ||
} | ||
|
||
return nil | ||
} |