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 #47

Closed
PHILLIPS71 opened this issue Dec 20, 2016 · 2 comments
Closed

Validation #47

PHILLIPS71 opened this issue Dec 20, 2016 · 2 comments

Comments

@PHILLIPS71
Copy link

I've been playing around with validation for most of the inputs that are going through mongoose, I'm just wondering if there is going to be at any time some built in validation within the service? That being a lot quicker since some of it would already be generated, or it being simpler to implement.

@diegohaz
Copy link
Owner

Can you give me examples of validations you are doing so I can understand better?

For the question, I don't plan to add more customization options to the generator. In fact, I want to make it simpler (see #32 (comment)).

@PHILLIPS71
Copy link
Author

PHILLIPS71 commented Dec 20, 2016

I haven't got too far with it I'm currently using node-mongoose-validator where in your schemas you can add the validation quite easily.

userSchema.path('username').validate(validator.matches('^[a-zA-Z0-9_-]{3,15}$'), 'Please provide a valid username');

userSchema.path('email').validate(validator.isEmail(), 'Please provide a valid email address');

The only real task is change over all the http status codes so that they don't throw an internal error where validation is not met and to throw bad requests instead. Or does bodymen do all this for us?

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

No branches or pull requests

3 participants