![](/img/trans.png)
[英]Swagger editor says: is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>
[英]Swagger parameter error “is not exactly one from <#/definitions/parameter>”?
我正在嘗試使用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示例,但我不知道為什么我會得到這個。 有任何想法嗎?
Body參數使用schema
關鍵字指定類型,因此您需要在schema
下移動type
, items
, minItems
和maxItems
。
另外, type: text
不是有效類型 。 請改用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.