Skip to content

object validation#1

Open
dehbmarques wants to merge 5 commits into
RocksonZeta:masterfrom
dehbmarques:feat
Open

object validation#1
dehbmarques wants to merge 5 commits into
RocksonZeta:masterfrom
dehbmarques:feat

Conversation

@dehbmarques

Copy link
Copy Markdown

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
Copy Markdown

Coverage Status

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

@coveralls

Copy link
Copy Markdown

Coverage Status

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

@whatyoubendoing

Copy link
Copy Markdown

👍 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

danneu commented Jan 22, 2015

Copy link
Copy Markdown

+1 Nice idea

@AJCStriker

Copy link
Copy Markdown

Is there any progress with this being merged?

@brasilikum

Copy link
Copy Markdown
  • 1 for merging this

@paambaati

Copy link
Copy Markdown

+1 for merging this.

@whatyoubendoing

Copy link
Copy Markdown

@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
Copy Markdown
Author

@B3njamin, merged 👍

@hyzhak

hyzhak commented Mar 6, 2016

Copy link
Copy Markdown

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