forked from loafle/openapi-generator-original
fix base path when it's not defined in the spec (#678)
This commit is contained in:
parent
68d80ab67d
commit
01dbb8b693
@ -193,8 +193,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
URL url = URLPathUtils.getServerURL(openAPI);
|
||||
contextPath = config.escapeText(url.getPath());
|
||||
basePath = config.escapeText(URLPathUtils.getHost(openAPI));
|
||||
basePathWithoutHost = contextPath; // for backward compatibility
|
||||
basePath = config.escapeText(URLPathUtils.getHost(openAPI));
|
||||
if ("/".equals(basePath.substring(basePath.length() - 1))) {
|
||||
// remove trailing "/"
|
||||
// https://host.example.com/ => https://host.example.com
|
||||
basePath = basePath.substring(0, basePath.length() - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void configureOpenAPIInfo() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user