如何定义名称但没有值的查询参数?

时间:2017-10-17 07:38:53

标签: swagger swagger-2.0

我正在为这样的URL创建Swagger文档:

mysite.local.com/mylink?callback&service=someservicename&currency=USD

如您所见,查询字符串中的callback参数具有名称但没有值。如何在Swagger中描述此参数?

这是我正在使用的YAML代码:

swagger: "2.0"
info:
 title: My API
 description: Documentation of webservices Used
 version: 1.0.0

host: mysite.local.com
basePath: /
schemes:
 - https

paths:
 /mylink:
   get:
     summary: sometext
     description: Optional extended description in Markdown.
     produces:
       - application/json
     responses:
       200:
        description: OK
     parameters:
      callback:

1 个答案:

答案 0 :(得分:0)

我在doc中发现你可以指定“查询”中的参数,但我很确定你必须给它一个值(即:?callback = true)< / p>

示例:

paths:
 /mylink:
   get:
     summary: sometext
     description: Optional extended description in Markdown.
     produces:
       - application/json
     responses:
       200:
        description: OK
     parameters:
      - name: callback
        in: query
        type: boolean