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: support validate struct without struct tag #934

Conversation

leoliang1997
Copy link
Contributor

@leoliang1997 leoliang1997 commented Apr 20, 2022

Fixes Or Enhances

validate struct without struct tag, use map[string]string to define rules, ref: #853

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

@leoliang1997 leoliang1997 requested a review from a team as a code owner April 20, 2022 11:10
@coveralls
Copy link

coveralls commented Apr 20, 2022

Coverage Status

Coverage decreased (-0.1%) to 75.034% when pulling adfb118 on leoliang1997:dev/add-struct-without-tag-support into 58d5778 on go-playground:master.

Copy link
Contributor

@deankarn deankarn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool just one ask.

@@ -271,6 +272,33 @@ func (v *Validate) RegisterStructValidationCtx(fn StructLevelFuncCtx, types ...i
}
}

// RegisterStructValidationMapRules registers validate map rules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some addition information regarding that rules override any tags at the struct level?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I can add it.

@deankarn deankarn merged commit d0d0c35 into go-playground:master May 1, 2022
@leoliang1997 leoliang1997 deleted the dev/add-struct-without-tag-support branch May 3, 2022 13:14
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.

None yet

3 participants