Update Go dependancies and fix a bug when walking file responses #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On behalf of the https://github.com/arabesque-sray:
This PR does two things:
Updating go dependancies
A lot of dependancies on this repo are obsolete and contain critical security issues. An example is the dependancy on
golang.org/x/net
which is totally removed after updating go.mod. This will dismiss #21Fix: Correct Logic for File-Type Response Indexing in Code Generation
Summary
We address a logic bug in the code generation process specifically for handling file responses. The logic flaw was causing a test (
TestDownloadImage
) withinupstream/master
to fail. After this fix, it runs successfully.Problem Description
Consider an OpenAPI specifications that returns multiple responses which at least one of them is a file operation:
In this example, two responses are defined:
200
, which is of typefile
.500
, meant for handling errors.Although the
200
response is listed first, when using the walkResponses method, it is walked second. This is due towalkResponses
deliberately processing file-type responses last to accommodate certain code generation requirements, such as addingdefer httpResponse.Body.Close()
after generating code for that response.However, the existing client generator incorrectly calculates the response index. In fact the code there effectively counts the number of file-type responses rather than their index.
Solution
Since
walkResponses
has a custom ordrering logic, it's best if the index is passed to the handler function as a parameter, which is the approach for this PR.