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

bug: Case insensitive check failed #134

Open
Prnyself opened this issue Aug 20, 2021 · 0 comments
Open

bug: Case insensitive check failed #134

Prnyself opened this issue Aug 20, 2021 · 0 comments

Comments

@Prnyself
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant