diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 6ebeb01ac0d..738172cb80d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -114,6 +114,7 @@ private String getHost() { hostBuilder.append(swagger.getHost()); } else { hostBuilder.append("localhost"); + LOGGER.warn("'host' not defined in the spec. Default to 'localhost'."); } if (!StringUtils.isEmpty(swagger.getBasePath()) && !swagger.getBasePath().equals("/")) { hostBuilder.append(swagger.getBasePath()); diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml index cccb041601c..7a3a71c9bf0 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml @@ -9,7 +9,7 @@ info: license: name: Apache-2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' - host: petstore.swagger.io +host: petstore.swagger.io basePath: /v2 tags: - name: pet