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 27d6c76234cc..e63a9716bb99 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 @@ -769,7 +769,7 @@ private Map buildSupportFileBundle(List allOperations, L bundle.put("basePathWithoutHost", basePathWithoutHost); bundle.put("scheme", URLPathUtils.getScheme(url, config)); bundle.put("host", url.getHost()); - if (url.getPort() != 80 && url.getPort() != 443 ) { + if (url.getPort() != 80 && url.getPort() != 443 && url.getPort() != -1) { bundle.put("port", url.getPort()); } bundle.put("contextPath", contextPath); diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb index bb6e151713ba..1658f8a311f8 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb @@ -139,7 +139,7 @@ class Configuration def initialize @scheme = 'http' - @host = 'petstore.swagger.io:-1' + @host = 'petstore.swagger.io' @base_path = '/v2' @server_index = 0 @server_operation_index = {}