定义 OpenAPI 2.0 返回未知类型的 JSON 对象

Opt*_*ion 3 openapi

我想描述返回未知/任何类型的 JSON 对象的 OpenAPI。

如果我在下面的 yaml 中定义返回类型,我仍然会看到生成的客户端仅返回原始字符串。

responses:
  200:
    description: Returns any JSON object
    schema:
      type: string
      format: object
Run Code Online (Sandbox Code Playgroud)

有没有办法将返回类型描述为 JSON 对象而不描述其架构?

Hel*_*len 5

任意对象定义为type: object,因此正确的定义是:

responses:
  200:
    description: Returns any JSON object
    schema:
      type: object
Run Code Online (Sandbox Code Playgroud)