[英]Swagger parameter error “is not exactly one from <#/definitions/parameter>”?
I'm trying to write a simple Swagger / Open API definition using the Swagger Editor. 我正在尝试使用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
I'm getting the following error: 我收到以下错误:
Schema error at paths./comments.post.parameters[0]
is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>
I've checked the Swagger schema reference, and the petstore example, but I'm not sure why I'm getting this. 我已经检查了Swagger架构参考和petstore示例,但我不知道为什么我会得到这个。 Any ideas?
有任何想法吗?
Body parameters use the schema
keyword to specify the type, so you need to move type
, items
, minItems
and maxItems
under schema
. Body参数使用
schema
关键字指定类型,因此您需要在schema
下移动type
, items
, minItems
和maxItems
。
Also, type: text
is not a valid type . 另外,
type: text
不是有效类型 。 Use type: string
instead. 请改用
type: string
。
parameters:
- name: text
in: body
description: An array of text strings
schema:
type: array
minItems: 1
maxItems: 1000
items:
type: string
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.