Skip to content
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

@Success/@Failure response_type should be optional #102

Open
tesujimath opened this issue Oct 30, 2015 · 4 comments
Open

@Success/@Failure response_type should be optional #102

tesujimath opened this issue Oct 30, 2015 · 4 comments

Comments

@tesujimath
Copy link

According to the Swagger 1.2 spec, section 5.2.5, the responseModel is not required.
https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md#525-response-message-object
However, here the markup is required to be {object} or {array}. Similarly for the response_data_type.

Currently for an operation which returns no data, I have to do something like this:

// @success 204 {object} bool "OK (no content)"

which is clearly a lie.

What I really ought to be able to do is something like this:

// @success 204 - - "OK (no content)"

Currently trying to do this generates the error message:

Can not parse comment for function: MyOperation, package: mypackage, got error: Can not parse response comment "204 - - "OK (no content)"", skipped.

A similar argument could be made for various other status codes, e.g. 404, surely nothing to return. In general, I would like complete flexibility to omit a response.

@yvasiyarov
Copy link
Owner

@tesujimath I've nothing against it. If you will send pull request, I will gladly accept it

@tesujimath
Copy link
Author

@yvasiyarov OK, I will get something together. I already found that #87 will block any effective testing of my changes, though. That one needs fixing urgently! (I already tried a trivial fix to the signature, but many parser tests continue to fail, and I'm not in a position to fix those.)

@tesujimath
Copy link
Author

Just to be clear, I won't be making a start on this until the parser tests are fixed. (It's not much fun working in a repo with broken tests.)

@tesujimath
Copy link
Author

OK, I've decided not to pursue this, sorry. I'm just going to use the native swagger tools directly, and not try to put the swagger markup in my Go source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants