Skip to content

bug: Case insensitive check failed #134

@Prnyself

Description

@Prnyself

For some field, like Status in RulesType, it is marked as case insensitive in doc.

However, when check validation in code, only lower case values will be marked as valid. Here is the code.

// Validate validates the Rules.
func (v *RulesType) Validate() error {
	...
	if v.Status != nil {
		statusValidValues := []string{"enabled", "disabled"}
		statusParameterValue := fmt.Sprint(*v.Status)

		statusIsValid := false
		for _, value := range statusValidValues {
			if value == statusParameterValue {
				statusIsValid = true
			}
		}

		if !statusIsValid {
			return errors.ParameterValueNotAllowedError{
				ParameterName:  "Status",
				ParameterValue: statusParameterValue,
				AllowedValues:  statusValidValues,
			}
		}
	}
	...
}

See https://github.com/qingstor/qingstor-sdk-go/blob/master/service/bucket.go#L814 for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions