diff --git a/NOTICE b/NOTICE index 9c310a82e2f40be802d33c0e4176cc8a0f7e0741..7c18c243f76ab90d6d670b0d8d736b223eecf0d9 100644 --- a/NOTICE +++ b/NOTICE @@ -93,9 +93,9 @@ The following software have components provided under the terms of this license: - GSON extensions to the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-gson) - Google APIs Client Library for Java (from https://repo1.maven.org/maven2/com/google/api-client/google-api-client) - Google App Engine extensions to the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-appengine) -- Google Cloud Core (from https://github.com/googleapis/google-cloud-java, https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-core, https://github.com/googleapis/java-core) -- Google Cloud Core HTTP (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core-http, https://github.com/googleapis/google-cloud-java, https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-core-http, https://github.com/googleapis/java-core) -- Google Cloud Core gRPC (from https://github.com/googleapis/google-cloud-java, https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-core-grpc, https://github.com/googleapis/java-core) +- Google Cloud Core (from https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-core, https://github.com/googleapis/java-core, https://repo1.maven.org/maven2/com/google/cloud/google-cloud-core) +- Google Cloud Core HTTP (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core-http, https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-core-http, https://github.com/googleapis/java-core, https://repo1.maven.org/maven2/com/google/cloud/google-cloud-core-http) +- Google Cloud Core gRPC (from https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-core-grpc, https://github.com/googleapis/java-core, https://repo1.maven.org/maven2/com/google/cloud/google-cloud-core-grpc) - Google Cloud Datastore (from https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-datastore, https://github.com/googleapis/java-datastore) - Google Cloud IAM Service Account Credentials (from https://github.com/googleapis/google-cloud-java, https://github.com/googleapis/java-iamcredentials) - Google Cloud Logging (from https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-logging, https://github.com/googleapis/java-logging) @@ -389,7 +389,6 @@ The following software have components provided under the terms of this license: - Protocol Buffers [Util] (from https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util) - RE2/J (from http://github.com/google/re2j) - Redisson (from http://redisson.org) -- SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org, https://bitbucket.org/snakeyaml/snakeyaml) - Spring Core (from http://www.springframework.org, https://github.com/spring-projects/spring-framework, https://repo1.maven.org/maven2/org/springframework/spring-core) - ThreeTen backport (from https://github.com/ThreeTen/threetenbp, https://www.threeten.org/threetenbp) @@ -506,7 +505,6 @@ The following software have components provided under the terms of this license: - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) -- SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org, https://bitbucket.org/snakeyaml/snakeyaml) ======================================================================== EPL-2.0 @@ -542,13 +540,6 @@ The following software have components provided under the terms of this license: - RabbitMQ Java Client (from http://www.rabbitmq.com, https://www.rabbitmq.com) - tomcat-embed-core (from http://tomcat.apache.org/) -======================================================================== -GPL-2.0-or-later -======================================================================== -The following software have components provided under the terms of this license: - -- SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org, https://bitbucket.org/snakeyaml/snakeyaml) - ======================================================================== GPL-2.0-with-classpath-exception ======================================================================== @@ -625,7 +616,6 @@ The following software have components provided under the terms of this license: - Java Native Access (from https://github.com/java-native-access/jna, https://github.com/twall/jna) - Java Native Access Platform (from https://github.com/java-native-access/jna) - Javassist (from http://www.javassist.org/) -- SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org, https://bitbucket.org/snakeyaml/snakeyaml) ======================================================================== MIT diff --git a/README.md b/README.md index 39e9ca1d697f42bc9eba73e035ee4f48926ddbb0..363518d2e945eb1a0d5ef66d17a9d31440c52823 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,13 @@ server.servlet.contextPath=/ server.port=8080 ``` +## Open API 3.0 - Swagger +- Swagger UI : https://host/context-path/swagger (will redirect to https://host/context-path/swagger-ui/index.html) +- api-docs (JSON) : https://host/context-path/api-docs +- api-docs (YAML) : https://host/context-path/api-docs.yaml + +All the Swagger and OpenAPI related common properties are managed here [swagger.properties](./notification-core/src/main/resources/swagger.properties) + # new update ## AWS diff --git a/notification-core/pom.xml b/notification-core/pom.xml index 4ef452231e2b23784832dd13de43ff0f81bf9d2f..a36b589e43b9fce28afd5062b4746ffb8350337a 100644 --- a/notification-core/pom.xml +++ b/notification-core/pom.xml @@ -35,7 +35,6 @@ <java.version>8</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> - <springfox-version>2.7.0</springfox-version> <netty.version>4.1.70.Final</netty.version> <undertow.version>2.2.19.Final</undertow.version> <woodstox-core.version>5.3.0</woodstox-core.version> diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/api/GlobalErrorController.java b/notification-core/src/main/java/org/opengroup/osdu/notification/api/GlobalErrorController.java index 3af29b979609c7c2487f4dbeead3bde7a0030c24..52aa9b1da5f6ce07d90443c00a6f5f04e0f7d540 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/api/GlobalErrorController.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/api/GlobalErrorController.java @@ -16,15 +16,21 @@ package org.opengroup.osdu.notification.api; -import org.opengroup.osdu.core.common.model.http.RequestInfo; -import org.springframework.beans.factory.annotation.Autowired; +import io.swagger.v3.oas.annotations.Hidden; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; +@Hidden @RequestMapping("/error") @Controller public class GlobalErrorController implements ErrorController { diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/api/HealthChecksApi.java b/notification-core/src/main/java/org/opengroup/osdu/notification/api/HealthChecksApi.java index c518c027b4418ce36dab65ac3c74cb58b61e28a1..64d5581706c05ab3dd818c1ae1e3e266cb5a5170 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/api/HealthChecksApi.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/api/HealthChecksApi.java @@ -16,6 +16,12 @@ package org.opengroup.osdu.notification.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -23,8 +29,14 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/_ah") +@Tag(name = "health-checks-api", description = "Health Checks API") public class HealthChecksApi { + @Operation(summary = "${healthChecksApi.warmup.summary}", + description = "${healthChecksApi.warmup.description}", tags = { "health-checks-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { @Content(schema = @Schema(implementation = String.class)) }) + }) @GetMapping("/warmup") public ResponseEntity warmup() { return ResponseEntity.ok().build(); diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/api/InfoApi.java b/notification-core/src/main/java/org/opengroup/osdu/notification/api/InfoApi.java index 2df52563f2c31b62d4056eb8884eb78d42df0b7d..a06c281b35f3dc6e14fd7606f1abb6b0892443fe 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/api/InfoApi.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/api/InfoApi.java @@ -18,6 +18,13 @@ package org.opengroup.osdu.notification.api; import java.io.IOException; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import org.opengroup.osdu.core.common.info.VersionInfoBuilder; import org.opengroup.osdu.core.common.model.info.VersionInfo; import org.springframework.beans.factory.annotation.Autowired; @@ -28,11 +35,16 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping +@Tag(name = "info", description = "Version info endpoint") public class InfoApi { @Autowired private VersionInfoBuilder versionInfoBuilder; + @Operation(summary = "${infoApi.info.summary}", description = "${infoApi.info.description}", tags = { "info" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Version info.", content = { @Content(schema = @Schema(implementation = VersionInfo.class)) }) + }) @GetMapping(value = "/info", produces = MediaType.APPLICATION_JSON_VALUE) public VersionInfo info() throws IOException { return versionInfoBuilder.buildVersionInfo(); diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java b/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java index 33ea6281af557e5f028bd599e05f83779ccfe805..5b82846c9264c711e8af5c28a00bcce909ffcbed 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java @@ -16,8 +16,16 @@ package org.opengroup.osdu.notification.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import org.opengroup.osdu.core.common.http.HttpResponse; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; +import org.opengroup.osdu.core.common.model.http.AppError; import org.opengroup.osdu.notification.provider.interfaces.IPubsubRequestBodyExtractor; import org.opengroup.osdu.notification.service.NotificationHandler; import org.opengroup.osdu.notification.utils.Config; @@ -35,6 +43,7 @@ import java.util.Map; @RestController @RequestScope @RequestMapping("/push-handlers") +@Tag(name = "pubsub-endpoint-api", description = "PubSub Endpoint API") public class PubsubEndpoint { @Autowired private IPubsubRequestBodyExtractor pubsubRequestBodyExtractor; @@ -46,6 +55,19 @@ public class PubsubEndpoint { private final String ACKNOWLEDGE = "message acknowledged by client"; private final String NOT_ACKNOWLEDGE = "message not acknowledged by client"; + @Operation(summary = "${pubsubEndpointApi.recordChanged.summary}", description = "${pubsubEndpointApi.recordChanged.description}", + security = {@SecurityRequirement(name = "Authorization")}, tags = { "pubsub-endpoint-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { @Content(schema = @Schema(implementation = String.class)) }), + @ApiResponse(responseCode = "201", description = "Created", content = { @Content(schema = @Schema(implementation = String.class)) }), + @ApiResponse(responseCode = "400", description = "Bad user input. Mandatory fields missing or unacceptable value passed to API", content = {@Content(schema = @Schema(implementation = AppError.class ))}), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), + @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) + }) @PostMapping("/records-changed") @PreAuthorize("@authorizationFilter.hasAnyPermission('" + Config.OPS + "', '" + Config.PUBSUB + "')") public ResponseEntity recordChanged() throws Exception { diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/HomeController.java b/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/HomeController.java deleted file mode 100644 index 3e568ff05233c163ec6e535e09e6ce06c09df98d..0000000000000000000000000000000000000000 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/HomeController.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opengroup.osdu.notification.swagger; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HomeController { - - @RequestMapping(value = {"/", "/swagger"}) - public String swagger() { - System.out.println("swagger-ui.html"); - return "redirect:swagger-ui.html"; - } -} diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/SwaggerConfiguration.java b/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/SwaggerConfiguration.java index fce04e61ec9901c8937e38f98b6d02acea478e7d..f9bf88f3c6c6ff1674989d72468d132caa78c86e 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/SwaggerConfiguration.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/swagger/SwaggerConfiguration.java @@ -1,42 +1,36 @@ package org.opengroup.osdu.notification.swagger; -import java.util.Collections; - -import javax.servlet.ServletContext; - -import org.springframework.context.annotation.Bean; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; +import io.swagger.v3.oas.annotations.info.Contact; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.info.License; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.security.SecurityScheme; +import io.swagger.v3.oas.annotations.servers.Server; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.security.SecurityRequirement; -import io.swagger.v3.oas.models.security.SecurityScheme; -import io.swagger.v3.oas.models.servers.Server; +@OpenAPIDefinition( + info = @Info( + title = "${api.title}", + description = "${api.description}", + version = "${api.version}", + contact = @Contact(name = "${api.contact.name}", email = "${api.contact.email}"), + license = @License(name = "${api.license.name}", url = "${api.license.url}")), + servers = @Server(url = "${api.server.url}"), + security = @SecurityRequirement(name = "Authorization"), + tags = { + @Tag(name = "pubsub-endpoint-api", description = "PubSub Endpoint API"), + @Tag(name = "health-checks-api", description = "Health Checks API"), + @Tag(name = "info", description = "Version info endpoint") + } +) +@SecurityScheme(name = "Authorization", scheme = "bearer", bearerFormat = "Authorization", type = SecuritySchemeType.HTTP) @Configuration @Profile("!noswagger") public class SwaggerConfiguration { - @Bean - public OpenAPI openApi(ServletContext servletContext) { - Server server = new Server().url(servletContext.getContextPath()); - return new OpenAPI() - .servers(Collections.singletonList(server)) - .info(new Info() - .title("Notification Service") - .version("1.0")) - .components(new Components() - .addSecuritySchemes("Authorization", - new SecurityScheme() - .type(SecurityScheme.Type.HTTP) - .scheme("bearer") - .bearerFormat("Authorization") - .in(SecurityScheme.In.HEADER) - .name("Authorization"))) - .addSecurityItem( - new SecurityRequirement() - .addList("Authorization")); - } } diff --git a/notification-core/src/main/resources/swagger.properties b/notification-core/src/main/resources/swagger.properties new file mode 100644 index 0000000000000000000000000000000000000000..550bd18aa32a6772e6594e44f963c76deac71ed3 --- /dev/null +++ b/notification-core/src/main/resources/swagger.properties @@ -0,0 +1,30 @@ +#Manage common SpringDoc and OpenAPI related properties + +#SpringDoc related properties +springdoc.swagger-ui.tagsSorter=alpha +springdoc.swagger-ui.operationsSorter=alpha +springdoc.swagger-ui.doc-expansion=none +springdoc.swagger-ui.path=/swagger +springdoc.swagger-ui.displayOperationId=true +springdoc.api-docs.path=/api-docs + +#OpenAPI 3.0 - Notification Service properties +api.title=Notification Service +api.description=The Notification service, with Register service, allow interested consumers to subscribe to data and metadata changes using a publisher/subscriber pattern +api.version=1.0.0 +api.contact.name=OSDU Data Platform Team +api.contact.email=dps@OSDU.org +api.license.name=Apache 2.0 +api.license.url=https://www.apache.org/licenses/LICENSE-2.0.html +api.server.url=${server.servlet.context-path} + +#PubSub Enpoint related properties +pubsubEndpointApi.recordChanged.summary=Record Changed +pubsubEndpointApi.recordChanged.description=Record Changed. Required Roles: `users.datalake.ops` or `notification.pubsub` + +#Info & Health API related properties +infoApi.info.summary=Version info +infoApi.info.description=For deployment available public `/info` endpoint, which provides build and git related information. +healthChecksApi.warmup.summary=Liveness Check endpoint +healthChecksApi.warmup.description=For deployment available public `/_ah` endpoint. + diff --git a/notification-core/src/test/java/org/opengroup/osdu/notification/swagger/HomeControllerTest.java b/notification-core/src/test/java/org/opengroup/osdu/notification/swagger/HomeControllerTest.java deleted file mode 100644 index 895cf1ab27cad997e0510d6c28b1bd89f1c5c55b..0000000000000000000000000000000000000000 --- a/notification-core/src/test/java/org/opengroup/osdu/notification/swagger/HomeControllerTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opengroup.osdu.notification.swagger; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup; - -@RunWith(MockitoJUnitRunner.class) -public class HomeControllerTest { - - private MockMvc mockMvc; - - @Before - public void setup() { - mockMvc = standaloneSetup(HomeController.class).build(); - } - - @Test - public void testSwaggerFound() throws Exception { - mockMvc.perform(get("/swagger") - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isFound()); - - mockMvc.perform(get("/") - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isFound()); - } -} diff --git a/pom.xml b/pom.xml index 1730558d17fc300817a1b26298c073521c4256d3..16d3a9babeb81e96f3c676a37fe60e8eb992e26c 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ <os-core-common.version>0.19.0-rc6</os-core-common.version> <log4j2.version>2.17.1</log4j2.version> <json-smart.version>2.4.7</json-smart.version> - <openapi.version>1.6.9</openapi.version> + <openapi.version>1.6.14</openapi.version> </properties> <licenses> diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/Application.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/Application.java index c40dadeba16188da97aa52b22c25e2eba30eea3f..54bcf367c49c7784e0f0202e2fbf954eb76f807c 100644 --- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/Application.java +++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/Application.java @@ -17,11 +17,13 @@ package org.opengroup.osdu.notification.provider.aws; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.PropertySource; import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication @ComponentScan({"org.opengroup.osdu"}) @EnableAsync +@PropertySource("classpath:swagger.properties") public class Application { public static void main(String[] args) { diff --git a/provider/notification-azure/README.md b/provider/notification-azure/README.md index e682d4fe1738f1207e9662b882032242ceb8f34c..661ca978d91fd0270444f39a059332093928a074 100644 --- a/provider/notification-azure/README.md +++ b/provider/notification-azure/README.md @@ -114,6 +114,12 @@ After configuring your environment as specified above, you can follow these step Jet Brains - the authors of Intellij IDEA, have written an [excellent guide](https://www.jetbrains.com/help/idea/debugging-your-first-java-application.html) on how to debug java programs. +## Open API 3.0 - Swagger +- Swagger UI: http://localhost:8080/api/notification/v1/swagger (will redirect to http://localhost:8080/api/notification/v1/swagger-ui/index.html) +- api-docs (JSON) : http://localhost:8080/api/notification/v1/api-docs +- api-docs (YAML) : http://localhost:8080/api/notification/v1/api-docs.yaml + +All the Swagger and OpenAPI related common properties are managed here [swagger.properties](../../notification-core/src/main/resources/swagger.properties) ## Deploying service diff --git a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/Application.java b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/Application.java index c9f2e556dc0a4d03d5b936907a21be12b716267e..01d36fce7f0263978a6ebedf515ad2c2215c39fa 100644 --- a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/Application.java +++ b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/Application.java @@ -23,6 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.PropertySource; import org.springframework.scheduling.annotation.EnableAsync; import java.util.concurrent.Executors; @@ -32,6 +33,7 @@ import java.util.concurrent.TimeUnit; @SpringBootApplication @ComponentScan({"org.opengroup.osdu"}) @EnableAsync +@PropertySource("classpath:swagger.properties") public class Application { public static void main(String[] args) { diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/Application.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/Application.java index d300e9ca2b72bc668b32c50ed0d6083e9c00ed5d..909597ef4ab7f04f01393bc99f7b6f5851f46860 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/Application.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/Application.java @@ -21,6 +21,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.PropertySource; import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication @@ -31,6 +32,7 @@ import org.springframework.scheduling.annotation.EnableAsync; ) }) @EnableAsync +@PropertySource("classpath:swagger.properties") public class Application { public static void main(String[] args) { diff --git a/provider/notification-ibm/src/main/java/org/opengroup/osdu/notification/provider/ibm/Application.java b/provider/notification-ibm/src/main/java/org/opengroup/osdu/notification/provider/ibm/Application.java index 57d8d1a57591bc7c53e33a4d8f65e4546c0c7f17..36b8bdc6d4eb3ea7bc95f3fb6d7b2925701516d2 100644 --- a/provider/notification-ibm/src/main/java/org/opengroup/osdu/notification/provider/ibm/Application.java +++ b/provider/notification-ibm/src/main/java/org/opengroup/osdu/notification/provider/ibm/Application.java @@ -6,11 +6,13 @@ package org.opengroup.osdu.notification.provider.ibm; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.PropertySource; import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication @ComponentScan({"org.opengroup.osdu"}) @EnableAsync +@PropertySource("classpath:swagger.properties") public class Application { public static void main(String[] args) {