Skip to content

Getting Swagger error when specifying "file" as response type #260

@cwarny

Description

@cwarny

My API can return either JSON or compressed files. I set the following top-level producesspec:

produces:
  - application/json
  - application/x-gzip

However, when on one of my endpoints I specify the following:

responses:
  "200":
    description: Success
      schema:
        type: file

I get the following Swagger Error: Validation error: enum, with an error path pointing to the type: file above.

The specs are not entirely clear to me as to how I should format an endpoint that returns a compressed file, but the above was the result of my understanding. Is this a bug or was my understanding incorrect? If the latter, could someone enlighten me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions