# Aurelia validation - notation (res :Class) =\> res.property

**URL:** <https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931>\
**Category:** Help Requests\
**Created:** [March 20, 2018, 12:42pm UTC](https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931 "2018-03-20T12:42:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyrog](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lyrog](https://discourse.aurelia.io/u/lyrog)\
**Post date:** [March 20, 2018, 12:42pm UTC](https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931/1 "2018-03-20T12:42:01Z")

</div>

Hello,  
i follow manual : [Validation | Aurelia](http://aurelia.io/docs/plugins/validation)  
and in section multiple validation controllers is used notation:  
(res: ItalianRestaurant) =\> res.pizza

> const pizzaRules = ValidationRules  
> .ensure((res: ItalianRestaurant) =\> res.pizza).required()  
> .rules;

in my new fresh app (Es2015, babel, cli, webpack )  
i cant use this notation . I 've got error:

> Module build failed: SyntaxError: Unexpected token, expected ,

generally speaking where is a problem ? 🙂

btw. when i use direct property validation like this:

> ValidationRules.ensure(this.institution.user.password).required().rules;  
> validation “work” and i got error but when field is not empty i still got error ?  
> it’s weired

---

<div class="post-metadata">

**Author:** ![tbnovaes](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/tbnovaes/32/147_2.png) [@tbnovaes](https://discourse.aurelia.io/u/tbnovaes)\
**Post date:** [March 20, 2018, 1:48pm UTC](https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931/2 "2018-03-20T13:48:21Z")

</div>

if you are using babel as transpiler, it means you are writing code in ESNext not in TypeScript, so `res: ItalianRestaurant` should not be a valid syntax since JS do not allow us to explicitly tell the data type.

try:

```auto
const pizzaRules = ValidationRules
.ensure(res => res.pizza).required()
.rules;

```

---

<div class="post-metadata">

**Author:** ![Alexander-Taran](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/alexander-taran/32/2308_2.png) [@Alexander-Taran](https://discourse.aurelia.io/u/Alexander-Taran)\
**Post date:** [March 20, 2018, 2:08pm UTC](https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931/3 "2018-03-20T14:08:29Z")

</div>

@lyrog please ensure you have dependencies updated  
there is currently an investigation of issue with npm updating the dependencies

> <https://github.com/aurelia/validation/issues/350>

latest aurelia-validation requires aurelia-binding: ^1.7.1

seems like npm ugrade does not do the right job

---

<div class="post-metadata">

**Author:** ![lyrog](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lyrog](https://discourse.aurelia.io/u/lyrog)\
**Post date:** [March 20, 2018, 3:04pm UTC](https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931/4 "2018-03-20T15:04:44Z")

</div>

Tahnks.  
You are right. There is mistake in mentioned documentation.

---

<div class="post-metadata">

**Author:** ![lyrog](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lyrog](https://discourse.aurelia.io/u/lyrog)\
**Post date:** [March 20, 2018, 3:10pm UTC](https://discourse.aurelia.io/t/aurelia-validation-notation-res-class-res-property/931/5 "2018-03-20T15:10:00Z")

</div>

It was long fight 🙂 but at least i find out, if I need to validate property of nested class i nedd to use special syntax :  
for **this.institution.user.email**  
i nedd to use validation like that

> ValidationRules  
> .ensure(‘email’).email().required()  
> .on(User);
