本文介绍了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,
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>"?
发布评论