"?-6ren"> "?-我正在尝试使用Swagger编辑器编写一个简单的Swagger/Open API定义。 swagger: "2.0" info: version: 1.0.0 title: Test API -6ren">
gpt4 book ai didi

Swagger参数错误 "is not exactly one from <#/definitions/parameter>"?

转载 作者:行者123 更新时间:2023-12-04 03:56:40 25 4
gpt4 key购买 nike

我正在尝试使用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示例,但是不确定为什么会得到这个。有任何想法吗?

最佳答案

主体参数使用schema关键字指定类型,因此您需要将typeitemsminItemsmaxItems移动到schema下。

另外,type: text也不是valid type。请改用type: string

      parameters:
- name: text
in: body
description: An array of text strings
schema:
type: array
minItems: 1
maxItems: 1000
items:
type: string

关于Swagger参数错误 "is not exactly one from <#/definitions/parameter>"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43592634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com