有没有办法指定Foxx.Model的可接受值?
像理想的东西:
var ExampleModel = Foxx.Model.Extend({},
{
attributes: {
field: { type: "string", required: true, values: ['one', 'two'] }
}
});
Run Code Online (Sandbox Code Playgroud)
提前致谢.
自从ArangoDB的最后一个版本发布以来,这是可能的.它将Joi集成到Foxx中,因此您现在可以执行以下操作:
var Foxx = require("org/arangodb/foxx");
var joi = require("joi");
var ExampleModle = Foxx.Model.extend({
schema: {
field: joi.string().required().valid(['one', 'two'])
}
});
Run Code Online (Sandbox Code Playgroud)