Swagger YAML查询(类型对象)参数定义错误
我得到以下错误: 路径处的架构错误。/cards/count.get.parameters[0]不完全正确 一个来自 以下是我的定义:Swagger YAML查询(类型对象)参数定义错误,swagger,swagger-ui,swagger-2.0,swagger-editor,swagger-codegen,Swagger,Swagger Ui,Swagger 2.0,Swagger Editor,Swagger Codegen,我得到以下错误: 路径处的架构错误。/cards/count.get.parameters[0]不完全正确 一个来自 以下是我的定义: /cards/count: get: tags: - "cards" summary: "Number of Cards available" description: "Excludes cards which the user has answered correctly in the past."
/cards/count:
get:
tags:
- "cards"
summary: "Number of Cards available"
description: "Excludes cards which the user has answered correctly in the past."
operationId: "countCards"
produces:
- "application/json"
parameters:
- name: "tagFilter"
in: "query"
description: "Input is optional - left blank will return all tags and a count"
type: "object"
properties:
tags_any:
type: "array"
items:
type: "integer"
format: "int64"
enum: [1,2,3]
tags_all:
type: "array"
items:
type: "integer"
format: "int64"
enum: [4,5,6]
tags_not:
type: "array"
items:
type: "integer"
format: "int64"
enum: [4,5,6]
我理解您不能根据以下问题使用架构定义:
我需要修改什么才能使YAML编译无误?查询参数中的对象在OpenAPI/Swagger 2.0中不受支持,但在OpenAPI 3.0中受支持 如果坚持使用OpenAPI 2.0,则需要将对象拆分为单独的参数,如下所示:
参数:
-in:查询
姓名:tags_any
类型:数组
项目:
类型:整数
格式:int64
枚举:[1,2,3]
-in:查询
姓名:tags_all
类型:数组
项目:
类型:整数
格式:int64
枚举:[4,5,6]
-in:查询
姓名:tags_not
类型:数组
项目:
类型:整数
格式:int64
枚举:[4,5,6]
在OpenAPI3.0中,可以将参数定义为object,并使用关键字指定该对象的序列化方式
参数:
-名称:标记过滤器
in:查询
说明:输入是可选的-留空将返回所有标记和计数
#将对象作为?prop1=value1&prop2=value2发送
#这是查询参数中对象的默认序列化方法
风格:形式
爆炸:真的
模式:
类型:对象
特性:
任何标签:
类型:数组
项目:
类型:整数
格式:int64
枚举:[1,2,3]
所有标签:
类型:数组
项目:
类型:整数
格式:int64
枚举:[4,5,6]
标签不包括:
类型:数组
项目:
类型:整数
格式:int64
枚举:[4,5,6]
是否可以在Swaggerhub中使用OpenAPI3?@AllanBowe目前没有,但我假设它在路线图上。UPD:Swaggerhub现在。