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

object validation #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

dehbmarques
Copy link

It's an object validation and sanitization for checkBody.

request.body: {
    prop: 'name',
    object: {
        property: 'property test',
        child: {
            property: 'child property test',
            child: {
                property: 'child property test'
            }
        }
    }
}
this.checkBody('name').notEmpty().len(3,20);
this.checkBody('object.property').notEmpty().len(3,20);
this.checkBody('object.child.property').notEmpty().len(3,20);

Also, this.body = this.errors; at line 198 was causing an error when running tests.
The next line returns this.body = 'ok';, so I commented the first one.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) when pulling 55f6ee3 on dehbmarques:feat into 64e41a3 on RocksonZeta:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) when pulling 95262f3 on dehbmarques:feat into 53dfc78 on RocksonZeta:master.

@whatyoubendoing
Copy link

👍 is there an easy way we can get this to support objects in arrays. This is by far the cleanest validation library out there for KOA.

@danneu
Copy link

danneu commented Jan 22, 2015

+1 Nice idea

@AJCStriker
Copy link

Is there any progress with this being merged?

@brasilikum
Copy link

  • 1 for merging this

@paambaati
Copy link

+1 for merging this.

@whatyoubendoing
Copy link

@dehbmarques are you able to merge the most recent master into your feat branch? Might make this a little more easier for @RocksonZeta to update.

@dehbmarques
Copy link
Author

@B3njamin, merged 👍

@hyzhak
Copy link

hyzhak commented Mar 6, 2016

very useful feature 👍

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.

8 participants