Skip to content

Strict validation of Go struct tags #20

Description

@rorheden

We should use our own tag parser instead of the one that the core lib provides (StructParser.Get). This because Go's tag parser is pretty dumb, and can silence errors that in our case is important to highlight.

I.e. a validator tag such as validate:"regexp(´^[a-z0-9-]*@[a-z0-9.]*\.com$´)" would slip by and just return empty since \ in the tag is unescaped. I.e. validate:"regexp(´^[a-z0-9-]*@[a-z0-9.]*\\.com$´)" would be parsed correctly. When it comes to validation, this means that a simple user error could result in a validation rule not being run. Which in turn can be really bad.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions