Skip to content

Commit

Permalink
Init defaults for Action
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Dec 3, 2021
1 parent a86e1aa commit eece37e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions krab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func NewConfig(files []*File) (*Config, error) {
for _, defaultable := range c.MigrationSets {
defaultable.InitDefaults()
}
for _, defaultable := range c.Actions {
defaultable.InitDefaults()
}

// validate
for _, validatable := range c.MigrationSets {
Expand Down
7 changes: 7 additions & 0 deletions krab/type_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ func (a *Action) Addr() Addr {
return Addr{Keyword: "action", Labels: []string{a.Namespace, a.RefName}}
}

func (a *Action) InitDefaults() {
if a.Arguments == nil {
a.Arguments = &Arguments{}
}
a.Arguments.InitDefaults()
}

func (a *Action) Validate() error {
return ErrorCoalesce(
ValidateRefName(a.Namespace),
Expand Down

0 comments on commit eece37e

Please sign in to comment.