2017-10-17 117 views
0

我的,看起来像这样的URL创建扬鞭文档:如何用名称但没有值定义查询参数?

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: 

回答

0

我在,你可以指定一个参数,那就是在“查询”的doc发现,但我敢肯定你得给它一个值(即:回调=真)

例子:

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 
+0

感谢.. @ Gremi64! – user78956

+0

如何添加服务和货币参数? – user78956

+0

一样: 参数: - 名称:回调 在:查询 类型:布尔 - 名称:服务 在:查询 类型:字符串 - 名称:货币 在:查询 类型:字符串 – Gremi64

相关问题