Skip to content

Fix Issue 7924 - Allow host and base path to be changed independently #7996

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

alango
Copy link

@alango alango commented Apr 10, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

@bbdouglas @JFCote @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger

Description of the PR

Fixes #7924
Separate the hostname and the base path so that they can be changed independently of one another

@alango
Copy link
Author

alango commented Apr 13, 2018

Tests seem to pass, so not sure what I've done to make the CI fail now... Is there anything else I need to do to move this forward? (not sure who to tag, @jeff9finger?)

@jeff9finger
Copy link

I like the concept. However, I think this would be more useful to provide more granularity here. Combining the schema, host and port into a property named "host" is a bit misleading. I'd like to see separate properties for schema, host, and port (or at least schema and host with the port combined with the host). An alternative would be to rename the property to something besides "host".

What does the community think?

@alango
Copy link
Author

alango commented Apr 17, 2018

Was erring on the side of making small changes, but agree it would make sense to split out the scheme as well and am happy to do that 🙂. (Alternatively, if there's already some precedent for this in swagger-codegen, then I'm also happy to follow that.)

@alango
Copy link
Author

alango commented Apr 17, 2018

Separated out the scheme, let me know if there's anything else you want from me.

@@ -53,7 +53,9 @@ import {{invokerPackage}}.auth.OAuth;

public class ApiClient {

private String basePath = "{{{basePath}}}";
private String scheme = "{{scheme}}";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this provide a default for "http" in a similar way that host does with "localhost"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand how this works correctly, then I believe this defaults to https if a scheme isn't specified (https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java#L98).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. that is correct. Thanks for pointing that out.

@jeff9finger
Copy link

Also, this seems useful for all the java client libraries. Would you consider adding it to the other Java client libraries?

@alango
Copy link
Author

alango commented Apr 18, 2018

My project happens to use this library so that's what I've been testing with. I'd rather not edit the other Java client libraries since there are at least some where it looks my change won't easily apply, and I don't want to touch more code that I don't have time to test right now!

Copy link

@jeff9finger jeff9finger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jeff9finger
Copy link

@alango I understand your time constraints. Thanks for the contribution.

@wing328 Can we put this request out to the community and see if someone else has time to add this to the other Java client libraries?

@alango
Copy link
Author

alango commented Apr 24, 2018

@jeff9finger Do you know if this is going to be merged soon, or are you planning to wait for the other libraries to be updated?

@jeff9finger
Copy link

@wing328 Can we go ahead and get this merged?

@alango
Copy link
Author

alango commented Jun 1, 2018

@wing328 bump?

@callmeberzerker
Copy link

Any updates?

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

Successfully merging this pull request may close these issues.

4 participants