首页 > 解决方案 > Swagger - 如何在响应组件中定义 byte[][]

问题描述

如果我描述的是“公共字节 [] 数据”,我会这样做:

Data:
  type: string
  format: base64
  description: "The generated report as a single file in the user specified format. If this is populated Pages will be null."

但是我该如何描述像“public byte[][] Pages”这样的二维数组呢?

标签: swaggeropenapi

解决方案


通常多维数组用于请求组件,但对于响应组件,该数组将被展平为单个字节数组。

无论如何,您可以使用以下代码实现:

Data:
  type: array
  items:
    type: string
    format: base64
    description: "The generated report as a single file in the user specified format."

推荐阅读