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

(Enhancement) Validator: Adding more concrete base64 validation, Enabling []int validation #286

Merged
merged 2 commits into from
Jul 20, 2018

Conversation

marcsantiago
Copy link
Contributor

@marcsantiago marcsantiago commented Jun 28, 2018

The current base64 validator makes a few assumptions about the nature
of the base 64 string as a result of using regex.
By using Go's build in base64 lib we circumvent the regex as well as
adding full functionally to validate both standard base64 strings
and raw base64 strings.
This is an additive string, which allows for full backwards capabilities.

(Enhancement) Validator: Validating contents of []int …
Adding a new type to enable the ability to validate what's inside of an
int slice. This is important for structured API documentation, when the
items in the slice should be known integers. I didn't implement the other
slice types as I don't have a use case for them, but it should be easy
enough to extend. This is not a breaking change.

The current base64 validator makes a few assumptions about the nature
of the base 64 string as a result of using regex.
By using Go's build in base64 lib we circumvent the regex as well as
adding full functionally to validate both standard base64 strings
and raw base64 strings.
This is an additive string, which allows for full backwards capabilities.
@marcsantiago marcsantiago changed the title Validator: Adding more concrete base64 validation (Feature) Validator: Adding more concrete base64 validation Jun 28, 2018
Adding a new type to enable the ability to validate what's inside of an
int slice.  This is important for structured API documentation, when the
items in the slice should be known integers. I didn't implement the other
slice types as I don't have a use case for them, but it should be easy
enough to extend. This is not a breaking change.
@marcsantiago marcsantiago changed the title (Feature) Validator: Adding more concrete base64 validation (Feature) Validator: Adding more concrete base64 validation, Enabling []int validation Jun 29, 2018
@marcsantiago marcsantiago changed the title (Feature) Validator: Adding more concrete base64 validation, Enabling []int validation (Enhancement) Validator: Adding more concrete base64 validation, Enabling []int validation Jun 29, 2018
@asaskevich asaskevich merged commit 6d10d9b into asaskevich:master Jul 20, 2018
@asaskevich
Copy link
Owner

Thank you!

@asaskevich
Copy link
Owner

@marcsantiago could you please take a look at unit tests?

./validator.go:1202:26: invalid argument customErrorMessage (type tagOption) for len
./validator.go:1225:45: cannot use customErrorMessage (type tagOption) as type string in argument to fmt.Errorf
./validator.go:1225:95: too few values in struct initializer
./validator.go:1228:127: too few values in struct initializer
./validator.go:1230:130: too few values in struct initializer
FAIL	github.com/asaskevich/govalidator [build failed]

@marcsantiago
Copy link
Contributor Author

marcsantiago commented Jul 20, 2018 via email

@marcsantiago
Copy link
Contributor Author

marcsantiago commented Jul 20, 2018 via email

@asaskevich
Copy link
Owner

@marcsantiago which Go version are you using? Tests are falling at golang:1.9

@marcsantiago
Copy link
Contributor Author

marcsantiago commented Jul 20, 2018 via email

@marcsantiago
Copy link
Contributor Author

marcsantiago commented Jul 20, 2018 via email

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

Successfully merging this pull request may close these issues.

2 participants