From 9fbca7213b63dd3463ef0fc8d6bfaa415b3e14b0 Mon Sep 17 00:00:00 2001 From: Christian Rivera Date: Thu, 28 Mar 2024 21:05:08 -0500 Subject: [PATCH] feat: enabled swagger viewer(open-api) for spring boot 2. --- README.md | 5 +++++ pom.xml | 5 +++++ .../productsmanagement/ProductsManagementApplication.java | 5 +++++ src/main/resources/application.properties | 6 +++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d19f959..8fc6467 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,8 @@ this is a second description Lets get started! changed readme file + +## Run Postgres database container in local env: +````bash +docker run -itd -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -p 5432:5432 --name postgresql postgres +```` \ No newline at end of file diff --git a/pom.xml b/pom.xml index a51f999..c82ad3f 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,11 @@ runtime true + + org.springdoc + springdoc-openapi-ui + 1.8.0 + diff --git a/src/main/java/com/tekton/productsmanagement/ProductsManagementApplication.java b/src/main/java/com/tekton/productsmanagement/ProductsManagementApplication.java index 0f8f38b..275bdcf 100644 --- a/src/main/java/com/tekton/productsmanagement/ProductsManagementApplication.java +++ b/src/main/java/com/tekton/productsmanagement/ProductsManagementApplication.java @@ -1,9 +1,14 @@ /* (C)2021 */ package com.tekton.productsmanagement; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +@OpenAPIDefinition(info = @Info(title = "Services API", + version = "1.0", + description = "It supports all capabilities for ProductsManagement application such as catalog and more.")) @SpringBootApplication public class ProductsManagementApplication { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 9f46783..05adf23 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,4 +16,8 @@ tp.api.scheme=http tp.api.host=run.mocky.io tp.api.port= tp.api.services.detail=/v3/70361acb-b94d-4fd6-ab7e-1da5df560768 -tp.api.services.master=/v3/70361acb-b94d-4fd6-ab7e-1da5df560768 \ No newline at end of file +tp.api.services.master=/v3/70361acb-b94d-4fd6-ab7e-1da5df560768 + +springdoc.api-docs.path=/api-docs +springdoc.override-with-generic-response=false +springdoc.swagger-ui.defaultModelsExpandDepth=-1 \ No newline at end of file