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

Add ValidateBinder as an optional Binder implementation #1144

Closed
wants to merge 1 commit into from

Conversation

Tethik
Copy link

@Tethik Tethik commented Jun 13, 2018

My attempt at #1105

I added a new Binder implementation ValidateBinder that basically calls context.Validate after successful bind. You enable it like this:

e := echo.New()
e.Binder = &echo.ValidateBinder{}
e.Validator = ...

Then later in your handler when you call context.Bind the ValidateBinder will call both bind and validate.

I added some tests based on the existing ones for bind. Also used this as a test implementation:
https://gist.github.com/Tethik/ef55db82e82fc662262245949593deea

Somewhat newbie at Golang, feedback and suggestions would be greatly appreciated :)

@codecov
Copy link

codecov bot commented Jun 13, 2018

Codecov Report

Merging #1144 into master will increase coverage by 0.53%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1144      +/-   ##
==========================================
+ Coverage    81.3%   81.83%   +0.53%     
==========================================
  Files          25       25              
  Lines        1904     1905       +1     
==========================================
+ Hits         1548     1559      +11     
+ Misses        249      242       -7     
+ Partials      107      104       -3
Impacted Files Coverage Δ
bind.go 85.45% <100%> (+0.36%) ⬆️
middleware/logger.go 84.46% <0%> (-0.44%) ⬇️
middleware/middleware.go 100% <0%> (ø) ⬆️
echo.go 87.9% <0%> (+0.26%) ⬆️
context.go 75.45% <0%> (+1.81%) ⬆️
middleware/jwt.go 88.57% <0%> (+6.99%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b4cc60...9681e53. Read the comment docs.

@stale
Copy link

stale bot commented Dec 30, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 30, 2018
@stale stale bot closed this Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant