【发布时间】:2019-04-12 06:37:30
【问题描述】:
我正在使用带有 OpenApi 3.0.2 规范的 swagger-ui。
我设置了一个包含多部分/表单数据内容的 requestBody。
当我执行来自 swagger-ui 的请求时,一切正常,但是...
如果我添加一个数组类型的参数,它将在 curl 调用中这样转换:-F "tags=my,tag"
我需要爆炸数组
-F 'tags[]=my' \
-F 'tags[]=tag'
我查看文档并找到一些样式和爆炸属性,但它们仅适用于参数属性,不适用于 requestBody (?)。
在我的路线文件中:
post:
tags:
- media-image
summary: Create a media image
requestBody:
description: A JSON object containing media image information
required: true
content:
multipart/form-data:
schema:
allOf:
- $ref: '../schemas/media-image-fillable.yaml'
- required:
- title
- back_office_title
- alt
- file
media-image-fillable.yaml
type: object
allOf:
- $ref: './media-image-base.yaml'
- properties:
file:
type: string
format: binary
tags:
type: array
items:
type: string
还有 media-image-base.yaml
type: object
properties:
title:
type: string
back_office_title:
type: string
description:
type: string
alt:
type: string
【问题讨论】:
-
您能发布您的 OpenAPI 定义文件吗?
-
好的,我发了,谢谢
标签: swagger-ui openapi