Swagger参数错误“不完全是来自<#/definitions/parameter>"? [英] Swagger parameter error "is not exactly one from <#/definitions/parameter>"?
本文介绍了Swagger参数错误“不完全是来自<#/definitions/parameter>"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 Swagger 编辑器编写一个简单的 Swagger/Open API 定义.
I'm trying to write a simple Swagger / Open API definition using the Swagger Editor.
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 示例,但我不确定为什么我会得到这个.有什么想法吗?
I've checked the Swagger schema reference, and the petstore example, but I'm not sure why I'm getting this. Any ideas?
推荐答案
body参数使用schema
关键字来指定类型,所以需要移动type
,<schema
下的 code>items、minItems
和 maxItems
.
Body parameters use the schema
keyword to specify the type, so you need to move type
, items
, minItems
and maxItems
under schema
.
此外,type: text
不是 有效类型.使用 type: string
代替.
Also, type: text
is not a valid type. Use type: string
instead.
parameters:
- name: text
in: body
description: An array of text strings
schema:
type: array
minItems: 1
maxItems: 1000
items:
type: string
这篇关于Swagger参数错误“不完全是来自<#/definitions/parameter>"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文