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

Validation #132

Closed
2 tasks done
jeevatkm opened this issue Oct 7, 2017 · 8 comments
Closed
2 tasks done

Validation #132

jeevatkm opened this issue Oct 7, 2017 · 8 comments
Assignees
Labels
Projects

Comments

@jeevatkm
Copy link
Member

jeevatkm commented Oct 7, 2017

My homework and discussion with aah users in the thread then finally chosen https://github.com/go-playground/validator as a Validator library for aah framework.

Will add method details and types later on

On Validation errors, aah will call error handler in the sequence of -

  • Controller level error handler (coming in v0.10)
  • Centralized error handler
  • Default error handler

As we know currently aah has Centralized Error Handling feature.

As part of flexible validator feature, I'm planning take aah capabilities to the next level via providing an optional controller level ErrorHandler. This is gonna have small breaking change, what it means-

  • Existing aah.ErrorHandler func type would be refactored to aah.ErrorHandlerFunc
  • New aah.ErrorHandler interface comes in.

So aah framework user has an option handle errors at controller level too-

type StoryController struct {
  *aah.Context
}

// HandleError method to handle errors for Story controller
func (*s StoryController) HandleError(e *aah.Error) bool {
  // All story controller errors sent to this method
  //   - Return ture, if you have handled an errors
  //   - Return false, aah will propagate the error to centralized error handler
}

  • Implementation
  • Documentation
@jeevatkm jeevatkm created this issue from a note in aah Roadmap (v0.10 - Iteration (Not yet started)) Oct 7, 2017
@jeevatkm jeevatkm added this to the v0.10 Milestone milestone Oct 7, 2017
@broklyngagah
Copy link

Hi @jeevatkm
Any plan to use or integrate with existing library ?
I suggest gopkg.in/go-playground/validator.v9

Thanks 😊

@jeevatkm
Copy link
Member Author

jeevatkm commented Dec 4, 2017

@broklyngagah Yes, I'm planning to use flexible library(need to do my homework on it). I haven't made any choices so far. Thanks for the suggesting one. I will look into it.

@jeevatkm jeevatkm moved this from v0.10 - Iteration to v0.10 - In Progress in aah Roadmap Mar 5, 2018
@jeevatkm
Copy link
Member Author

jeevatkm commented Mar 8, 2018

@broklyngagah @eraac I have done my homework on following validation libraries.

I feel like second one is more flexible/extensible, what do you think of it?

I'm looking forward to your inputs.

@jeevatkm jeevatkm self-assigned this Mar 8, 2018
@jeevatkm
Copy link
Member Author

jeevatkm commented Mar 8, 2018

@broklyngagah @eraac After your inputs we can pick one library for integrating with aah framework.

@broklyngagah
Copy link

Hi @jeevatkm
Thanks for mentioning me. To be honest i have not use the second one. in my opinion for this package, it's easy to integrate and this package support for custom error message that you can integrate with multiple language. But it's up to you, i believe that both package is good enough for validation. :) How about you @eraac ?

@eraac
Copy link

eraac commented Mar 8, 2018

same here, i have already using go-playground/validator, it seems more simple to implement/use but maybe with less builtin validator. i18n and l10n is a real plus.

For me asaskevich/govalidator is probably more complete (for custom validation), but more complex too

@jeevatkm
Copy link
Member Author

jeevatkm commented Mar 9, 2018

@broklyngagah @eraac Thank you for your inputs. Let's keep it simple 😄

I will use https://github.com/go-playground/validator as a Validator for aah.


Also I have added the spec info above. Please have a look and let me know.

@jeevatkm
Copy link
Member Author

@jeevatkm jeevatkm moved this from v0.10 - In Progress to v0.10 - Completed in aah Roadmap Mar 13, 2018
@jeevatkm jeevatkm moved this from v0.10 - Completed to Released to Audience in aah Roadmap Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
aah Roadmap
  
Released to Audience
Development

No branches or pull requests

3 participants