【问题标题】:REST API - Swagger - Don't understand why "Not a valid parameter definition"REST API - Swagger - 不明白为什么“不是有效的参数定义”
【发布时间】:2017-09-02 14:51:29
【问题描述】:

我的招摇文件有问题:

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

这是我的问题:

✖ 招摇错误 不是有效的参数定义 跳转到第 20 行 细节 目的 代码:“ONE_OF_MISSING” 参数:数组 [0] 消息:“不是有效的参数定义” 路径:数组 [5] 0:“路径” 1:“/currencies/{currencieId}” 2:“得到” 3:“参数” 4:“0” schemaId: "http://swagger.io/v2/schema.json#" 内部:数组 [2] 等级:900 类型:“招摇错误” 描述:“不是一个有效的参数定义” 行号:20

Issue in swagger editor

我有点迷茫……

感谢您的帮助。

朱利安

【问题讨论】:

    标签: rest api swagger


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      allowMultiple: false 不正确

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-16
        • 1970-01-01
        • 1970-01-01
        • 2022-06-30
        • 1970-01-01
        相关资源
        最近更新 更多