REST API - Swagger - 不明白为什么“不是有效的参数定义”

时间:2017-04-07 09:22:25

标签: rest api swagger

我的招摇文件面临问题:

swagger: '2.0'
paths:
  /currencies:
    get:
      responses:
        '200':
          description: ''
      summary: 'list currencies summary'
      x-auth-type: None
      x-throttling-tier: Unlimited
      produces:
        - application/json
      description: 'list currencies description'
  '/currencies/{currencieId}':
    get:
      responses:
        '200':
          description: ''
      description: 'Single currency description'
      parameters:
        - name: currencieId
          in: path
          allowMultiple: false
          required: true
          type: string
          description: 'paramter description'
      summary: 'Single currency'
      x-auth-type: None
      x-throttling-tier: Unlimited
      produces:
        - application/json
info:
  title: MDM
  version: v1

这是我的问题:

✖Swagger错误 不是有效的参数定义 跳到第20行 细节  宾语 代码:“ONE_OF_MISSING”  参数:数组[0] 消息:“不是有效的参数定义”  路径:数组[5] 0:“路径” 1:“/ currency / {currencieId}” 2:“得到” 3:“参数” 4:“0” schemaId:“http://swagger.io/v2/schema.json#”  内部:数组[2] 等级:900 类型:“Swagger错误” description:“不是有效的参数定义” lineNumber:20

Issue in swagger editor

我有点失落......

感谢您的帮助。

于连

2 个答案:

答案 0 :(得分:2)

allowMultiple: false参数的定义中删除currencieId。这消除了错误。

OpenAPI (fka Swagger) Specification 2.0中不存在allowMultiple关键字。它在v1.2中使用,但在2.0中,它已替换为type: arraycollectionFormat

答案 1 :(得分:0)

allowMultiple:false不正确