Skip to content

Commit e040a5f

Browse files
authored
Fix port when the URL doesn't have port specified (#8049)
* fix port missingin oas 3 spec * update samples
1 parent adcf9ff commit e040a5f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ private Map<String, Object> buildSupportFileBundle(List<Object> allOperations, L
769769
bundle.put("basePathWithoutHost", basePathWithoutHost);
770770
bundle.put("scheme", URLPathUtils.getScheme(url, config));
771771
bundle.put("host", url.getHost());
772-
if (url.getPort() != 80 && url.getPort() != 443 ) {
772+
if (url.getPort() != 80 && url.getPort() != 443 && url.getPort() != -1) {
773773
bundle.put("port", url.getPort());
774774
}
775775
bundle.put("contextPath", contextPath);

samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class Configuration
139139

140140
def initialize
141141
@scheme = 'http'
142-
@host = 'petstore.swagger.io:-1'
142+
@host = 'petstore.swagger.io'
143143
@base_path = '/v2'
144144
@server_index = 0
145145
@server_operation_index = {}

0 commit comments

Comments
 (0)