I am writing an API YAML that returns an MP3 file. I am not familiar with multimedia responses. While going through Google I found that I can use the audio/mp3 content type. But I couldn't find any example showing how to do it. How should I address this audio content type?
A binary file response is defined with just the media type and no schema:
openapi: 3.1.0
...
paths:
  /something:
    get:
      responses:
        '200':
          description: An audio file
          content:
            audio/mp3: {}
Files are defined as binary strings (type: string + format: binary):
openapi: 3.0.3
...
paths:
  /something:
    get:
      responses:
        '200':
          description: An audio file
          content:
            audio/mp3:
              schema:
                type: string
                format: binary
Binary file responses are defined with a type: file schema. Make sure to also specify the media type in the operation's produces list:
swagger: '2.0'
...
paths:
  /something:
    get:
      produces:
        - audio/mp3
      responses:
        200:
          description: An audio file
          schema:
            type: file
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With