-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swagger configuration and api changes
- Loading branch information
indraniBan
authored and
indraniBan
committed
Jun 14, 2024
1 parent
e7375a3
commit 335099b
Showing
3 changed files
with
35 additions
and
78 deletions.
There are no files selected for viewing
56 changes: 16 additions & 40 deletions
56
src/main/java/com/iemr/inventory/config/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,24 @@ | ||
/* | ||
* AMRIT – Accessible Medical Records via Integrated Technology | ||
* Integrated EHR (Electronic Health Records) Solution | ||
* | ||
* Copyright (C) "Piramal Swasthya Management and Research Institute" | ||
* | ||
* This file is part of AMRIT. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see https://www.gnu.org/licenses/. | ||
*/ | ||
package com.iemr.inventory.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import springfox.documentation.service.Contact; | ||
import springfox.documentation.builders.RequestHandlerSelectors; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
@EnableSwagger2 | ||
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; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public Docket productApi() { | ||
return new Docket(DocumentationType.SWAGGER_2).select() | ||
.apis(RequestHandlerSelectors.basePackage("com.iemr.inventory.controller")) | ||
.build().apiInfo(metaData()); | ||
} | ||
public OpenAPI customOpenAPI() { | ||
return new OpenAPI().info(new | ||
Info().title("Inventory API").version("version").description("A microservice for the creation and management of beneficiaries.")) | ||
.addSecurityItem(new SecurityRequirement().addList("my security")) | ||
.components(new Components().addSecuritySchemes("my security", | ||
new SecurityScheme().name("my security").type(SecurityScheme.Type.HTTP).scheme("bearer"))); | ||
} | ||
|
||
private ApiInfo metaData() { | ||
ApiInfo apiInfo = new ApiInfo("Inventory API", "A medicine inventory management and dispensing unit that helps in distributing the medicine to the patients as per the prescription.", | ||
"1.0", "Terms of service", new Contact("AMRIT", "https://psmri.github.io/PSMRI/", "[email protected]"), "", | ||
"", null); | ||
return apiInfo; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters