我正在尝试访问类似于http://example.com/service1?q1=a&q2=b的网址。然而,q1 有时不会有任何与之关联的值,但需要访问服务 ( http://example.com/service1?q1=&q2=b )。我如何通过 swagger ui JSON 实现这一点?我尝试过使用 allowedEmptyValue 选项,但它似乎不起作用。
请在下面找到我尝试使用allowEmptyValue选项的示例JSON,
{
"path": "/service1.do",
"operations": [{
"method": "GET",
"type": "void",
"parameters": [{
"name": "q1",
"in" : "query",
"required": false,
"type": "string",
"paramType": "query",
"allowEmptyValue": true
},{
"name": "q2",
"in" : "query",
"required": true,
"type": "string",
"paramType": "query",
}
],
"responseMessages": [{
"code": 200,
"responseModel": "/successResponseModel"
}
}
Run Code Online (Sandbox Code Playgroud)
当将空值传递给 q1 时,swagger 将 URL 构造为http://example.com/service1?q2=b。无论如何,是否要在 URL 中包含带有空值的 q1 ( http://example.com/service1?q1=&q2=b ) ?
任何帮助将不胜感激。
我有一个接受数值的文本框.这是使用javascript处理的.我想禁用文本框的复制,粘贴和右键单击功能.任何帮助,将不胜感激.
@Html.TextBoxFor(model => model.Days, new { @class = "input_box", @id = "txtDays", @onkeydown = "javascript:NumberOnly(this,event)"})
Run Code Online (Sandbox Code Playgroud)