如何在OpenApi Swagger 3.0中获得图像响应
我有一个端点,它返回一个图像作为响应,我希望swagger文档返回并在框架内显示图像。 我查看了文档并尝试了所有三个示例,但都没有成功。 我在尝试不可能的事情吗 这是我的例子如何在OpenApi Swagger 3.0中获得图像响应,swagger,openapi,Swagger,Openapi,我有一个端点,它返回一个图像作为响应,我希望swagger文档返回并在框架内显示图像。 我查看了文档并尝试了所有三个示例,但都没有成功。 我在尝试不可能的事情吗 这是我的例子 paths: "/qrcodes/{string_to_encode}": get: tags: - QR Code summary: A QR code generation endpoint parameters: -
paths:
"/qrcodes/{string_to_encode}":
get:
tags:
- QR Code
summary: A QR code generation endpoint
parameters:
- name: string_to_encode
in: path
required: true
description: URL encoded string to convert to a QR code
schema:
type: string
responses:
'200':
description: OK
content:
application/png:
schema:
type: string
format: binary
生成的curl还警告二进制输出将
application/png
更改为image/png
。除此之外,你的定义是正确的