【发布时间】:2021-06-14 19:59:04
【问题描述】:
我有一个要在 openapi 3.0 (.yml) 中指定的 api
我很难指定一个可选的过滤器参数。特别是对于 featureId 的动态键。我看了看:https://swagger.io/docs/specification/data-models/dictionaries/
featureId 如下所示:dws33231j featureId 对象的数量可能会有所不同
我的数据结构:
[
"featureId1" => [
"selectedOption1",
"selectedOption2"
],
"featureId2" => [
"selectedOption8"
],
...
]
curl 应如下所示:https://path/articles&filter[featureId1]=selectedOption1,selectedOption2,selectedOption6&filter[featureId2]=selectedOption8'
到目前为止,我有这个,这离正确的很远。如何指定动态键?
components:
parameters:
filter:
name: filter
in: query
style: deepObject
allowReserved: true
description:
schema:
$ref: "#/components/schemas/filter"
schemas:
filter:
type: object
properties:
featureId1:
description: id of the feature
type: array
items:
type: string
example: [selectedOption1, selectedOption2, selectedOption6]
【问题讨论】:
标签: filter openapi query-parameters