-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[Go][Client] Use configured scheme in requests #2947
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
Conversation
CI reports the following issues:
Please take a look when you've time. |
I've update the PR, and I've made a further change; After reading the documentation surrounding the use of This fixes the behavior to overwrite the host in the parsed URL before the request is created. References: http.Request documentation: https://golang.org/pkg/net/http/#Request |
Got the following new errors instead:
|
671f5e6
to
abda180
Compare
Thanks for following up @wing328, I've updated the tests, I think the existing test was actually never going to work if the Host was working properly (:thinking:). I've also refactored the tests to prevent them from panicking in the future. I rebased the commits so that the first one regenerates the existing clients (since they were stale), so my changes are in commit 2 and 3. |
9cd245f
to
e4ac5c1
Compare
Not sure why the tests failed... they shouldn't be running against |
@wing328 could you trigger a rerun of the tests? I don't know if they ran against the tip of the branch. |
Wait, I don't understand the last test failure at all 🤔 |
9ac73f4
to
b8ac09e
Compare
Previously we did not interrupt execution of a test case when an error was returned from an API call. This was causing the tests to crash as soon as we try to dereference the response. We now fail the tests as soon as the first API error is received.
Previously we were simply setting the Host header and completely ignoring the configured scheme. Fixes OpenAPITools#2943
Rebased on master. Again, the meat of this change is here: fc3d0f4. |
I think the tests are failing because a change was merged that didn't regenerate all the appropriate files. I'll dig into it a bit. |
Yep, #3028 did not regenerate the pet store, and it is now failing because of it. |
Taking a look too... |
I can include the fix in this PR, no problems. |
@johanbrandhorst I would suggest merging the latest master, which includes some changes to the Go generator, before updating the samples. |
I've rebased this on latest master. The latest master is bugged, the generated files from |
But the tests (including Petstore) passed ... |
That's because the petstore was not regenerated with the new |
The strings package is still used for replacing strings in some places.
We also have a script to ensure the Go petstore client is up-to-date. Let me double check on that. |
I've pushed an update to the |
I ran
|
I would recommend you create a new branch based on the latest master instead. |
Look, I will create another branch to really prove it to you, but you don't even need to regenerate the files to see the problem. Look at https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/go/api.mustache, which is the master version. It does not import "strings", but on line 84 we can see:
This is trivially going to cause a compilation error. I don't know why your files aren't being generated, but feel free to compare the master version of This is still importing |
The hardcode import of |
Reviewing the recent changes related to the Go client geneator may help : https://github.com/OpenAPITools/openapi-generator/pulls?utf8=%E2%9C%93&q=is%3Amerged+is%3Apr+label%3A%22Client%3A+Go%22+ |
Removing the hardcoded import of |
@mcristina422 Can you weigh in on this? |
I think the CI tests will pass with my recent change, and if they don't, it will probably be because there are others parts that haven't been regenerated. |
I saw this change, but it's irrelevant, because this should always be imported, as is evident by the mustache file I linked. The |
Ref: https://circleci.com/gh/OpenAPITools/openapi-generator/7117#queue-placeholder/containers/1 Again I would suggest you start a new branch based on the latest master instead. |
That is incorrect. That's why there is an explicit check for I believe if you just rebase on master and add your scheme changes everything should test fine |
I was misled by old artifacts, I had to run |
Ensure the
Scheme
option in the configuration is used.Fixes #2943
PS. I ran
./bin/go-petstore.sh
,./bin/go-petstore-withxml.sh
and./bin/openapi3/go-petstore.sh
. I assume the large amount of changes in the openapi3 directory is because it was slightly stale prior to my change.@antihax @bvwells @grokify @kemokemo