Fix port when the URL doesn't have port specified (#8049)

* fix port missingin oas 3 spec

* update samples
This commit is contained in:
William Cheng
2020-12-01 15:24:28 +08:00
committed by GitHub
parent adcf9ffa20
commit e040a5fdde
2 changed files with 2 additions and 2 deletions
@@ -769,7 +769,7 @@ 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 && url.getPort() != 443 ) {
if (url.getPort() != 80 && url.getPort() != 443 && url.getPort() != -1) {
bundle.put("port", url.getPort());
}
bundle.put("contextPath", contextPath);
@@ -139,7 +139,7 @@ module Petstore
def initialize
@scheme = 'http'
@host = 'petstore.swagger.io:-1'
@host = 'petstore.swagger.io'
@base_path = '/v2'
@server_index = 0
@server_operation_index = {}