gpt4 book ai didi

swagger - Swagger 中带有逗号分隔字符串的查询参数返回结构错误

转载 作者:行者123 更新时间:2023-12-04 11:27:26 38 4
gpt4 key购买 nike

我试图在 Swagger 中定义一个查询参数,其中包含来自预定义项目集的逗号分隔字符串,例如 ?fruits=Apples,Oranges,Bananas但我从 swagger 编辑器收到以下错误

should NOT have additional properties additionalProperty: style, explode



我在 Swagger 编辑器中尝试的是:
    - in: query
name: fruits
style: form
explode: true
required: false
description: Filter by fruits
type: array
items:
type: string
enum:
- Apples
- Oranges
- Bananas

最佳答案

styleexplode是 OpenAPI 3.0 关键字。但是您似乎在使用 OpenAPI 2.0,它使用 collectionFormat 反而。在这种情况下,您需要 collectionFormat: csv (这是默认选项,可以省略)。

关于swagger - Swagger 中带有逗号分隔字符串的查询参数返回结构错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56185192/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com