Swagger参数错误"不完全来自<#/ definitions / parameter>"?

时间:2017-04-24 15:53:06

标签: swagger

我尝试使用Swagger编辑器编写一个简单的Swagger / Open API定义。

swagger: "2.0"

info:
  version: 1.0.0
  title: Test API
  description: Test API

schemes:
  - https
host: hipaa.ai
basePath: /v1

paths:
  /comments:
    post:
      summary: Your comments
      description: Comments
      parameters:
      - name: text
        in: body
        description: An array of text strings
        type: array
        minItems: 1
        maxItems: 1000
        items:
          type: text

我收到以下错误:

Schema error at paths./comments.post.parameters[0]
is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>

我已经检查了Swagger模式参考和petstore示例,但我不确定为什么我会这样做。有什么想法吗?

1 个答案:

答案 0 :(得分:9)

正文参数使用schema关键字来指定类型,因此您需要在{{1}下移动typeitemsminItemsmaxItems }}

此外,schema不是valid type。请改用type: text

type: string
相关问题