Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions xtypes/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type String struct {
DefaultValue string
UpdateFn func(string)
ValidateFn func(string) error
content struct {
value *string
mutex sync.Mutex
Expand Down Expand Up @@ -52,8 +53,12 @@ func (d *String) Value() string {

// ValueValid test if the provided parameter value is valid. Has no side
// effects.
func (d *String) ValueValid(_ string) error {
return nil
func (d *String) ValueValid(v string) error {
if d.ValidateFn == nil {
return nil
}

return d.ValidateFn(v)
}

// GetDefaultValue will be used to read the default value when showing usage
Expand Down