Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename validUnsetFunc to validDeleteFunc #881

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
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: 6 additions & 3 deletions pkg/config/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func (o *operator) deleteConfigItem(key string) error {
if err != nil {
return err
}
if info.validateUnsetFunc != nil {
if err = info.validateUnsetFunc(o.config, key); err != nil {
if info.validateDeleteFunc != nil {
if err = info.validateDeleteFunc(o.config, key); err != nil {
return err
}
}
Expand Down Expand Up @@ -317,7 +317,7 @@ func validateConfigItem(config *v1.Config, info *itemInfo, key string, value any
// its validation.
func parseStructuredConfigItem(info *itemInfo, strValue string) (any, error) {
if len(strValue) == 0 {
return nil, ErrEmptyConfigItemKey
return nil, ErrEmptyConfigItem
}

value := info.zeroValue
Expand Down Expand Up @@ -354,6 +354,9 @@ func parseStructuredConfigItem(info *itemInfo, strValue string) (any, error) {
// getRegisteredItemInfo returns the registered info of the config key. If the config key is not registered,
// return error.
func getRegisteredItemInfo(registeredItems map[string]*itemInfo, key string) (*itemInfo, error) {
if key == "" {
return nil, ErrEmptyConfigItemKey
}
registeredKey, err := convertToRegisteredKey(registeredItems, key)
if err != nil {
return nil, err
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/config/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ type itemInfo struct {
// Please do not do any real setting job in the validateFunc.
validateFunc validation.ValidateFunc

// validateUnsetFunc is used to check the config item is valid or not to unset, calling before executing
// validateDeleteFunc is used to check the config item is valid or not to unset, calling before executing
// real config unsetting.
// Please do not do any real unsetting job in the validateUnsetFunc.
validateUnsetFunc validation.ValidateUnsetFunc
// Please do not do any real unsetting job in the validateDeleteFunc.
validateDeleteFunc validation.ValidateUnsetFunc
}
Loading