Skip to content

Commit

Permalink
refactor(swagger): make eno url property optional
Browse files Browse the repository at this point in the history
  • Loading branch information
nsenave committed Feb 2, 2024
1 parent f6ce68c commit 2958230
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ public class OpenApiConfiguration {

@Bean
public OpenAPI customOpenAPI() {
Server server = new Server();
server.setUrl(enoUrl);
return new OpenAPI()
.addServersItem(server)
.info(new Info()
OpenAPI openAPI = new OpenAPI();
//
if (enoUrl != null && !enoUrl.isEmpty()) {
Server server = new Server();
server.setUrl(enoUrl);
openAPI.addServersItem(server);
}
//
openAPI.info(
new Info()
.title("Eno Web Service")
.description(
"<h2>Generator using:</h2>" +
Expand All @@ -55,6 +60,7 @@ public OpenAPI customOpenAPI() {
.version(enoVersion)
.license(new License().name("Apache 2.0").url("https://springdoc.org"))
);
return openAPI;
}

private static String descriptionEntry(String description, String version) {
Expand All @@ -67,7 +73,7 @@ private static String htmlLink(String url) {
return "<a href=\""+url+"\">"+url+"</a>";
}
private static String releaseNoteLink(String url) {
if (url == null || "".equals(url))
if (url == null || url.isEmpty())
return "";
return " " + "<i><a href=\""+url+"\" target=\"_blank\">(Release note)</a></i>";
}
Expand Down
2 changes: 1 addition & 1 deletion eno-ws/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ springdoc.swagger-ui.operationsSorter=alpha
### Customizable properties ###

# URL of the deployed web-service app (used for swagger config)
eno.ws.url=http://localhost:8080
eno.ws.url=

# URL of Eno release notes (displayed in swagger-ui documentation page)
eno.release.note.url=
Expand Down

0 comments on commit 2958230

Please sign in to comment.