Skip to content

Commit

Permalink
remove ability to override optional fields in actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Dec 16, 2023
1 parent 94b06a7 commit 15fd63c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 0 additions & 4 deletions internal/tui/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ func FindMissingInputs(inputs []types.Input, params map[string]types.Param) []ty
input.Default = param.Default
}

if param.Optional {
input.Optional = true
}

missing = append(missing, input)
}

Expand Down
9 changes: 3 additions & 6 deletions internal/types/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ type Action struct {
}

type Param struct {
Value any `json:"value,omitempty"`
Default any `json:"default,omitempty"`
Optional bool `json:"optional,omitempty"`
Value any `json:"value,omitempty"`
Default any `json:"default,omitempty"`
}

func (p *Param) UnmarshalJSON(bts []byte) error {
Expand Down Expand Up @@ -58,7 +57,6 @@ func (p *Param) UnmarshalJSON(bts []byte) error {

if err := json.Unmarshal(bts, &param); err == nil {
p.Default = param.Default
p.Optional = param.Optional
return nil
}

Expand All @@ -74,8 +72,7 @@ func (p Param) MarshalJSON() ([]byte, error) {
Default any `json:"default,omitempty"`
Required bool `json:"required,omitempty"`
}{
Default: p.Default,
Required: p.Optional,
Default: p.Default,
})
}

Expand Down

0 comments on commit 15fd63c

Please sign in to comment.