Getting Swagger error when specifying "file" as response type
See original GitHub issueMy API can return either JSON or compressed files. I set the following top-level produces
spec:
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?
Issue Analytics
- State:
- Created 9 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Describing Responses - Swagger
To specify the response media types, use the content keyword at the operation level. ... For example, you can describe the conditions for...
Read more >Swagger editor is throwing error while specifying the response ...
I am trying to generate the API documentation using swagger editor. I specified my API specification as follow paths ...
Read more >Fix Swagger Validator errors in Power Platform connectors
The MIME type that you are trying to use isn't compatible with the content of your request in the specified operation.
Read more >Enriched Web API Documentation using Swagger/OpenAPI in ...
Update the controller actions to specify the possible response codes and their response types (if any) by using the response tag and the ......
Read more >Swagger: Specify Two Responses with the Same ... - Baeldung
The speed is an Integer. Using OpenAPI, these definitions correspond to the following description: Car: type: object properties: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why was this closed, even though it is not fixed?
I still get this error using editor.swagger.io:
And my schema file:
Should I do something in particular to benefit from the bugfix?
My current workaround is to use type string