5
有没有一种形式可以让回送自动验证远程方法中的输入参数?环回远程方法:参数验证
假设我们有一个远程方法的定义如下:
WebuserModel.remoteMethod('overLogin', {
description: "Performs a Webuser's login to the system",
accepts: [
{
arg: 'credentials', type: {
"username": { type: "string", required:true },
"password": { type: "string", required: true }
},
http: {source: 'body'},
required: true
},
],
returns: {arg: 'accesToken', type: "object", root: true},
http: {path: '/login', verb: 'post'}
}
我会在这里从环回期望对每个请求执行输入参数的验证,如果传递的对象不会引发错误遵守定义的模式(具有两个强制性属性的强制对象)。
显然它没有发生。 任何线索?
好问题,我不确定它是否在嵌套对象上,请求一些澄清[这里](https://github.com/strongloop/strong-remoting/issues/387) – Overdrivr