2014-07-21 3 views
2

Foxx.Model의 허용되는 값을 지정하는 방법이 있습니까? 같은foxx 모델의 속성 옵션

뭔가 이상적 일 것이다 : 사전에

var ExampleModel = Foxx.Model.Extend({}, 
{ 
    attributes: { 
     field: { type: "string", required: true, values: ['one', 'two'] } 
    } 
}); 

감사합니다.

답변

5

이것은 ArangoDB의 마지막 릴리스 이후 가능합니다.

var Foxx = require("org/arangodb/foxx"); 
var joi = require("joi"); 

var ExampleModle = Foxx.Model.extend({ 
    schema: { 
    field: joi.string().required().valid(['one', 'two']) 
    } 
}); 

자세한 내용은 documentation of Joi를 참조하십시오 : 이제 다음을 수행 할 수 있도록은 integration of Joi into Foxx 있습니다.

+0

흥미 롭습니다. 정말 고마워요, 확실히 그럴 겁니다. –

+0

당신을 진심으로 환영합니다! – moonglum