use of jetbrains.buildServer.serverSide.SBuildServer in project teamcity-rest by JetBrains.
the class SwaggerConfigImpl method configure.
public Swagger configure(final Swagger swagger) {
if (swagger == null)
return null;
Info info = swagger.getInfo();
if (info == null) {
info = new Info();
}
final SBuildServer server = myDataProvider.getServer();
try {
final URL url = new URL(server.getRootUrl());
swagger.setHost(getHostAndPort(url));
} catch (MalformedURLException e) {
LOG.warnAndDebugDetails("Failed to configure swagger with server url", e);
}
info.setTitle("TeamCity REST API");
final String version = myDataProvider.getPluginInfo().getParameterValue("api.version");
if (!StringUtil.isEmptyOrSpaces(version)) {
info.setVersion(version);
} else {
info.setVersion("" + server.getVersion().getDisplayVersionMajor() + "." + server.getVersion().getDisplayVersionMinor());
}
swagger.setInfo(info);
return swagger;
}
Aggregations