diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index dbb263babdf..4ee200fc1a8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -775,6 +775,9 @@ public class DefaultGenerator implements Generator { bundle.put("basePathWithoutHost", basePathWithoutHost); bundle.put("scheme", URLPathUtils.getScheme(url, config)); bundle.put("host", url.getHost()); + if (url.getPort() != 80 ) { + bundle.put("port", url.getPort()); + } bundle.put("contextPath", contextPath); bundle.put("apiInfo", apis); bundle.put("models", allModels); diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache index 5e2f57980c4..ba9eda72eef 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache @@ -90,7 +90,7 @@ module {{moduleName}} def initialize @scheme = '{{scheme}}' - @host = '{{host}}' + @host = '{{host}}{{#port}}:{{{.}}}{{/port}}' @base_path = '{{contextPath}}' @api_key = {} @api_key_prefix = {}