Skip to content

Returning StreamedFile does not fulfill OpenAPI specs #441

@debuglevel

Description

@debuglevel

A controller function returning a StreamedFile does not generate a OpenAPI.yml according to the OpenAPI 3.0 specs. It instead describes the fields etc of the StreamedFile class.

Steps to Reproduce

    @Produces("application/pdf")
    @Get("/{documentId}")
    fun getOne(documentId: UUID): HttpResponse<StreamedFile> {
        [...]

Expected Behaviour

The OpenAPI Specs specifies files like this:

  /v1/documents/{documentId}:
    get:
      [...]
      default:
        description: getOne default response
        content:
          application/pdf:
            schema:
              type: string
              format: binary

Actual Behaviour

The code above produces this OpenAPI.yml

  /v1/documents/{documentId}:
    get:
      [...]
      responses:
        default:
          description: getOne default response
          content:
            application/pdf:
              schema:
                $ref: '#/components/schemas/StreamedFile'

Environment Information

  • Micronaut Version: 2.1
  • JDK Version: 1.8

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions