Skip to content

Commit 985c4b3

Browse files
authored
[Ruby] fix port in the Ruby client (#7464)
* fix port in ruby client * use serverPort instead * update samples, skip if port is 80
1 parent a29d9a9 commit 985c4b3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,9 @@ private Map<String, Object> buildSupportFileBundle(List<Object> allOperations, L
775775
bundle.put("basePathWithoutHost", basePathWithoutHost);
776776
bundle.put("scheme", URLPathUtils.getScheme(url, config));
777777
bundle.put("host", url.getHost());
778+
if (url.getPort() != 80 ) {
779+
bundle.put("port", url.getPort());
780+
}
778781
bundle.put("contextPath", contextPath);
779782
bundle.put("apiInfo", apis);
780783
bundle.put("models", allModels);

modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module {{moduleName}}
9090

9191
def initialize
9292
@scheme = '{{scheme}}'
93-
@host = '{{host}}'
93+
@host = '{{host}}{{#port}}:{{{.}}}{{/port}}'
9494
@base_path = '{{contextPath}}'
9595
@api_key = {}
9696
@api_key_prefix = {}

0 commit comments

Comments
 (0)