我有以下路线:/{collection_name}/data/{data_name}?{query}
例如:/cars/data/honda?user=abu&age=23
。
我接受{query}
中以&
分隔的任何查询。这意味着user
和age
不是内置选项,我只是将它们原样传递给数据库。我正在尝试使用Swagger,我所做的如下:
paths:
/{collection}/data/{data}:
get:
tags:
- "pet"
summary: "Returns all data"
description: "Returns all data"
operationId: "get"
produces:
- "application/json"
parameters:
- name: "collection"
in: "path"
description: "The name of the collection"
required: true
type: "string"
- name: "data"
in: "path"
description: "The name of the data"
required: true
type: "string"
- name: "query"
in: "query"
description: "Additional query to search"
required: false
type: "string"
collectionFormat: multi
responses:
"200":
description: "successful operation"
由于某种原因,它调用:/cars/data/honda?query=user=abu&age=23
而不是/cars/data/honda?user=abu&age=23
。此外,摇摇欲坠的UI允许在GUI中设置多个项目吗?我的意思是我希望查询有多个输入框。在每个框中,输入密钥和值。我该怎么做?试图从字符串转换为数组,但是我没有“有效”参数的列表,因为我们接受任何参数(这并不意味着它将在数据库中找到数据)。