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

编程入门 行业动态 更新时间:2024-10-24 18:22:31
本文介绍了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,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参数错误“不完全是来自&lt;#/definitions/parameter&gt;"?

本文发布于:2023-11-27 08:53:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637374.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不完全   错误   参数   amp   Swagger

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!