New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Swagger error when specifying "file" as response type #260
Comments
There's a bug in the json schema which doesn't allow file as a response (and both swagger-tools and swagger-editor depend on it). There isn't an open issue about it yet, so let's keep it here (I have it in my own todo list). But to put your mind at ease - your declaration is indeed correct. If you have any suggestions on how to make the spec clearer with regards to it, I'd love the input. I'm in the process of adding the examples, clarifications, and fixing the json schema, so the feedback would be great at this point. |
Thanks. I think the spec is clear enough if it goes with an example. So my only suggestion would be to add an example, but I see that's already flagged as a TODO. |
Oops, sorry, I created an issue over there. Here's my example schema btw: swagger: '2.0'
info:
version: "0.0.0"
title: Example
paths:
/test:
get:
responses:
200:
description: OK
schema:
type: file This seems like the sort of bug that will affect virtually everybody. I'm currently working around it by deleting the schema from any routes that serve up files as responses. |
I created a pull request that should handle this. Not sure how to test it or try it in the editor though. |
@nickretallack - Thanks for the PR but I'm not going to merge it yet. Changing the schema is a bit delicate as it affects several tools, and I'm going to do a bulk update rather than several small ones. If you're looking to solve the issue for yourself for now, you should look into swagger-tools on which the editor depends on - @whitlockjc may be able to assist there. |
👍 on this - ran into it today and was like - of course it does "file" as a return type... nope... ended up on this thread - glad someone already submitted PR, next time you suck in changes in your batch, please do include this. :-) |
Is there any progress on this? "file" is still not supported. |
This should be fixed in the schema now. |
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 |
It will take a bit for the schema updates to propagate to the different projects. |
Ok thank you for the fast answer @webron, I can indeed totally live with(out) it for now :) sorry for the disturbance, I was assuming it was instantaneous |
While
The error:
Swagger Editor 2.10.2 |
Hi, this issue seems to be unsolved yet. Are there any plans to solve it? |
Why was this closed, even though it is not fixed? |
Because the issue with the schema has been resolved. Any outstanding issues with specific tools should be raised / followed up on the appropriate repositories. |
My API can return either JSON or compressed files. I set the following top-level
produces
spec:However, when on one of my endpoints I specify the following:
I get the following Swagger Error:
Validation error: enum
, with an error path pointing to thetype: 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?
The text was updated successfully, but these errors were encountered: