triAGENS/ArangoDB — pull request #932 by pluma (2014-07-07 16:35:20+00:00)
Title: [WIP] Use Joi for model validation

I've implemented the Joi-based model validation for Foxx models.

@moonglum: Minor change from the original concept: for models I've used this syntax:

```js
Model.extend({}, {
attributes: {
name: joi.string().required()
}
});
```

instead of this:

```js
Model.extend({}, {
attributes: {
name: {
type: joi.string().required()
}
}
});
```

I think this makes the syntax a bit terser and we can use `joi.description(str)`, `joi.meta(obj)` and `joi.notes(str)` if we want to add metadata. Also, it could improve interoperability with other environments using Joi, like [Hapi](https://github.com/spumko/hapi).

If you prefer the original syntax, that should be relatively trivial to change.

Joi needs `net.isIPv4` and `net.isIPv6` to work properly (as well as being able to require `sys` although it isn't actually used -- looks like a subtle bug). @fceller thinks we can lift their implementations from node/libuv, so I've just stubbed them out for now. We should wait with merging this branch until that has been sorted out.