diff --git a/.travis.yml b/.travis.yml index 244228b4d..184a4516d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,6 +74,6 @@ script: # and Docker test does not run if integration test fails, which makes PR failure easier to understand. # @see https://docs.travis-ci.com/user/job-lifecycle/#customizing-the-build-phase # NOTE: Sleep after docker-compose increased to 60 seconds as often Travis would fail to get Docker up in 30 seconds - - ./gradlew --console=plain licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 30s && http --verify=no --timeout 240 --check-status get https://localhost:8443/fineract-provider/actuator/health && (( $(http --verify=no --timeout 30 --check-status --body get https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 )) + - ./gradlew --console=plain -q licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 60s && http --verify=no --timeout 240 --check-status get https://localhost:8443/fineract-provider/actuator/health && (( $(http --verify=no --timeout 30 --check-status --body get https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 )) # We stop the mysql system service when running the Docker test to avoid port 3306 conflicts (unless we run the mysql in docker-compose on another port; req. FINERACT-773) # The fany /actuator/info test makes sure that has more than 100 characters of JSON to test that the git.properties worked (see FINERACT-983) diff --git a/Dockerfile b/Dockerfile index 4b411643b..fa32a21d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN apt-get update -qq && apt-get install -y wget COPY . fineract WORKDIR /fineract -RUN ./gradlew --no-daemon -x rat -x test bootJar +RUN ./gradlew --no-daemon -q -x rat -x test bootJar WORKDIR /fineract/target RUN jar -xf /fineract/build/libs/fineract-provider.jar @@ -33,7 +33,7 @@ RUN jar -xf /fineract/build/libs/fineract-provider.jar # allowing implementations to switch the driver used by changing start-up parameters (for both tenants and each tenant DB) # The commented out lines in the docker-compose.yml illustrate how to do this. WORKDIR /fineract/target/BOOT-INF/lib -RUN wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar +RUN wget -q https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar # ========================================= diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 1723001ae..f6e1a4cfd 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -102,7 +102,7 @@ dependencyManagement { dependency 'com.jayway.jsonpath:json-path:2.4.0' dependency 'org.apache.tika:tika-core:1.24.1' dependency 'org.apache.httpcomponents:httpclient:4.5.12' - dependency 'io.swagger:swagger-jersey-jaxrs:1.6.1' + dependency 'io.swagger.core.v3:swagger-annotations:2.1.2' dependency 'jakarta.management.j2ee:jakarta.management.j2ee-api:1.1.4' dependency 'jakarta.jms:jakarta.jms-api:2.0.3' dependency 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' @@ -179,6 +179,8 @@ eclipse } } +System.setProperty("openjpa.Log", "commons") + openjpa { includes = ['**/AbstractPersistableCustom.class', '**/domain/*.class'] enhance { @@ -189,6 +191,7 @@ openjpa { // Configuration for Swagger documentation generation task // https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-gradle-plugin resolve { + logging.captureStandardOutput LogLevel.INFO outputFileName = 'fineract' outputFormat = 'JSON' prettyPrint = 'TRUE' @@ -626,6 +629,7 @@ cargoRunLocal.dependsOn bootWar cargoStartLocal.dependsOn bootWar cargoStartLocal.mustRunAfter "integrationTestClasses" cargoStartLocal.mustRunAfter "enhance" +cargoStartLocal.mustRunAfter "resolve" /* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */ sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index 911e224c4..3fa3e44ab 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -76,11 +76,9 @@ dependencies { 'javax.cache:cache-api', - 'com.github.spotbugs:spotbugs-annotations' + 'com.github.spotbugs:spotbugs-annotations', + 'io.swagger.core.v3:swagger-annotations' ) - implementation ('io.swagger:swagger-jersey-jaxrs') { - exclude group: 'javax.validation' - } implementation ('org.apache.activemq:activemq-broker') { exclude group: 'org.apache.geronimo.specs' } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java index 073ec0826..906a59fa9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java @@ -18,15 +18,12 @@ */ package org.apache.fineract.accounting.accrual.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -44,9 +41,7 @@ import org.springframework.stereotype.Component; @Path("/runaccruals") @Component @Scope("singleton") -@Api(tags = { "Periodic Accrual Accounting" }) -@SwaggerDefinition(tags = { - @Tag(name = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n") }) +@Tag(name = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n") public class AccrualAccountingApiResource { private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @@ -63,13 +58,11 @@ public class AccrualAccountingApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Executes Periodic Accrual Accounting", httpMethod = "POST", notes = "Mandatory Fields\n" + "\n" + "tillDate\n") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", required = true, type = "body", dataTypeClass = AccrualAccountingApiResourceSwagger.PostRunaccrualsRequest.class, value = "Request Body\n" - + "\n" + "Field Descriptions: \n" + "tillDate: \n" - + "which specifies periodic accruals should happen till the given Date") }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) - public String executePeriodicAccrualAccounting(@ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(summary = "Executes Periodic Accrual Accounting", method = "POST", description = "Mandatory Fields\n" + "\n" + "tillDate\n") + @Parameter(required = true, schema = @Schema(implementation = AccrualAccountingApiResourceSwagger.PostRunaccrualsRequest.class, description = "Request Body\n" + + "\n" + "Field Descriptions: \n" + "tillDate: \n" + "which specifies periodic accruals should happen till the given Date")) + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) + public String executePeriodicAccrualAccounting(@Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().excuteAccrualAccounting().withJson(jsonRequestBody).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResourceSwagger.java index 3b1b3e41e..c18a55b90 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.accrual.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 24/7/17. @@ -30,18 +29,18 @@ final class AccrualAccountingApiResourceSwagger { // don't allow to instantiate; use only for live API documentation } - @ApiModel(value = "runaccrualsRequest") + @Schema(description = "runaccrualsRequest") public static final class PostRunaccrualsRequest { private PostRunaccrualsRequest() { // don't allow to instantiate; use only for live API documentation } - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "04 June 2014", notes = "which specifies periodic accruals should happen till the given Date", required = true) + @Schema(example = "04 June 2014", description = "which specifies periodic accruals should happen till the given Date", required = true) public String tillDate; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java index 33ca125e8..3d13cb441 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.accounting.closure.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -61,12 +61,11 @@ import org.springframework.stereotype.Component; @Path("/glclosures") @Component @Scope("singleton") -@Api(tags = { "Accounting Closure" }) -@SwaggerDefinition(tags = { - @Tag(name = "Accounting Closure", description = "An accounting closure indicates that no more journal entries may be logged (or reversed) in the system, either manually or via the portfolio with an entry date prior to the defined closure date\n" - + "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n" - + "The identifer of the branch for which accounting has been closed\n" + "comments\n" - + "Description associated with an Accounting closure") }) +@Tag(name = "Accounting Closure", description = "An accounting closure indicates that no more journal entries may be logged (or reversed) in the system, either manually or via the portfolio with an entry date prior to the defined closure date\n" + + "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n" + + "The identifer of the branch for which accounting has been closed\n" + "comments\n" + + "Description associated with an Accounting closure") + public class GLClosuresApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -98,11 +97,11 @@ public class GLClosuresApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Accounting closures", notes = "Example Requests:\n" + "\n" + "glclosures") + @Operation(summary = "List Accounting closures", description = "Example Requests:\n" + "\n" + "glclosures") @ApiResponses({ - @ApiResponse(code = 200, response = GLClosuresApiResourceSwagger.GetGlClosureResponse.class, message = "", responseContainer = "list") }) + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = GLClosuresApiResourceSwagger.GetGlClosureResponse.class, description = "")))) }) public String retrieveAllClosures(@Context final UriInfo uriInfo, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId) { + @QueryParam("officeId") @Parameter(name = "officeId") final Long officeId) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); final List glClosureDatas = this.glClosureReadPlatformService.retrieveAllGLClosures(officeId); @@ -115,10 +114,11 @@ public class GLClosuresApiResource { @Path("{glClosureId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve an Accounting Closure", notes = "Example Requests:\n" + "\n" + "glclosures/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve an Accounting Closure", description = "Example Requests:\n" + "\n" + "glclosures/1\n" + "\n" + "\n" + "/glclosures/1?fields=officeName,closingDate") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.GetGlClosureResponse.class) }) - public String retreiveClosure(@PathParam("glClosureId") @ApiParam(value = "glClosureId") final Long glClosureId, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLClosuresApiResourceSwagger.GetGlClosureResponse.class))) }) + public String retreiveClosure(@PathParam("glClosureId") @Parameter(description = "glClosureId") final Long glClosureId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -137,11 +137,11 @@ public class GLClosuresApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create an Accounting Closure", notes = "Mandatory Fields\n" + "officeId,closingDate") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", required = true, type = "body", dataTypeClass = GLClosuresApiResourceSwagger.PostGlClosuresRequest.class, value = "Request Body") }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.PostGlClosuresResponse.class) }) - public String createGLClosure(@ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(summary = "Create an Accounting Closure", description = "Mandatory Fields\n" + "officeId,closingDate") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = GLClosuresApiResourceSwagger.PostGlClosuresRequest.class, description = "Request Body"))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLClosuresApiResourceSwagger.PostGlClosuresResponse.class))) }) + public String createGLClosure(@Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createGLClosure().withJson(jsonRequestBody).build(); @@ -154,12 +154,12 @@ public class GLClosuresApiResource { @Path("{glClosureId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update an Accounting closure", notes = "Once an accounting closure is created, only the comments associated with it may be edited") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "Request body", dataType = "body", dataTypeClass = GLClosuresApiResourceSwagger.PutGlClosuresRequest.class, required = true) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.PutGlClosuresResponse.class) }) - public String updateGLClosure(@PathParam("glClosureId") @ApiParam(value = "glClosureId") final Long glClosureId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(summary = "Update an Accounting closure", description = "Once an accounting closure is created, only the comments associated with it may be edited") + @RequestBody(content = @Content(schema = @Schema(implementation = GLClosuresApiResourceSwagger.PutGlClosuresRequest.class, required = true))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLClosuresApiResourceSwagger.PutGlClosuresResponse.class))) }) + public String updateGLClosure(@PathParam("glClosureId") @Parameter(description = "glClosureId") final Long glClosureId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateGLClosure(glClosureId).withJson(jsonRequestBody).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); @@ -171,9 +171,10 @@ public class GLClosuresApiResource { @Path("{glClosureId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete an accounting closure", notes = "Note: Only the latest accounting closure associated with a branch may be deleted.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.DeleteGlClosuresResponse.class) }) - public String deleteGLClosure(@PathParam("glClosureId") @ApiParam(value = "glclosureId") final Long glClosureId) { + @Operation(summary = "Delete an accounting closure", description = "Note: Only the latest accounting closure associated with a branch may be deleted.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLClosuresApiResourceSwagger.DeleteGlClosuresResponse.class))) }) + public String deleteGLClosure(@PathParam("glClosureId") @Parameter(description = "glclosureId") final Long glClosureId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteGLClosure(glClosureId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResourceSwagger.java index 99345a13c..781085864 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.closure.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.joda.time.LocalDate; final class GLClosuresApiResourceSwagger { @@ -33,108 +32,108 @@ final class GLClosuresApiResourceSwagger { */ // Check !! - @ApiModel(value = "GetGLClosureResponse") + @Schema(description = "GetGLClosureResponse") public static final class GetGlClosureResponse { private GetGlClosureResponse() { // dont allow to initiatiate } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Long id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "2013,1,2") + @Schema(example = "2013,1,2") public LocalDate closingDate; - @ApiModelProperty(example = "false") + @Schema(example = "false") public boolean deleted; - @ApiModelProperty(example = "2013,1,3") + @Schema(example = "2013,1,3") public LocalDate createdDate; - @ApiModelProperty(example = "2013,1,3") + @Schema(example = "2013,1,3") public LocalDate lastUpdatedDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long createdByUserId; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdByUsername; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long lastUpdatedByUserId; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String lastUpdatedByUsername; - @ApiModelProperty(example = "closed") + @Schema(example = "closed") public String comments; } - @ApiModel(value = "PostGLCLosuresRequest") + @Schema(description = "PostGLCLosuresRequest") public static final class PostGlClosuresRequest { private PostGlClosuresRequest() { // don't allow to instantiate; use only for live API documentation } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "06 December 2012") + @Schema(example = "06 December 2012") public LocalDate closingDate; - @ApiModelProperty(example = "The accountants are heading for a carribean vacation") + @Schema(example = "The accountants are heading for a carribean vacation") public String comments; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; } - @ApiModel(value = "PostGlClosuresResponse") + @Schema(description = "PostGlClosuresResponse") public static final class PostGlClosuresResponse { private PostGlClosuresResponse() { // don't allow to instantiate; use only for live API documentation } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "9") + @Schema(example = "9") public Long resourceId; } - @ApiModel(value = "PutGlClosuresRequest") + @Schema(description = "PutGlClosuresRequest") public static final class PutGlClosuresRequest { private PutGlClosuresRequest() { // don't allow to instantiate; use only for live API documentation } - @ApiModelProperty(example = "All transactions verified by Johnny Cash") + @Schema(example = "All transactions verified by Johnny Cash") public String comments; } - @ApiModel(value = "PutGlClosuresResponse") + @Schema(description = "PutGlClosuresResponse") public static final class PutGlClosuresResponse { private PutGlClosuresResponse() { // don't allow to instantiate; use only for live API documentation } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "9") + @Schema(example = "9") public Long resourceId; - @ApiModelProperty(example = "All transactions verified by Johnny Cash") + @Schema(example = "All transactions verified by Johnny Cash") public String comments; } - @ApiModel(value = "DeleteGlClosuresResponse") + @Schema(description = "DeleteGlClosuresResponse") public static final class DeleteGlClosuresResponse { private DeleteGlClosuresResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "9") + @Schema(example = "9") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java index 4fd498cbc..5aa7cd6ea 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.accounting.financialactivityaccount.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -56,11 +56,9 @@ import org.springframework.stereotype.Component; @Path("/financialactivityaccounts") @Component @Scope("singleton") -@Api(tags = { "Mapping Financial Activities to Accounts" }) -@SwaggerDefinition(tags = { - @Tag(name = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n" - + "\n" + "Field Descriptions\n" + "financialActivityId\n" + "The identifier of the Financial Activity\n" + "glAccountId\n" - + "The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity") }) +@Tag(name = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n" + + "\n" + "Field Descriptions\n" + "financialActivityId\n" + "The identifier of the Financial Activity\n" + "glAccountId\n" + + "The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity") public class FinancialActivityAccountsApiResource { private final FinancialActivityAccountReadPlatformService financialActivityAccountReadPlatformService; @@ -101,10 +99,10 @@ public class FinancialActivityAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Financial Activities to Accounts Mappings", notes = "Example Requests:\n" + "\n" + @Operation(summary = "List Financial Activities to Accounts Mappings", description = "Example Requests:\n" + "\n" + "financialactivityaccounts") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.GetFinancialActivityAccountsResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.GetFinancialActivityAccountsResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(FinancialActivityAccountsConstants.resourceNameForPermission); @@ -119,11 +117,12 @@ public class FinancialActivityAccountsApiResource { @Path("{mappingId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Financial Activity to Account Mapping\n", notes = "Example Requests:\n" + "\n" + @Operation(summary = "Retrieve a Financial Activity to Account Mapping\n", description = "Example Requests:\n" + "\n" + "financialactivityaccounts/1") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.GetFinancialActivityAccountsResponse.class) }) - public String retreive(@PathParam("mappingId") @ApiParam(value = "mappingId") final Long mappingId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.GetFinancialActivityAccountsResponse.class))) }) + public String retreive(@PathParam("mappingId") @Parameter(description = "mappingId") final Long mappingId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(FinancialActivityAccountsConstants.resourceNameForPermission); @@ -141,13 +140,12 @@ public class FinancialActivityAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a new Financial Activity to Accounts Mapping", notes = "Mandatory Fields\n" + @Operation(summary = "Create a new Financial Activity to Accounts Mapping", description = "Mandatory Fields\n" + "financialActivityId, glAccountId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "Request body", paramType = "body", dataType = "body", dataTypeClass = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsRequest.class) }) + @RequestBody(content = @Content(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsResponse.class) }) - public String createGLAccount(@ApiParam(hidden = true) final String jsonRequestBody) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsResponse.class))) }) + public String createGLAccount(@Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createOfficeToGLAccountMapping().withJson(jsonRequestBody) .build(); @@ -161,13 +159,12 @@ public class FinancialActivityAccountsApiResource { @Path("{mappingId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Financial Activity to Account Mapping", notes = "the API updates the Ledger account linked to a Financial Activity \n") - @ApiImplicitParams({ - @ApiImplicitParam(value = "Request body", dataType = "body", paramType = "body", dataTypeClass = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsRequest.class) }) + @Operation(summary = "Update a Financial Activity to Account Mapping", description = "the API updates the Ledger account linked to a Financial Activity \n") + @RequestBody(content = @Content(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.PutFinancialActivityAccountsResponse.class) }) - public String updateGLAccount(@PathParam("mappingId") @ApiParam(value = "mappingId") final Long mappingId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.PutFinancialActivityAccountsResponse.class))) }) + public String updateGLAccount(@PathParam("mappingId") @Parameter(description = "mappingId") final Long mappingId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateOfficeToGLAccountMapping(mappingId) .withJson(jsonRequestBody).build(); @@ -181,10 +178,10 @@ public class FinancialActivityAccountsApiResource { @Path("{mappingId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Financial Activity to Account Mapping") + @Operation(summary = "Delete a Financial Activity to Account Mapping") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FinancialActivityAccountsApiResourceSwagger.DeleteFinancialActivityAccountsResponse.class) }) - public String deleteGLAccount(@PathParam("mappingId") @ApiParam(value = "mappingId") final Long mappingId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FinancialActivityAccountsApiResourceSwagger.DeleteFinancialActivityAccountsResponse.class))) }) + public String deleteGLAccount(@PathParam("mappingId") @Parameter(description = "mappingId") final Long mappingId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteOfficeToGLAccountMapping(mappingId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResourceSwagger.java index 44a8b4b0a..2b0f9e984 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.financialactivityaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityData; import org.apache.fineract.accounting.glaccount.data.GLAccountData; @@ -30,58 +29,58 @@ final class FinancialActivityAccountsApiResourceSwagger { private FinancialActivityAccountsApiResourceSwagger() {} - @ApiModel(value = "GetFinancialActivityAccountsResponse") + @Schema(description = "GetFinancialActivityAccountsResponse") public static final class GetFinancialActivityAccountsResponse { private GetFinancialActivityAccountsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; public FinancialActivityData financialActivityData; public GLAccountData glAccountData; } - @ApiModel(value = "PostFinancialActivityAccountsRequest") + @Schema(description = "PostFinancialActivityAccountsRequest") public static final class PostFinancialActivityAccountsRequest { private PostFinancialActivityAccountsRequest() { } - @ApiModelProperty(example = "200") + @Schema(example = "200") public Long financialActivityId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long glAccountId; } - @ApiModel(value = "PostFinancialActivityAccountsResponse") + @Schema(description = "PostFinancialActivityAccountsResponse") public static final class PostFinancialActivityAccountsResponse { private PostFinancialActivityAccountsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PutFinancialActivityAccountsRequest") + @Schema(description = "PutFinancialActivityAccountsRequest") public static final class PutFinancialActivityAccountsRequest { private PutFinancialActivityAccountsRequest() { } - @ApiModelProperty(example = "200") + @Schema(example = "200") public Long financialActivityId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long glAccountId; } - @ApiModel(value = "PutFinancialActivityAccountsResponse") + @Schema(description = "PutFinancialActivityAccountsResponse") public static final class PutFinancialActivityAccountsResponse { private PutFinancialActivityAccountsResponse() { @@ -92,23 +91,23 @@ final class FinancialActivityAccountsApiResourceSwagger { private PutFinancialActivityAccountscommentsSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long glAccountId; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutFinancialActivityAccountscommentsSwagger comments; } - @ApiModel(value = "DeleteFinancialActivityAccountsResponse") + @Schema(description = "DeleteFinancialActivityAccountsResponse") public static final class DeleteFinancialActivityAccountsResponse { private DeleteFinancialActivityAccountsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java index e0491d364..00504471a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java @@ -20,15 +20,15 @@ package org.apache.fineract.accounting.glaccount.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -75,10 +75,8 @@ import org.springframework.stereotype.Component; @Path("/glaccounts") @Component @Scope("singleton") -@Api(tags = { "General Ledger Account" }) -@SwaggerDefinition(tags = { - @Tag(name = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n" - + "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts") }) +@Tag(name = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n" + + "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts") public class GLAccountsApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "parentId", "glCode", "disabled", @@ -121,13 +119,15 @@ public class GLAccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve GL Accounts Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "glaccounts/template\n" - + "glaccounts/template?type=1\n" + "\n" + "type is optional and integer value from 1 to 5.\n" + "\n" + "1.Assets \n" - + "2.Liabilities \n" + "3.Equity \n" + "4.Income \n" + "5.Expenses") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.GetGLAccountsTemplateResponse.class) }) + @Operation(tags = { + "General Ledger Account" }, summary = "Retrieve GL Accounts Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "glaccounts/template\n" + + "glaccounts/template?type=1\n" + "\n" + "type is optional and integer value from 1 to 5.\n" + "\n" + "1.Assets \n" + + "2.Liabilities \n" + "3.Equity \n" + "4.Income \n" + "5.Expenses") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.GetGLAccountsTemplateResponse.class))) }) public String retrieveNewAccountDetails(@Context final UriInfo uriInfo, - @QueryParam("type") @ApiParam(value = "type") final Integer type) { + @QueryParam("type") @Parameter(description = "type") final Integer type) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -141,18 +141,19 @@ public class GLAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List General Ledger Accounts", notes = "ARGUMENTS\n" + @Operation(tags = { "General Ledger Account" }, summary = "List General Ledger Accounts", description = "ARGUMENTS\n" + "type Integer optional manualEntriesAllowed boolean optional usage Integer optional disabled boolean optional parentId Long optional tagId Long optional\n" + "Example Requests:\n" + "\n" + "glaccounts\n" + "\n" + "\n" + "glaccounts?type=1&manualEntriesAllowed=true&usage=1&disabled=false\n" + "\n" + "glaccounts?fetchRunningBalance=true") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.GetGLAccountsResponse.class, responseContainer = "list") }) - public String retrieveAllAccounts(@Context final UriInfo uriInfo, @QueryParam("type") @ApiParam(value = "type") final Integer type, - @QueryParam("searchParam") @ApiParam(value = "searchParam") final String searchParam, - @QueryParam("usage") @ApiParam(value = "usage") final Integer usage, - @QueryParam("manualEntriesAllowed") @ApiParam(value = "manualEntriesAllowed") final Boolean manualEntriesAllowed, - @QueryParam("disabled") @ApiParam(value = "disabled") final Boolean disabled, - @QueryParam("fetchRunningBalance") @ApiParam(value = "fetchRunningBalance") final boolean runningBalance) { + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = GLAccountsApiResourceSwagger.GetGLAccountsResponse.class)))) }) + public String retrieveAllAccounts(@Context final UriInfo uriInfo, + @QueryParam("type") @Parameter(description = "type") final Integer type, + @QueryParam("searchParam") @Parameter(description = "searchParam") final String searchParam, + @QueryParam("usage") @Parameter(description = "usage") final Integer usage, + @QueryParam("manualEntriesAllowed") @Parameter(description = "manualEntriesAllowed") final Boolean manualEntriesAllowed, + @QueryParam("disabled") @Parameter(description = "disabled") final Boolean disabled, + @QueryParam("fetchRunningBalance") @Parameter(description = "fetchRunningBalance") final boolean runningBalance) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(false, runningBalance); @@ -167,13 +168,14 @@ public class GLAccountsApiResource { @Path("{glAccountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a General Ledger Account", notes = "Example Requests:\n" + "\n" + "glaccounts/1\n" + "\n" + "\n" - + "glaccounts/1?template=true\n" + "\n" + "\n" + "glaccounts/1?fields=name,glCode\n" + "\n" + "\n" - + "glaccounts/1?fetchRunningBalance=true") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.GetGLAccountsResponse.class) }) - public String retreiveAccount(@PathParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId, + @Operation(tags = { "General Ledger Account" }, summary = "Retrieve a General Ledger Account", description = "Example Requests:\n" + + "\n" + "glaccounts/1\n" + "\n" + "\n" + "glaccounts/1?template=true\n" + "\n" + "\n" + "glaccounts/1?fields=name,glCode\n" + + "\n" + "\n" + "glaccounts/1?fetchRunningBalance=true") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.GetGLAccountsResponse.class))) }) + public String retreiveAccount(@PathParam("glAccountId") @Parameter(description = "glAccountId") final Long glAccountId, @Context final UriInfo uriInfo, - @QueryParam("fetchRunningBalance") @ApiParam(value = "fetchRunningBalance") final boolean runningBalance) { + @QueryParam("fetchRunningBalance") @Parameter(description = "fetchRunningBalance") final boolean runningBalance) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -190,12 +192,13 @@ public class GLAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a General Ledger Account", notes = "Note: You may optionally create Hierarchical Chart of Accounts by using the \"parentId\" property of an Account\n" - + "Mandatory Fields: \n" + "name, glCode, type, usage and manualEntriesAllowed") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = GLAccountsApiResourceSwagger.PostGLAccountsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.PostGLAccountsResponse.class) }) - public String createGLAccount(@ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(tags = { + "General Ledger Account" }, summary = "Create a General Ledger Account", description = "Note: You may optionally create Hierarchical Chart of Accounts by using the \"parentId\" property of an Account\n" + + "Mandatory Fields: \n" + "name, glCode, type, usage and manualEntriesAllowed") + @RequestBody(content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.PostGLAccountsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.PostGLAccountsResponse.class))) }) + public String createGLAccount(@Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createGLAccount().withJson(jsonRequestBody).build(); @@ -208,13 +211,14 @@ public class GLAccountsApiResource { @Path("{glAccountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update an Accounting closure", notes = "Once an accounting closure is created, only the comments associated with it may be edited\n" - + "\n") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = GLAccountsApiResourceSwagger.PutGLAccountsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.PutGLAccountsResponse.class) }) - public String updateGLAccount(@PathParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(tags = { + "General Ledger Account" }, summary = "Update an Accounting closure", description = "Once an accounting closure is created, only the comments associated with it may be edited\n" + + "\n") + @RequestBody(content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.PutGLAccountsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.PutGLAccountsResponse.class))) }) + public String updateGLAccount(@PathParam("glAccountId") @Parameter(description = "glAccountId") final Long glAccountId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateGLAccount(glAccountId).withJson(jsonRequestBody).build(); @@ -227,9 +231,11 @@ public class GLAccountsApiResource { @Path("{glAccountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete an accounting closure", notes = "Note: Only the latest accounting closure associated with a branch may be deleted.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.DeleteGLAccountsRequest.class) }) - public String deleteGLAccount(@PathParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId) { + @Operation(tags = { + "General Ledger Account" }, summary = "Delete an accounting closure", description = "Note: Only the latest accounting closure associated with a branch may be deleted.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GLAccountsApiResourceSwagger.DeleteGLAccountsRequest.class))) }) + public String deleteGLAccount(@PathParam("glAccountId") @Parameter(description = "glAccountId") final Long glAccountId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteGLAccount(glAccountId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResourceSwagger.java index d32fc3df7..7a1d54236 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.glaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.List; import org.apache.fineract.accounting.glaccount.data.GLAccountData; @@ -35,57 +34,57 @@ final class GLAccountsApiResourceSwagger { } - @ApiModel(value = "GetGLAccountsResponse") + @Schema(description = "GetGLAccountsResponse") public static final class GetGLAccountsResponse { private GetGLAccountsResponse() { } - @ApiModelProperty(example = "16") + @Schema(example = "16") public Long id; - @ApiModelProperty(example = "Cash") + @Schema(example = "Cash") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long parentId; - @ApiModelProperty(example = "100001") + @Schema(example = "100001") public String glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public EnumOptionData type; public EnumOptionData usage; - @ApiModelProperty(example = "Desc") + @Schema(example = "Desc") public String description; - @ApiModelProperty(example = "....Cash") + @Schema(example = "....Cash") public String nameDecorated; public CodeValueData tagId; - @ApiModelProperty(example = "118437") + @Schema(example = "118437") public Long organizationRunningBalance; } - @ApiModel(value = "GetGLAccountsTemplateResponse") + @Schema(description = "GetGLAccountsTemplateResponse") public static final class GetGLAccountsTemplateResponse { private GetGLAccountsTemplateResponse() { } - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public EnumOptionData type; @@ -104,83 +103,83 @@ final class GLAccountsApiResourceSwagger { } - @ApiModel(value = "PostGLAccountsRequest") + @Schema(description = "PostGLAccountsRequest") public static final class PostGLAccountsRequest { private PostGLAccountsRequest() { } - @ApiModelProperty(example = "Cash at Bangalore") + @Schema(example = "Cash at Bangalore") public String name; - @ApiModelProperty(example = "100001") + @Schema(example = "100001") public String glCode; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; - @ApiModelProperty(example = "1") + @Schema(example = "1") public String type; - @ApiModelProperty(example = "10") + @Schema(example = "10") public String tagId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long parentId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public EnumOptionData usage; - @ApiModelProperty(example = "Desc") + @Schema(example = "Desc") public String description; } - @ApiModel(value = "PostGLAccountsResponse") + @Schema(description = "PostGLAccountsResponse") public static final class PostGLAccountsResponse { private PostGLAccountsResponse() { } - @ApiModelProperty(example = "22") + @Schema(example = "22") public int resourceId; } - @ApiModel(value = "PutGLAccountsRequest") + @Schema(description = "PutGLAccountsRequest") public static final class PutGLAccountsRequest { private PutGLAccountsRequest() { } - @ApiModelProperty(example = "Cash at Bangalore") + @Schema(example = "Cash at Bangalore") public String name; } - @ApiModel(value = "PutGLAccountsResponse") + @Schema(description = "PutGLAccountsResponse") public static final class PutGLAccountsResponse { private PutGLAccountsResponse() { } - @ApiModel + @Schema public static final class PutGLAccountsResponsechangesSwagger { private PutGLAccountsResponsechangesSwagger() {} - @ApiModelProperty(example = "Cash at Bangalore") + @Schema(example = "Cash at Bangalore") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public int resourceId; public PutGLAccountsResponsechangesSwagger changes; } - @ApiModel(value = "DeleteGLAccountsRequest") + @Schema(description = "DeleteGLAccountsRequest") public static final class DeleteGLAccountsRequest { private DeleteGLAccountsRequest() { @@ -193,7 +192,7 @@ final class GLAccountsApiResourceSwagger { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public int resourceId; private DeleteGLAccountsRequestchangesSwagger changes; diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java index ccbe09569..dd6e84d7f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java @@ -20,15 +20,16 @@ package org.apache.fineract.accounting.journalentry.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Date; @@ -73,10 +74,8 @@ import org.springframework.stereotype.Component; @Path("/journalentries") @Component @Scope("singleton") -@Api(tags = { "Journal Entries" }) -@SwaggerDefinition(tags = { - @Tag(name = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n" - + "\n" + "A journal entry directly changes the account balances on the general ledger") }) +@Tag(name = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n" + + "\n" + "A journal entry directly changes the account balances on the general ledger") public class JournalEntriesApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -113,30 +112,32 @@ public class JournalEntriesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Journal Entries", notes = "The list capability of journal entries can support pagination and sorting.\n\n" + @Operation(summary = "List Journal Entries", description = "The list capability of journal entries can support pagination and sorting.\n\n" + "Example Requests:\n" + "\n" + "journalentries\n" + "\n" + "journalentries?transactionId=PB37X8Y21EQUY4S\n" + "\n" + "journalentries?officeId=1&manualEntriesOnly=true&fromDate=1 July 2013&toDate=15 July 2013&dateFormat=dd MMMM yyyy&locale=en\n" + "\n" + "journalentries?fields=officeName,glAccountName,transactionDate\n" + "\n" + "journalentries?offset=10&limit=50\n" + "\n" + "journalentries?orderBy=transactionId&sortOrder=DESC\n" + "\n" + "journalentries?runningBalance=true\n" + "\n" + "journalentries?transactionDetails=true\n" + "\n" + "journalentries?loanId=12\n" + "\n" + "journalentries?savingsId=24") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = JournalEntryData.class, responseContainer = "list") }) - public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @QueryParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId, - @QueryParam("manualEntriesOnly") @ApiParam(value = "manualEntriesOnly") final Boolean onlyManualEntries, - @QueryParam("fromDate") @ApiParam(value = "fromDate") final DateParam fromDateParam, - @QueryParam("toDate") @ApiParam(value = "toDate") final DateParam toDateParam, - @QueryParam("transactionId") @ApiParam(value = "transactionId") final String transactionId, - @QueryParam("entityType") @ApiParam(value = "entityType") final Integer entityType, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("locale") @ApiParam(value = "locale") final String locale, - @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat, - @QueryParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("savingsId") @ApiParam(value = "savingsId") final Long savingsId, - @QueryParam("runningBalance") @ApiParam(value = "runningBalance") final boolean runningBalance, - @QueryParam("transactionDetails") @ApiParam(value = "transactionDetails") final boolean transactionDetails) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = JournalEntryData.class)))) }) + public String retrieveAll(@Context final UriInfo uriInfo, + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @QueryParam("glAccountId") @Parameter(description = "glAccountId") final Long glAccountId, + @QueryParam("manualEntriesOnly") @Parameter(description = "manualEntriesOnly") final Boolean onlyManualEntries, + @QueryParam("fromDate") @Parameter(description = "fromDate") final DateParam fromDateParam, + @QueryParam("toDate") @Parameter(description = "toDate") final DateParam toDateParam, + @QueryParam("transactionId") @Parameter(description = "transactionId") final String transactionId, + @QueryParam("entityType") @Parameter(description = "entityType") final Integer entityType, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("locale") @Parameter(description = "locale") final String locale, + @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat, + @QueryParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("savingsId") @Parameter(description = "savingsId") final Long savingsId, + @QueryParam("runningBalance") @Parameter(description = "runningBalance") final boolean runningBalance, + @QueryParam("transactionDetails") @Parameter(description = "transactionDetails") final boolean transactionDetails) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -164,13 +165,16 @@ public class JournalEntriesApiResource { @Path("{journalEntryId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a single Entry", notes = "Example Requests:\n" + "\n" + "journalentries/1\n" + "\n" + "\n" + "\n" + @Operation(summary = "Retrieve a single Entry", description = "Example Requests:\n" + "\n" + "journalentries/1\n" + "\n" + "\n" + "\n" + "journalentries/1?fields=officeName,glAccountId,entryType,amount\n" + "\n" + "journalentries/1?runningBalance=true\n" + "\n" + "journalentries/1?transactionDetails=true") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = JournalEntryData.class) }) - public String retreiveJournalEntryById(@PathParam("journalEntryId") @ApiParam(value = "journalEntryId") final Long journalEntryId, - @Context final UriInfo uriInfo, @QueryParam("runningBalance") @ApiParam(value = "runningBalance") final boolean runningBalance, - @QueryParam("transactionDetails") @ApiParam(value = "transactionDetails") final boolean transactionDetails) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = JournalEntryData.class))) }) + public String retreiveJournalEntryById( + @PathParam("journalEntryId") @Parameter(description = "journalEntryId") final Long journalEntryId, + @Context final UriInfo uriInfo, + @QueryParam("runningBalance") @Parameter(description = "runningBalance") final boolean runningBalance, + @QueryParam("transactionDetails") @Parameter(description = "transactionDetails") final boolean transactionDetails) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails, @@ -185,16 +189,16 @@ public class JournalEntriesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create \"Balanced\" Journal Entries", notes = "Note: A Balanced (simple) Journal entry would have atleast one \"Debit\" and one \"Credit\" entry whose amounts are equal \n" + @Operation(summary = "Create \"Balanced\" Journal Entries", description = "Note: A Balanced (simple) Journal entry would have atleast one \"Debit\" and one \"Credit\" entry whose amounts are equal \n" + "Compound Journal entries may have \"n\" debits and \"m\" credits where both \"m\" and \"n\" are greater than 0 and the net sum or all debits and credits are equal \n\n" + "\n" + "Mandatory Fields\n" + "officeId, transactionDate\n\n" + "\ncredits- glAccountId, amount, comments\n\n " + "\ndebits- glAccountId, amount, comments\n\n " + "\n" + "Optional Fields\n" + "paymentTypeId, accountNumber, checkNumber, routingCode, receiptNumber, bankNumber") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = JournalEntryCommand.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = JournalEntriesApiResourceSwagger.PostJournalEntriesResponse.class) }) - public String createGLJournalEntry(@ApiParam(hidden = true) final String jsonRequestBody, - @QueryParam("command") @ApiParam(value = "command") final String commandParam) { + @Parameters({ @Parameter(content = @Content(schema = @Schema(implementation = JournalEntryCommand.class))) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.PostJournalEntriesResponse.class))) }) + public String createGLJournalEntry(@Parameter(hidden = true) final String jsonRequestBody, + @QueryParam("command") @Parameter(description = "command") final String commandParam) { CommandProcessingResult result = null; if (is(commandParam, "updateRunningBalance")) { @@ -216,15 +220,14 @@ public class JournalEntriesApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Running balances for Journal Entries", notes = "This API calculates the running balances for office. If office ID not provided this API calculates running balances for all offices. \n" + @Operation(summary = "Update Running balances for Journal Entries", description = "This API calculates the running balances for office. If office ID not provided this API calculates running balances for all offices. \n" + "Mandatory Fields\n" + "officeId") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdRequest.class) }) + @RequestBody(content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdResponse.class) }) - public String createReversalJournalEntry(@ApiParam(hidden = true) final String jsonRequestBody, - @PathParam("transactionId") @ApiParam(value = "transactionId") final String transactionId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdResponse.class))) }) + public String createReversalJournalEntry(@Parameter(hidden = true) final String jsonRequestBody, + @PathParam("transactionId") @Parameter(description = "transactionId") final String transactionId, + @QueryParam("command") @Parameter(description = "command") final String commandParam) { CommandProcessingResult result = null; if (is(commandParam, "reverse")) { final CommandWrapper commandRequest = new CommandWrapperBuilder().reverseJournalEntry(transactionId).withJson(jsonRequestBody) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResourceSwagger.java index 86b09db53..a1cea3d0b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.journalentry.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 25/7/17. @@ -28,39 +27,39 @@ final class JournalEntriesApiResourceSwagger { private JournalEntriesApiResourceSwagger() {} - @ApiModel(value = "PostJournalEntriesResponse") + @Schema(description = "PostJournalEntriesResponse") public static final class PostJournalEntriesResponse { private PostJournalEntriesResponse() { } - @ApiModelProperty(value = "1") + @Schema(description = "1") public Long officeId; - @ApiModelProperty(value = "RS9MCISID4WK1ZM") + @Schema(description = "RS9MCISID4WK1ZM") public String transactionId; } - @ApiModel(value = "PostJournalEntriesTransactionIdRequest") + @Schema(description = "PostJournalEntriesTransactionIdRequest") public static final class PostJournalEntriesTransactionIdRequest { private PostJournalEntriesTransactionIdRequest() { } - @ApiModelProperty(value = "1") + @Schema(description = "1") public Long officeId; } - @ApiModel(value = "PostJournalEntriesTransactionIdResponse") + @Schema(description = "PostJournalEntriesTransactionIdResponse") public static final class PostJournalEntriesTransactionIdResponse { private PostJournalEntriesTransactionIdResponse() { } - @ApiModelProperty(value = "1") + @Schema(description = "1") public Long officeId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java index 205254422..3ee7f4734 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.accounting.provisioning.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -62,11 +62,9 @@ import org.springframework.stereotype.Component; @Path("/provisioningentries") @Component @Scope("singleton") -@Api(tags = { "Provisioning Entries" }) -@SwaggerDefinition(tags = { - @Tag(name = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n" - + "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" - + "createjournalentries\n" + "Boolean variable whether to add journal entries for generated provisioning entries\n") }) +@Tag(name = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n" + + "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" + "createjournalentries\n" + + "Boolean variable whether to add journal entries for generated provisioning entries\n") public class ProvisioningEntriesApiResource { private final PlatformSecurityContext platformSecurityContext; @@ -97,13 +95,12 @@ public class ProvisioningEntriesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create new Provisioning Entries", notes = "Creates a new Provisioning Entries\n" + "\n" + "Mandatory Fields\n" - + "date\n" + "dateFormat\n" + "locale\n" + "Optional Fields\n" + "createjournalentries") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = ProvisioningEntriesApiResourceSwagger.PostProvisioningEntriesRequest.class) }) + @Operation(summary = "Create new Provisioning Entries", description = "Creates a new Provisioning Entries\n" + "\n" + + "Mandatory Fields\n" + "date\n" + "dateFormat\n" + "locale\n" + "Optional Fields\n" + "createjournalentries") + @RequestBody(content = @Content(schema = @Schema(implementation = ProvisioningEntriesApiResourceSwagger.PostProvisioningEntriesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ProvisioningEntriesApiResourceSwagger.PostProvisioningEntriesResponse.class) }) - public String createProvisioningEntries(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningEntriesApiResourceSwagger.PostProvisioningEntriesResponse.class))) }) + public String createProvisioningEntries(@Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = null; this.platformSecurityContext.authenticatedUser(); commandWrapper = new CommandWrapperBuilder().createProvisioningEntries().withJson(apiRequestBodyAsJson).build(); @@ -115,14 +112,13 @@ public class ProvisioningEntriesApiResource { @Path("{entryId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Recreates Provisioning Entry", notes = "Recreates Provisioning Entry | createjournalentry.") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = ProvisioningEntriesApiResourceSwagger.PutProvisioningEntriesRequest.class) }) + @Operation(summary = "Recreates Provisioning Entry", description = "Recreates Provisioning Entry | createjournalentry.") + @RequestBody(content = @Content(schema = @Schema(implementation = ProvisioningEntriesApiResourceSwagger.PutProvisioningEntriesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ProvisioningEntriesApiResourceSwagger.PutProvisioningEntriesResponse.class) }) - public String modifyProvisioningEntry(@PathParam("entryId") @ApiParam(value = "entryId") final Long entryId, - @QueryParam("command") @ApiParam(value = "command=createjournalentry\ncommand=recreateprovisioningentry") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningEntriesApiResourceSwagger.PutProvisioningEntriesResponse.class))) }) + public String modifyProvisioningEntry(@PathParam("entryId") @Parameter(description = "entryId") final Long entryId, + @QueryParam("command") @Parameter(description = "command=createjournalentry\ncommand=recreateprovisioningentry") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = null; this.platformSecurityContext.authenticatedUser(); if ("createjournalentry".equals(commandParam)) { @@ -143,9 +139,10 @@ public class ProvisioningEntriesApiResource { @Path("{entryId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieves a Provisioning Entry", notes = "Returns the details of a generated Provisioning Entry.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ProvisioningEntryData.class) }) - public String retrieveProvisioningEntry(@PathParam("entryId") @ApiParam(value = "entryId") final Long entryId, + @Operation(summary = "Retrieves a Provisioning Entry", description = "Returns the details of a generated Provisioning Entry.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningEntryData.class))) }) + public String retrieveProvisioningEntry(@PathParam("entryId") @Parameter(description = "entryId") final Long entryId, @Context final UriInfo uriInfo) { platformSecurityContext.authenticatedUser(); ProvisioningEntryData data = this.provisioningEntriesReadPlatformService.retrieveProvisioningEntryData(entryId); @@ -157,7 +154,8 @@ public class ProvisioningEntriesApiResource { @Path("entries") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = LoanProductProvisioningEntryData.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = LoanProductProvisioningEntryData.class))) }) public String retrieveProviioningEntries(@QueryParam("entryId") final Long entryId, @QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit, @QueryParam("officeId") final Long officeId, @QueryParam("productId") final Long productId, @QueryParam("categoryId") final Long categoryId, @@ -172,10 +170,11 @@ public class ProvisioningEntriesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List all Provisioning Entries") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ProvisioningEntryData.class, responseContainer = "list") }) - public String retrieveAllProvisioningEntries(@QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, @Context final UriInfo uriInfo) { + @Operation(summary = "List all Provisioning Entries") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ProvisioningEntryData.class)))) }) + public String retrieveAllProvisioningEntries(@QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, @Context final UriInfo uriInfo) { platformSecurityContext.authenticatedUser(); Page data = this.provisioningEntriesReadPlatformService.retrieveAllProvisioningEntries(offset, limit); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResourceSwagger.java index 1b413563a..86a139d60 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.provisioning.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 25/7/17. @@ -30,23 +29,23 @@ final class ProvisioningEntriesApiResourceSwagger { // only for Swagger Documentation } - @ApiModel(value = "PostProvisioningEntriesRequest") + @Schema(description = "PostProvisioningEntriesRequest") public static final class PostProvisioningEntriesRequest { private PostProvisioningEntriesRequest() { } - @ApiModelProperty(example = "16 October 2015") + @Schema(example = "16 October 2015") public String date; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "true") + @Schema(example = "true") public String createjournalentries; public String provisioningentry; @@ -54,36 +53,36 @@ final class ProvisioningEntriesApiResourceSwagger { public String entries; } - @ApiModel(value = "PostProvisioningEntriesResponse") + @Schema(description = "PostProvisioningEntriesResponse") public static final class PostProvisioningEntriesResponse { private PostProvisioningEntriesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PutProvisioningEntriesRequest") + @Schema(description = "PutProvisioningEntriesRequest") public static final class PutProvisioningEntriesRequest { private PutProvisioningEntriesRequest() { } - @ApiModelProperty(example = "recreateprovisioningentry") + @Schema(example = "recreateprovisioningentry") public String command; } - @ApiModel(value = "PutProvisioningEntriesResponse") + @Schema(description = "PutProvisioningEntriesResponse") public static final class PutProvisioningEntriesResponse { private PutProvisioningEntriesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java index 3f9570e66..23424b4c9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.accounting.rule.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -73,15 +73,13 @@ import org.springframework.stereotype.Component; @Path("/accountingrules") @Component @Scope("singleton") -@Api(tags = { "Accounting Rules" }) -@SwaggerDefinition(tags = { - @Tag(name = "Accounting Rules", description = "It is typical scenario in MFI's that non accountants pass journal entries on a regular basis. For Ex: A branch office might deposit their entire cash at hand to their Bank account at the end of a working day. The branch office users might not understand enough of accounting to figure out which account needs to get credited and which account needs to be debited to represent this transaction.\n" - + "\n" - + "Enter accounting rules, an abstraction on top of manual Journal entires for enabling simpler data entry. An accounting rule can define any of the following abstractions\n" - + "\n" + "A Simple journal entry where both the credit and debit account have been preselected\n" - + "A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of \"Bank of America\" of \"JP Morgan\" and credit account should be \"Cash\")\n" - + "A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either \"Bank Of America\" or \"Cash\" and debit account can be \"Employee Salary\" and/or \"Miscellenous Expenses\")\n" - + "An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule") }) +@Tag(name = "Accounting Rules", description = "It is typical scenario in MFI's that non accountants pass journal entries on a regular basis. For Ex: A branch office might deposit their entire cash at hand to their Bank account at the end of a working day. The branch office users might not understand enough of accounting to figure out which account needs to get credited and which account needs to be debited to represent this transaction.\n" + + "\n" + + "Enter accounting rules, an abstraction on top of manual Journal entires for enabling simpler data entry. An accounting rule can define any of the following abstractions\n" + + "\n" + "A Simple journal entry where both the credit and debit account have been preselected\n" + + "A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of \"Bank of America\" of \"JP Morgan\" and credit account should be \"Cash\")\n" + + "A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either \"Bank Of America\" or \"Cash\" and debit account can be \"Employee Salary\" and/or \"Miscellenous Expenses\")\n" + + "An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule") public class AccountingRuleApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -121,10 +119,10 @@ public class AccountingRuleApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Accounting Rule Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Accounting Rule Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "accountingrules/template") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.GetAccountRulesTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.GetAccountRulesTemplateResponse.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -139,10 +137,10 @@ public class AccountingRuleApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Accounting Rules", notes = "Returns the list of defined accounting rules.\n" + "\n" + @Operation(summary = "Retrieve Accounting Rules", description = "Returns the list of defined accounting rules.\n" + "\n" + "Example Requests:\n" + "\n" + "accountingrules") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.GetAccountRulesResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.GetAccountRulesResponse.class)))) }) public String retrieveAllAccountingRules(@Context final UriInfo uriInfo) { final AppUser currentUser = this.context.authenticatedUser(); @@ -171,10 +169,12 @@ public class AccountingRuleApiResource { @Path("{accountingRuleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Accounting rule", notes = "Returns the details of a defined Accounting rule.\n" + "\n" + @Operation(summary = "Retrieve a Accounting rule", description = "Returns the details of a defined Accounting rule.\n" + "\n" + "Example Requests:\n" + "\n" + "accountingrules/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = AccountingRuleData.class) }) - public String retreiveAccountingRule(@PathParam("accountingRuleId") @ApiParam(value = "accountingRuleId") final Long accountingRuleId, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountingRuleData.class))) }) + public String retreiveAccountingRule( + @PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -191,13 +191,13 @@ public class AccountingRuleApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create/Define a Accounting rule", notes = "Define a new Accounting rule.\n" + "\n" + "Mandatory Fields\n" + @Operation(summary = "Create/Define a Accounting rule", description = "Define a new Accounting rule.\n" + "\n" + "Mandatory Fields\n" + "name, officeId,\n" + "accountToDebit OR debitTags,\n" + "accountToCredit OR creditTags.\n" + "\n" + "Optional Fields\n" + "description") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = AccountingRuleApiResourceSwagger.PostAccountingRulesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.PostAccountingRulesResponse.class) }) - public String createAccountingRule(@ApiParam(hidden = true) final String jsonRequestBody) { + @RequestBody(content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PostAccountingRulesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PostAccountingRulesResponse.class))) }) + public String createAccountingRule(@Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createAccountingRule().withJson(jsonRequestBody).build(); @@ -210,12 +210,13 @@ public class AccountingRuleApiResource { @Path("{accountingRuleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Accounting Rule", notes = "Updates the details of a Accounting rule.") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = AccountingRuleApiResourceSwagger.PutAccountingRulesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.PutAccountingRulesResponse.class) }) - public String updateAccountingRule(@PathParam("accountingRuleId") @ApiParam(value = "accountingRuleId") final Long accountingRuleId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(summary = "Update a Accounting Rule", description = "Updates the details of a Accounting rule.") + @RequestBody(content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PutAccountingRulesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PutAccountingRulesResponse.class))) }) + public String updateAccountingRule( + @PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateAccountingRule(accountingRuleId).withJson(jsonRequestBody) .build(); @@ -228,10 +229,11 @@ public class AccountingRuleApiResource { @Path("{accountingRuleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Accounting Rule", notes = "Deletes a Accounting rule.") + @Operation(summary = "Delete a Accounting Rule", description = "Deletes a Accounting rule.") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.DeleteAccountingRulesResponse.class) }) - public String deleteAccountingRule(@PathParam("accountingRuleId") @ApiParam(value = "accountingRuleId") final Long accountingRuleId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.DeleteAccountingRulesResponse.class))) }) + public String deleteAccountingRule( + @PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteAccountingRule(accountingRuleId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResourceSwagger.java index a29bb382a..019ff7eda 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.accounting.rule.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.List; import org.apache.fineract.accounting.glaccount.data.GLAccountData; @@ -35,7 +34,7 @@ final class AccountingRuleApiResourceSwagger { // For Swagger Documentation } - @ApiModel(value = "GetAccountRulesResponse") + @Schema(description = "GetAccountRulesResponse") public static final class GetAccountRulesResponse { private GetAccountRulesResponse() { @@ -54,63 +53,63 @@ final class AccountingRuleApiResourceSwagger { public List debitTags; } - @ApiModel(value = "GetAccountRulesTemplateResponse") + @Schema(description = "GetAccountRulesTemplateResponse") public static final class GetAccountRulesTemplateResponse { private GetAccountRulesTemplateResponse() { } - @ApiModelProperty(example = "false") + @Schema(example = "false") public boolean systemDefined; public List allowedOffices = new ArrayList(); public List allowedAccounts = new ArrayList(); } - @ApiModel(value = "PostAccountingRulesRequest") + @Schema(description = "PostAccountingRulesRequest") public static final class PostAccountingRulesRequest { private PostAccountingRulesRequest() { } - @ApiModelProperty(example = "test") + @Schema(example = "test") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "21") + @Schema(example = "21") public Long accountToDebit; - @ApiModelProperty(example = "9") + @Schema(example = "9") public Long accountToCredit; - @ApiModelProperty(example = "Employee salary") + @Schema(example = "Employee salary") public String description; } - @ApiModel(value = "PostAccountingRulesResponse") + @Schema(description = "PostAccountingRulesResponse") public static final class PostAccountingRulesResponse { private PostAccountingRulesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PutAccountingRulesRequest") + @Schema(description = "PutAccountingRulesRequest") public static final class PutAccountingRulesRequest { private PutAccountingRulesRequest() { } - @ApiModelProperty(example = "Employee Salary posting rule") + @Schema(example = "Employee Salary posting rule") public String name; } - @ApiModel(value = "PutAccountingRulesResponse") + @Schema(description = "PutAccountingRulesResponse") public static final class PutAccountingRulesResponse { private PutAccountingRulesResponse() { @@ -121,23 +120,23 @@ final class AccountingRuleApiResourceSwagger { public PutAccountingRulesResponsechangesSwagger() {} - @ApiModelProperty(example = "Employee Salary posting rule") + @Schema(example = "Employee Salary posting rule") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutAccountingRulesResponsechangesSwagger changes; } - @ApiModel(value = "DeleteAccountingRulesResponse") + @Schema(description = "DeleteAccountingRulesResponse") public static final class DeleteAccountingRulesResponse { private DeleteAccountingRulesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java index 5daf44e6c..ca57e31de 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java @@ -18,10 +18,8 @@ */ package org.apache.fineract.adhocquery.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -54,8 +52,7 @@ import org.springframework.stereotype.Component; @Path("/adhocquery") @Component @Scope("singleton") -@Api(tags = { "AdhocQuery Api" }) -@SwaggerDefinition(tags = { @Tag(name = "AdhocQuery Api", description = "") }) +@Tag(name = "AdhocQuery Api", description = "") public class AdHocApiResource { /** @@ -122,7 +119,7 @@ public class AdHocApiResource { @Path("{adHocId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String retrieveAdHocQuery(@PathParam("adHocId") @ApiParam(value = "adHocId") final Long adHocId, + public String retrieveAdHocQuery(@PathParam("adHocId") @Parameter(description = "adHocId") final Long adHocId, @Context final UriInfo uriInfo) { this.context.authenticatedUser(); @@ -138,7 +135,7 @@ public class AdHocApiResource { @Path("{adHocId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String update(@PathParam("adHocId") @ApiParam(value = "adHocId") final Long adHocId, final String apiRequestBodyAsJson) { + public String update(@PathParam("adHocId") @Parameter(description = "adHocId") final Long adHocId, final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateAdHoc(adHocId) // @@ -160,7 +157,7 @@ public class AdHocApiResource { @Path("{adHocId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String deleteAdHocQuery(@PathParam("adHocId") @ApiParam(value = "adHocId") final Long adHocId) { + public String deleteAdHocQuery(@PathParam("adHocId") @Parameter(description = "adHocId") final Long adHocId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteAdHoc(adHocId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java index 2cf855314..18d47e028 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.batch.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.ArrayList; import java.util.List; import javax.ws.rs.Consumes; @@ -64,15 +63,13 @@ import org.springframework.stereotype.Component; @Path("/batches") @Component @Scope("singleton") -@Api(tags = { "Batch API" }) -@SwaggerDefinition(tags = { - @Tag(name = "Batch API", description = "The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.\n" - + "\n" - + "The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an optional body (for POST and PUT requests). The Batch API returns an array of logical HTTP responses represented as JSON arrays - each response has a requestId, a status code, an optional headers array and an optional body (which is a JSON encoded string).\n" - + "\n" - + "Batch API uses Json Path to handle dependent parameters. For example, if request '2' is referencing request '1' and in the \"body\" or in \"relativeUrl\" of request '2', there is a dependent parameter (which will look like \"$.parameter_name\"), then Batch API will internally substitute this dependent parameter from the response body of request '1'.\n" - + "\n" - + "Batch API is able to handle deeply nested dependent requests as well nested parameters. As shown in the example, requests are dependent on each other as, 1<--2<--6, i.e a nested dependency, where request '6' is not directly dependent on request '1' but still it is one of the nested child of request '1'. In the same way Batch API could handle a deeply nested dependent value, such as {..[..{..,$.parameter_name,..}..]}.") }) +@Tag(name = "Batch API", description = "The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.\n" + + "\n" + + "The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an optional body (for POST and PUT requests). The Batch API returns an array of logical HTTP responses represented as JSON arrays - each response has a requestId, a status code, an optional headers array and an optional body (which is a JSON encoded string).\n" + + "\n" + + "Batch API uses Json Path to handle dependent parameters. For example, if request '2' is referencing request '1' and in the \"body\" or in \"relativeUrl\" of request '2', there is a dependent parameter (which will look like \"$.parameter_name\"), then Batch API will internally substitute this dependent parameter from the response body of request '1'.\n" + + "\n" + + "Batch API is able to handle deeply nested dependent requests as well nested parameters. As shown in the example, requests are dependent on each other as, 1<--2<--6, i.e a nested dependency, where request '6' is not directly dependent on request '1' but still it is one of the nested child of request '1'. In the same way Batch API could handle a deeply nested dependent value, such as {..[..{..,$.parameter_name,..}..]}.") public class BatchApiResource { private final PlatformSecurityContext context; @@ -109,15 +106,15 @@ public class BatchApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Batch requests in a single transaction", httpMethod = "POST", notes = "The Apache Fineract Batch API is also capable of executing all the requests in a single transaction, by setting a Query Parameter, \"enclosingTransaction=true\". So, if one or more of the requests in a batch returns an erroneous response all of the Data base transactions made by other successful requests will be rolled back.\n" + @Operation(summary = "Batch requests in a single transaction", description = "The Apache Fineract Batch API is also capable of executing all the requests in a single transaction, by setting a Query Parameter, \"enclosingTransaction=true\". So, if one or more of the requests in a batch returns an erroneous response all of the Data base transactions made by other successful requests will be rolled back.\n" + "\n" + "If there has been a rollback in a transaction then a single response will be provided, with a '400' status code and a body consisting of the error details of the first failed request.") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", dataType = "BatchRequest", required = true, type = "body", dataTypeClass = BatchApiResourceSwagger.PostBatchesRequest.class, value = "request body") }) - @ApiResponses({ @ApiResponse(code = 200, message = "Success", response = BatchResponse.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = BatchApiResourceSwagger.PostBatchesRequest.class, description = "request body"))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "Success", content = @Content(schema = @Schema(implementation = BatchResponse.class))) }) public String handleBatchRequests( - @DefaultValue("false") @QueryParam("enclosingTransaction") @ApiParam(value = "enclosingTransaction", defaultValue = "false") final boolean enclosingTransaction, - @ApiParam(hidden = true) final String jsonRequestString, @Context UriInfo uriInfo) { + @DefaultValue("false") @QueryParam("enclosingTransaction") @Parameter(description = "enclosingTransaction", required = false) final boolean enclosingTransaction, + @Parameter(hidden = true) final String jsonRequestString, @Context UriInfo uriInfo) { // Handles user authentication this.context.authenticatedUser(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResourceSwagger.java index c016c3bcc..3d62f1000 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.batch.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; import org.apache.fineract.batch.domain.Header; @@ -32,7 +31,7 @@ final class BatchApiResourceSwagger { } - @ApiModel(value = "PostBatchesRequest") + @Schema(description = "PostBatchesRequest") public static final class PostBatchesRequest { private PostBatchesRequest() { @@ -45,35 +44,35 @@ final class BatchApiResourceSwagger { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "\"Petra\"") + @Schema(example = "\"Petra\"") public String firstname; - @ApiModelProperty(example = "\"Yton\"") + @Schema(example = "\"Yton\"") public String lastname; - @ApiModelProperty(example = "\"ex_externalId1\"") + @Schema(example = "\"ex_externalId1\"") public String externalId; - @ApiModelProperty(example = "\"dd MMMM yyyy\"") + @Schema(example = "\"dd MMMM yyyy\"") public String dateFormat; - @ApiModelProperty(example = "\"en\"") + @Schema(example = "\"en\"") public String locale; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean active; - @ApiModelProperty(example = "\"04 March 2009\"") + @Schema(example = "\"04 March 2009\"") public String activationDate; - @ApiModelProperty(example = "\"04 March 2009\"") + @Schema(example = "\"04 March 2009\"") public String submittedOnDate; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long requestId; - @ApiModelProperty(example = "clients") + @Schema(example = "clients") public String relativeUrl; - @ApiModelProperty(example = "POST") + @Schema(example = "POST") public String method; public Set
headers; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long reference; public PostBodyRequestSwagger body; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java index f5934b934..06e0276c2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.commands.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -55,13 +56,11 @@ import org.springframework.stereotype.Component; @Path("/audits") @Component @Scope("singleton") -@Api(tags = { "Audits" }) -@SwaggerDefinition(tags = { - @Tag(name = "Audits", description = "Every non-read Mifos API request is audited. A fully processed request can not be changed or deleted. See maker checker api for situations where an audit is not fully processed.\n" - + "\n" - + "Permissions: To search and look at audit entries a user needs to be attached to a role that has one of the ALL_FUNCTIONS, ALL_FUNCTIONS_READ or READ_AUDIT permissions.\n" - + "\n" - + "Data Scope: A user can only see audits that are within their data scope. However, 'head office' users can see all audits including those that aren't office/branch related e.g. Loan Product changes.\")") }) +@Tag(name = "Audits", description = "Every non-read Mifos API request is audited. A fully processed request can not be changed or deleted. See maker checker api for situations where an audit is not fully processed.\n" + + "\n" + + "Permissions: To search and look at audit entries a user needs to be attached to a role that has one of the ALL_FUNCTIONS, ALL_FUNCTIONS_READ or READ_AUDIT permissions.\n" + + "\n" + + "Data Scope: A user can only see audits that are within their data scope. However, 'head office' users can see all audits including those that aren't office/branch related e.g. Loan Product changes.\")") public class AuditsApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId", @@ -90,33 +89,33 @@ public class AuditsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Audits", notes = "Get a 200 list of audits that match the criteria supplied and sorted by audit id in descending order, and are within the requestors' data scope. Also it supports pagination and sorting\n" + @Operation(summary = "List Audits", description = "Get a 200 list of audits that match the criteria supplied and sorted by audit id in descending order, and are within the requestors' data scope. Also it supports pagination and sorting\n" + "\n" + "Example Requests:\n" + "\n" + "audits\n" + "\n" + "audits?fields=madeOnDate,maker,processingResult\n" + "\n" + "audits?makerDateTimeFrom=2013-03-25 08:00:00&makerDateTimeTo=2013-04-04 18:00:00\n" + "\n" + "audits?officeId=1\n" + "\n" + "audits?officeId=1&includeJson=true") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class)))) }) public String retrieveAuditEntries(@Context final UriInfo uriInfo, - @QueryParam("actionName") @ApiParam(value = "actionName") final String actionName, - @QueryParam("entityName") @ApiParam(value = "entityName") final String entityName, - @QueryParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, - @QueryParam("makerId") @ApiParam(value = "makerId") final Long makerId, - @QueryParam("makerDateTimeFrom") @ApiParam(value = "makerDateTimeFrom") final String makerDateTimeFrom, - @QueryParam("makerDateTimeTo") @ApiParam(value = "makerDateTimeTo") final String makerDateTimeTo, - @QueryParam("checkerId") @ApiParam(value = "checkerId") final Long checkerId, - @QueryParam("checkerDateTimeFrom") @ApiParam(value = "checkerDateTimeFrom") final String checkerDateTimeFrom, - @QueryParam("checkerDateTimeTo") @ApiParam(value = "checkerDateTimeTo") final String checkerDateTimeTo, - @QueryParam("processingResult") @ApiParam(value = "processingResult") final Integer processingResult, - @QueryParam("officeId") @ApiParam(value = "officeId") final Integer officeId, - @QueryParam("groupId") @ApiParam(value = "groupId") final Integer groupId, - @QueryParam("clientId") @ApiParam(value = "clientId") final Integer clientId, - @QueryParam("loanid") @ApiParam(value = "loanid") final Integer loanId, - @QueryParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Integer savingsAccountId, - @QueryParam("paged") @ApiParam(value = "paged") final Boolean paged, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @QueryParam("actionName") @Parameter(description = "actionName") final String actionName, + @QueryParam("entityName") @Parameter(description = "entityName") final String entityName, + @QueryParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, + @QueryParam("makerId") @Parameter(description = "makerId") final Long makerId, + @QueryParam("makerDateTimeFrom") @Parameter(description = "makerDateTimeFrom") final String makerDateTimeFrom, + @QueryParam("makerDateTimeTo") @Parameter(description = "makerDateTimeTo") final String makerDateTimeTo, + @QueryParam("checkerId") @Parameter(description = "checkerId") final Long checkerId, + @QueryParam("checkerDateTimeFrom") @Parameter(description = "checkerDateTimeFrom") final String checkerDateTimeFrom, + @QueryParam("checkerDateTimeTo") @Parameter(description = "checkerDateTimeTo") final String checkerDateTimeTo, + @QueryParam("processingResult") @Parameter(description = "processingResult") final Integer processingResult, + @QueryParam("officeId") @Parameter(description = "officeId") final Integer officeId, + @QueryParam("groupId") @Parameter(description = "groupId") final Integer groupId, + @QueryParam("clientId") @Parameter(description = "clientId") final Integer clientId, + @QueryParam("loanid") @Parameter(description = "loanid") final Integer loanId, + @QueryParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Integer savingsAccountId, + @QueryParam("paged") @Parameter(description = "paged") final Boolean paged, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder); @@ -141,10 +140,11 @@ public class AuditsApiResource { @Path("{auditId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve an Audit Entry", notes = "Example Requests:\n" + "\n" + "audits/20\n" + @Operation(summary = "Retrieve an Audit Entry", description = "Example Requests:\n" + "\n" + "audits/20\n" + "audits/20?fields=madeOnDate,maker,processingResult") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class) }) - public String retrieveAuditEntry(@PathParam("auditId") @ApiParam(value = "auditId") final Long auditId, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class))) }) + public String retrieveAuditEntry(@PathParam("auditId") @Parameter(description = "auditId") final Long auditId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -159,10 +159,10 @@ public class AuditsApiResource { @Path("/searchtemplate") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Audit Search Template", notes = "This is a convenience resource. It can be useful when building an Audit Search UI. \"appUsers\" are data scoped to the office/branch the requestor is associated with.\n" + @Operation(summary = "Audit Search Template", description = "This is a convenience resource. It can be useful when building an Audit Search UI. \"appUsers\" are data scoped to the office/branch the requestor is associated with.\n" + "\n" + "Example Requests:\n" + "\n" + "audits/searchtemplate\n" + "audits/searchtemplate?fields=actionNames") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class))) }) public String retrieveAuditSearchTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java index 14edbc945..8b7c45b43 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.commands.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -58,8 +59,7 @@ import org.springframework.stereotype.Component; @Path("/makercheckers") @Component @Scope("singleton") -@Api(tags = { "Maker Checker (or 4-eye) functionality" }) -@SwaggerDefinition(tags = { @Tag(name = "Maker Checker (or 4-eye) functionality") }) +@Tag(name = "Maker Checker (or 4-eye) functionality") public class MakercheckersApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId", @@ -88,24 +88,24 @@ public class MakercheckersApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Maker Checker Entries", notes = "Get a list of entries that can be checked by the requestor that match the criteria supplied.\n" + @Operation(summary = "List Maker Checker Entries", description = "Get a list of entries that can be checked by the requestor that match the criteria supplied.\n" + "\n" + "Example Requests:\n" + "\n" + "makercheckers\n" + "\n" + "makercheckers?fields=madeOnDate,maker,processingResult\n" + "\n" + "makercheckers?makerDateTimeFrom=2013-03-25 08:00:00&makerDateTimeTo=2013-04-04 18:00:00\n" + "\n" + "makercheckers?officeId=1\n" + "\n" + "makercheckers?officeId=1&includeJson=true") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class)))) }) public String retrieveCommands(@Context final UriInfo uriInfo, - @QueryParam("actionName") @ApiParam(value = "actionName") final String actionName, - @QueryParam("entityName") @ApiParam(value = "entityName") final String entityName, - @QueryParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, - @QueryParam("makerId") @ApiParam(value = "makerId") final Long makerId, - @QueryParam("makerDateTimeFrom") @ApiParam(value = "makerDateTimeFrom") final String makerDateTimeFrom, - @QueryParam("makerDateTimeTo") @ApiParam(value = "makerDateTimeTo") final String makerDateTimeTo, - @QueryParam("officeId") @ApiParam(value = "officeId") final Integer officeId, - @QueryParam("groupId") @ApiParam(value = "groupId") final Integer groupId, - @QueryParam("clientId") @ApiParam(value = "clientId") final Integer clientId, - @QueryParam("loanid") @ApiParam(value = "loanid") final Integer loanId, - @QueryParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Integer savingsAccountId) { + @QueryParam("actionName") @Parameter(description = "actionName") final String actionName, + @QueryParam("entityName") @Parameter(description = "entityName") final String entityName, + @QueryParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, + @QueryParam("makerId") @Parameter(description = "makerId") final Long makerId, + @QueryParam("makerDateTimeFrom") @Parameter(description = "makerDateTimeFrom") final String makerDateTimeFrom, + @QueryParam("makerDateTimeTo") @Parameter(description = "makerDateTimeTo") final String makerDateTimeTo, + @QueryParam("officeId") @Parameter(description = "officeId") final Integer officeId, + @QueryParam("groupId") @Parameter(description = "groupId") final Integer groupId, + @QueryParam("clientId") @Parameter(description = "clientId") final Integer clientId, + @QueryParam("loanid") @Parameter(description = "loanid") final Integer loanId, + @QueryParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Integer savingsAccountId) { final SQLBuilder extraCriteria = getExtraCriteria(actionName, entityName, resourceId, makerId, makerDateTimeFrom, makerDateTimeTo, officeId, groupId, clientId, loanId, savingsAccountId); @@ -122,10 +122,10 @@ public class MakercheckersApiResource { @Path("/searchtemplate") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Maker Checker Search Template", notes = "This is a convenience resource. It can be useful when building a Checker Inbox UI. \"appUsers\" are data scoped to the office/branch the requestor is associated with. \"actionNames\" and \"entityNames\" returned are those that the requestor has Checker approval permissions for.\n" + @Operation(summary = "Maker Checker Search Template", description = "This is a convenience resource. It can be useful when building a Checker Inbox UI. \"appUsers\" are data scoped to the office/branch the requestor is associated with. \"actionNames\" and \"entityNames\" returned are those that the requestor has Checker approval permissions for.\n" + "\n" + "Example Requests:\n" + "\n" + "makercheckers/searchtemplate\n" + "makercheckers/searchtemplate?fields=entityNames") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class))) }) public String retrieveAuditSearchTemplate(@Context final UriInfo uriInfo) { final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -141,10 +141,11 @@ public class MakercheckersApiResource { @Path("{auditId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve Maker Checker Entry | Reject Maker Checker Entry") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.PostMakerCheckersResponse.class) }) - public String approveMakerCheckerEntry(@PathParam("auditId") @ApiParam(value = "auditId") final Long auditId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam) { + @Operation(summary = "Approve Maker Checker Entry | Reject Maker Checker Entry") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MakercheckersApiResourceSwagger.PostMakerCheckersResponse.class))) }) + public String approveMakerCheckerEntry(@PathParam("auditId") @Parameter(description = "auditId") final Long auditId, + @QueryParam("command") @Parameter(description = "command") final String commandParam) { CommandProcessingResult result = null; if (is(commandParam, "approve")) { @@ -166,9 +167,10 @@ public class MakercheckersApiResource { @Path("{auditId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete Maker Checker Entry") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.PostMakerCheckersResponse.class) }) - public String deleteMakerCheckerEntry(@PathParam("auditId") @ApiParam(value = "auditId") final Long auditId) { + @Operation(summary = "Delete Maker Checker Entry") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MakercheckersApiResourceSwagger.PostMakerCheckersResponse.class))) }) + public String deleteMakerCheckerEntry(@PathParam("auditId") @Parameter(description = "auditId") final Long auditId) { final Long id = this.writePlatformService.deleteEntry(auditId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResourceSwagger.java index 39b8c9d86..c5e30f746 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.commands.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.List; import org.apache.fineract.commands.data.ProcessingResultLookup; @@ -35,7 +34,7 @@ final class MakercheckersApiResourceSwagger { // only to initialize swagger documentation } - @ApiModel(value = "GetMakerCheckerResponse") + @Schema(description = "GetMakerCheckerResponse") public static final class GetMakerCheckerResponse { private GetMakerCheckerResponse() { @@ -65,7 +64,7 @@ final class MakercheckersApiResourceSwagger { } - @ApiModel(value = "GetMakerCheckersSearchTemplateResponse") + @Schema(description = "GetMakerCheckersSearchTemplateResponse") public static final class GetMakerCheckersSearchTemplateResponse { private GetMakerCheckersSearchTemplateResponse() { @@ -78,14 +77,14 @@ final class MakercheckersApiResourceSwagger { public Collection processingResults; } - @ApiModel(value = "PostMakerCheckersResponse") + @Schema(description = "PostMakerCheckersResponse") public static final class PostMakerCheckersResponse { private PostMakerCheckersResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long auditId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java index b8cda753e..73f8bf16a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.accountnumberformat.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -61,9 +61,7 @@ import org.springframework.stereotype.Component; @Path(AccountNumberFormatConstants.resourceRelativeURL) @Component @Scope("singleton") -@Api(tags = { "Account number format" }) -@SwaggerDefinition(tags = { - @Tag(name = "Account number format", description = "Account number preferences are used to describe custom formats for account numbers associated with Customer, Loan and Savings accounts.") }) +@Tag(name = "Account number format", description = "Account number preferences are used to describe custom formats for account numbers associated with Customer, Loan and Savings accounts.") public class AccountNumberFormatsApiResource { private final PlatformSecurityContext context; @@ -93,10 +91,10 @@ public class AccountNumberFormatsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Account number format Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Account number format Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "\n" + "Example Request:\n" + "\n" + "accountnumberformats/template") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsResponseTemplate.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsResponseTemplate.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(AccountNumberFormatConstants.ENTITY_NAME); @@ -111,10 +109,10 @@ public class AccountNumberFormatsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Account number formats", notes = "Example Requests:\n" + "\n" + "accountnumberformats\n" + "\n" + "\n" - + "accountnumberformats?fields=accountType,prefixType", responseContainer = "List") + @Operation(summary = "List Account number formats", description = "Example Requests:\n" + "\n" + "accountnumberformats\n" + "\n" + "\n" + + "accountnumberformats?fields=accountType,prefixType") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsIdResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsIdResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(AccountNumberFormatConstants.ENTITY_NAME); @@ -130,12 +128,12 @@ public class AccountNumberFormatsApiResource { @Path("{accountNumberFormatId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve an Account number format", notes = "Example Requests:\n" + "\n" + "accountnumberformats/1\n" + "\n" + @Operation(summary = "Retrieve an Account number format", description = "Example Requests:\n" + "\n" + "accountnumberformats/1\n" + "\n" + "\n" + "accountnumberformats/1?template=true\n" + "\n" + "\n" + "accountnumberformats/1?fields=accountType,prefixType") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsIdResponse.class))) }) public String retrieveOne(@Context final UriInfo uriInfo, - @PathParam("accountNumberFormatId") @ApiParam(value = "accountNumberFormatId") final Long accountNumberFormatId) { + @PathParam("accountNumberFormatId") @Parameter(description = "accountNumberFormatId") final Long accountNumberFormatId) { this.context.authenticatedUser().validateHasReadPermission(AccountNumberFormatConstants.ENTITY_NAME); @@ -155,13 +153,12 @@ public class AccountNumberFormatsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create an Account number format", notes = "Note: You may associate a single Account number format for a given account type\n" + @Operation(summary = "Create an Account number format", description = "Note: You may associate a single Account number format for a given account type\n" + "Mandatory Fields for Account number formats\n" + "accountType") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountNumberFormatsApiResourceSwagger.PostAccountNumberFormatsRequest.class) }) + @RequestBody(content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.PostAccountNumberFormatsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.PostAccountNumberFormatsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.PostAccountNumberFormatsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createAccountNumberFormat() // @@ -177,13 +174,13 @@ public class AccountNumberFormatsApiResource { @Path("{accountNumberFormatId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update an Account number format") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountNumberFormatsApiResourceSwagger.PutAccountNumberFormatsRequest.class) }) + @Operation(summary = "Update an Account number format") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.PutAccountNumberFormatsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.PutAccountNumberFormatsResponse.class) }) - public String update(@PathParam("accountNumberFormatId") @ApiParam(value = "accountNumberFormatId") final Long accountNumberFormatId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.PutAccountNumberFormatsResponse.class))) }) + public String update( + @PathParam("accountNumberFormatId") @Parameter(description = "accountNumberFormatId") final Long accountNumberFormatId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateAccountNumberFormat(accountNumberFormatId) // @@ -199,10 +196,11 @@ public class AccountNumberFormatsApiResource { @Path("{accountNumberFormatId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete an Account number format", notes = "Note: Account numbers created while this format was active would remain unchanged.") + @Operation(summary = "Delete an Account number format", description = "Note: Account numbers created while this format was active would remain unchanged.") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.DeleteAccountNumberFormatsResponse.class) }) - public String delete(@PathParam("accountNumberFormatId") @ApiParam(value = "accountNumberFormatId") final Long accountNumberFormatId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AccountNumberFormatsApiResourceSwagger.DeleteAccountNumberFormatsResponse.class))) }) + public String delete( + @PathParam("accountNumberFormatId") @Parameter(description = "accountNumberFormatId") final Long accountNumberFormatId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteAccountNumberFormat(accountNumberFormatId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResourceSwagger.java index 2de81f9cf..d1dfaeca3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.accountnumberformat.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import java.util.Map; import org.apache.fineract.infrastructure.core.data.EnumOptionData; @@ -33,7 +32,7 @@ final class AccountNumberFormatsApiResourceSwagger { // this class is only for Swagger implementation for Live Documentation } - @ApiModel(value = "GetAccountNumberFormatsResponse") + @Schema(description = "GetAccountNumberFormatsResponse") public static final class GetAccountNumberFormatsResponse { private GetAccountNumberFormatsResponse() { @@ -43,14 +42,14 @@ final class AccountNumberFormatsApiResourceSwagger { } - @ApiModel(value = "GetAccountNumberFormatsIdResponse") + @Schema(description = "GetAccountNumberFormatsIdResponse") public static final class GetAccountNumberFormatsIdResponse { private GetAccountNumberFormatsIdResponse() { } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long id; public EnumOptionData accountType; @@ -58,7 +57,7 @@ final class AccountNumberFormatsApiResourceSwagger { } - @ApiModel(value = "GetAccountNumberFormatsResponseTemplate") + @Schema(description = "GetAccountNumberFormatsResponseTemplate") public static final class GetAccountNumberFormatsResponseTemplate { private GetAccountNumberFormatsResponseTemplate() { @@ -70,45 +69,45 @@ final class AccountNumberFormatsApiResourceSwagger { } - @ApiModel(value = "PostAccountNumberFormatsRequest") + @Schema(description = "PostAccountNumberFormatsRequest") public static final class PostAccountNumberFormatsRequest { private PostAccountNumberFormatsRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long accountType; - @ApiModelProperty(example = "101") + @Schema(example = "101") public Long prefixType; } - @ApiModel(value = "PostAccountNumberFormatsResponse") + @Schema(description = "PostAccountNumberFormatsResponse") public static final class PostAccountNumberFormatsResponse { private PostAccountNumberFormatsResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } - @ApiModel(value = "PutAccountNumberFormatsRequest") + @Schema(description = "PutAccountNumberFormatsRequest") public static final class PutAccountNumberFormatsRequest { private PutAccountNumberFormatsRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long prefixType; } - @ApiModel(value = "PutAccountNumberFormatsResponse") + @Schema(description = "PutAccountNumberFormatsResponse") public static final class PutAccountNumberFormatsResponse { private PutAccountNumberFormatsResponse() { @@ -121,24 +120,24 @@ final class AccountNumberFormatsApiResourceSwagger { } - @ApiModelProperty(example = "OFFICE_NAME") + @Schema(example = "OFFICE_NAME") public Long prefixType; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long resourceId; public PutAccountNumberFormatschangesSwagger changes; } - @ApiModel(value = "DeleteAccountNumberFormatsResponse") + @Schema(description = "DeleteAccountNumberFormatsResponse") public static final class DeleteAccountNumberFormatsResponse { private DeleteAccountNumberFormatsResponse() { } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long resourceId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java index 2d2973185..95ee3e238 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.cache.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -59,11 +59,9 @@ import org.springframework.stereotype.Component; @Produces({ MediaType.APPLICATION_JSON }) @Component @Scope("singleton") -@Api(tags = { "Cache" }) -@SwaggerDefinition(tags = { @Tag(name = "Cache", description = "The following settings are possible for cache:\n" + "\n" - + "No Caching: caching turned off\n" +@Tag(name = "Cache", description = "The following settings are possible for cache:\n" + "\n" + "No Caching: caching turned off\n" + "Single node: caching on for single instance deployments of platorm (works for multiple tenants but only one tomcat)\n" - + "By default caching is set to No Caching. Switching between caches results in the cache been clear e.g. from Single node to No cache and back again would clear down the single node cache.") }) + + "By default caching is set to No Caching. Switching between caches results in the cache been clear e.g. from Single node to No cache and back again would clear down the single node cache.") public class CacheApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id")); @@ -88,9 +86,10 @@ public class CacheApiResource { } @GET - @ApiOperation(value = "Retrieve Cache Types", notes = "Returns the list of caches.\n" + "\n" + "Example Requests:\n" + "\n" + "caches") + @Operation(summary = "Retrieve Cache Types", description = "Returns the list of caches.\n" + "\n" + "Example Requests:\n" + "\n" + + "caches") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = CacheApiResourceSwagger.GetCachesResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = CacheApiResourceSwagger.GetCachesResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -102,11 +101,11 @@ public class CacheApiResource { } @PUT - @ApiOperation(value = "Switch Cache", notes = "Switches the cache to chosen one.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CacheApiResourceSwagger.PutCachesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CacheApiResourceSwagger.PutCachesResponse.class) }) - public String switchCache(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Switch Cache", description = "Switches the cache to chosen one.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CacheApiResourceSwagger.PutCachesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CacheApiResourceSwagger.PutCachesResponse.class))) }) + public String switchCache(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCache().withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResourceSwagger.java index 7e0382229..8bce43c65 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.cache.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.fineract.infrastructure.core.data.EnumOptionData; /** @@ -31,7 +30,7 @@ final class CacheApiResourceSwagger { } - @ApiModel(value = "GetCachesResponse") + @Schema(description = "GetCachesResponse") public static final class GetCachesResponse { private GetCachesResponse() { @@ -42,19 +41,19 @@ final class CacheApiResourceSwagger { public boolean enabled; } - @ApiModel(value = "PutCachesRequest") + @Schema(description = "PutCachesRequest") public static final class PutCachesRequest { private PutCachesRequest() { } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long cacheType; } - @ApiModel(value = "PutCachesResponse") + @Schema(description = "PutCachesResponse") public static final class PutCachesResponse { private PutCachesResponse() { @@ -67,7 +66,7 @@ final class CacheApiResourceSwagger { } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long cacheType; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java index 00001057e..257580587 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java @@ -19,12 +19,12 @@ package org.apache.fineract.infrastructure.campaigns.sms.api; import com.google.gson.JsonElement; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import java.util.HashSet; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -64,7 +64,6 @@ import org.springframework.stereotype.Component; @Path("/smscampaigns") @Component @Scope("singleton") -@Api(value = "SMS Campaigns") public class SmsCampaignApiResource { private final PlatformSecurityContext platformSecurityContext; @@ -100,9 +99,9 @@ public class SmsCampaignApiResource { @GET @Path("template") - @ApiOperation(value = "Retrieve a SMS Campaign", notes = "Example Requests:\n" + "\n" + "smscampaigns/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a SMS Campaign", description = "Example Requests:\n" + "\n" + "smscampaigns/1\n" + "\n" + "\n" + "smscampaigns/1?template=true\n" + "\n" + "\n" + "smscampaigns/template") - @ApiResponse(code = 200, message = "", response = SmsCampaignData.class) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SmsCampaignData.class))) public String template(@Context final UriInfo uriInfo) { this.platformSecurityContext.authenticatedUser().validateHasReadPermission(SmsCampaignConstants.RESOURCE_NAME); final SmsCampaignData smsCampaignData = this.smsCampaignReadPlatformService.retrieveTemplate(CampaignType.SMS.name()); @@ -113,13 +112,12 @@ public class SmsCampaignApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a SMS Campaign", notes = "Mandatory Fields\n" + @Operation(summary = "Create a SMS Campaign", description = "Mandatory Fields\n" + "campaignName, campaignType, triggerType, providerId, runReportId, message\n" + "\n" + "Mandatory Fields for Cash based on selected report id\n" + "paramValue in json format") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CommandWrapper.class) }) - @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) - public String createCampaign(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CommandWrapper.class))) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class))) + public String createCampaign(@Parameter(hidden = true) final String apiRequestBodyAsJson) { this.platformSecurityContext.authenticatedUser(); final CommandWrapper commandRequest = new CommandWrapperBuilder().createSmsCampaign().withJson(apiRequestBodyAsJson).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); @@ -129,8 +127,8 @@ public class SmsCampaignApiResource { @GET @Path("{resourceId}") @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a SMS Campaign", notes = "Example Requests:\n" + "\n" + "smscampaigns/1\n") - @ApiResponse(code = 200, message = "", response = SmsCampaignData.class) + @Operation(summary = "Retrieve a SMS Campaign", description = "Example Requests:\n" + "\n" + "smscampaigns/1\n") + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SmsCampaignData.class))) public String retrieveCampaign(@PathParam("resourceId") final Long resourceId, @Context final UriInfo uriInfo) { this.platformSecurityContext.authenticatedUser().validateHasReadPermission(SmsCampaignConstants.RESOURCE_NAME); SmsCampaignData smsCampaignData = this.smsCampaignReadPlatformService.retrieveOne(resourceId); @@ -141,8 +139,8 @@ public class SmsCampaignApiResource { @GET @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List SMS Campaigns", notes = "Example Requests:\n" + "\n" + "smscampaigns") - @ApiResponse(code = 200, message = "", response = SmsCampaignData.class) + @Operation(summary = "List SMS Campaigns", description = "Example Requests:\n" + "\n" + "smscampaigns") + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SmsCampaignData.class))) public String retrieveAllEmails(@QueryParam("sqlSearch") final String sqlSearch, @QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit, @QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder, @Context final UriInfo uriInfo) { @@ -157,12 +155,11 @@ public class SmsCampaignApiResource { @Path("{campaignId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Campaign") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CommandWrapper.class) }) - @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) + @Operation(summary = "Update a Campaign") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CommandWrapper.class))) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class))) public String updateCampaign(@PathParam("campaignId") final Long campaignId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSmsCampaign(campaignId).withJson(apiRequestBodyAsJson) .build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); @@ -173,10 +170,10 @@ public class SmsCampaignApiResource { @Path("{campaignId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "SMS Campaign", notes = "Activates | Deactivates | Reactivates") - @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) + @Operation(summary = "SMS Campaign", description = "Activates | Deactivates | Reactivates") + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class))) public String handleCommands(@PathParam("campaignId") final Long campaignId, @QueryParam("command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); CommandProcessingResult result = null; CommandWrapper commandRequest = null; @@ -211,8 +208,8 @@ public class SmsCampaignApiResource { @DELETE @Path("{campaignId}") - @ApiOperation(value = "Delete a SMS Campaign", notes = "Note: Only closed SMS Campaigns can be deleted") - @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) + @Operation(summary = "Delete a SMS Campaign", description = "Note: Only closed SMS Campaigns can be deleted") + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class))) public String delete(@PathParam("campaignId") final Long campaignId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSmsCampaign(campaignId).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java index 75c162ce4..caa95f9f3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.codes.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -61,11 +61,9 @@ import org.springframework.stereotype.Component; @Path("/codes/{codeId}/codevalues") @Component @Scope("singleton") -@Api(tags = { "Code Values" }) -@SwaggerDefinition(tags = { - @Tag(name = "Code Values", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n" - + "\n" - + "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc") }) +@Tag(name = "Code Values", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n" + + "\n" + + "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc") public class CodeValuesApiResource { /** @@ -96,12 +94,12 @@ public class CodeValuesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Code Values", notes = "Returns the list of Code Values for a given Code\n" + "\n" + "Example Requests:\n" - + "\n" + "codes/1/codevalues") + @Operation(summary = "List Code Values", description = "Returns the list of Code Values for a given Code\n" + "\n" + + "Example Requests:\n" + "\n" + "codes/1/codevalues") @ApiResponses({ - @ApiResponse(code = 200, message = "A List of Given response", response = CodeValuesApiResourceSwagger.GetCodeValuesDataResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "A List of code values for a given code", content = @Content(array = @ArraySchema(schema = @Schema(implementation = CodeValuesApiResourceSwagger.GetCodeValuesDataResponse.class)))) }) public String retrieveAllCodeValues(@Context final UriInfo uriInfo, - @PathParam("codeId") @ApiParam(value = "codeId") final Long codeId) { + @PathParam("codeId") @Parameter(description = "codeId") final Long codeId) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -115,11 +113,12 @@ public class CodeValuesApiResource { @Path("{codeValueId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Code Value", notes = "Returns the details of a Code Value\n" + "\n" + "Example Requests:\n" + "\n" - + "codes/1/codevalues/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.GetCodeValuesDataResponse.class) }) + @Operation(summary = "Retrieve a Code description", description = "Returns the details of a Code Value\n" + "\n" + "Example Requests:\n" + + "\n" + "codes/1/codevalues/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodeValuesApiResourceSwagger.GetCodeValuesDataResponse.class))) }) public String retrieveCodeValue(@Context final UriInfo uriInfo, - @PathParam("codeValueId") @ApiParam(value = "codeValueId") final Long codeValueId) { + @PathParam("codeValueId") @Parameter(description = "codeValueId") final Long codeValueId) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -132,12 +131,12 @@ public class CodeValuesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Code Value", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodeValuesApiResourceSwagger.PostCodeValuesDataRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.PostCodeValueDataResponse.class) }) - public String createCodeValue(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a Code description", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CodeValuesApiResourceSwagger.PostCodeValuesDataRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodeValuesApiResourceSwagger.PostCodeValueDataResponse.class))) }) + public String createCodeValue(@PathParam("codeId") @Parameter(description = "codeId") final Long codeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createCodeValue(codeId).withJson(apiRequestBodyAsJson).build(); @@ -151,13 +150,13 @@ public class CodeValuesApiResource { @Path("{codeValueId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Code Value", notes = "Updates the details of a code value.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodeValuesApiResourceSwagger.PutCodeValuesDataRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.PutCodeValueDataResponse.class) }) - public String updateCodeValue(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, - @PathParam("codeValueId") @ApiParam(value = "codeValueId") final Long codeValueId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Code description", description = "Updates the details of a code description.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CodeValuesApiResourceSwagger.PutCodeValuesDataRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodeValuesApiResourceSwagger.PutCodeValueDataResponse.class))) }) + public String updateCodeValue(@PathParam("codeId") @Parameter(description = "codeId") final Long codeId, + @PathParam("codeValueId") @Parameter(description = "codeValueId") final Long codeValueId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCodeValue(codeId, codeValueId) .withJson(apiRequestBodyAsJson).build(); @@ -171,10 +170,11 @@ public class CodeValuesApiResource { @Path("{codeValueId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Code Value", notes = "Deletes a code value") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.DeleteCodeValueDataResponse.class) }) - public String deleteCodeValue(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, - @PathParam("codeValueId") @ApiParam(value = "codeValueId") final Long codeValueId) { + @Operation(summary = "Delete a Code description", description = "Deletes a code description") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodeValuesApiResourceSwagger.DeleteCodeValueDataResponse.class))) }) + public String deleteCodeValue(@PathParam("codeId") @Parameter(description = "codeId") final Long codeId, + @PathParam("codeValueId") @Parameter(description = "codeValueId") final Long codeValueId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCodeValue(codeId, codeValueId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResourceSwagger.java index 7684a8149..ee8e48af1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.codes.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 30/7/17. @@ -30,65 +29,65 @@ final class CodeValuesApiResourceSwagger { } - @ApiModel(value = "GetCodeValuesDataResponse") + @Schema(description = "GetCodeValuesDataResponse") public static final class GetCodeValuesDataResponse { private GetCodeValuesDataResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Passport") + @Schema(example = "Passport") public String name; - @ApiModelProperty(example = "Passport information") + @Schema(example = "Passport information") public String description; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } - @ApiModel(value = "PostCodeValuesDataRequest") + @Schema(description = "PostCodeValuesDataRequest") public static final class PostCodeValuesDataRequest { private PostCodeValuesDataRequest() { } - @ApiModelProperty(example = "Passport") + @Schema(example = "Passport") public String name; - @ApiModelProperty(example = "Passport information") + @Schema(example = "Passport information") public String description; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } - @ApiModel(value = "PostCodeValueDataResponse") + @Schema(description = "PostCodeValueDataResponse") public static final class PostCodeValueDataResponse { private PostCodeValueDataResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } - @ApiModel(value = "PutCodeValuesDataRequest") + @Schema(description = "PutCodeValuesDataRequest") public static final class PutCodeValuesDataRequest { private PutCodeValuesDataRequest() { } - @ApiModelProperty(example = "Passport") + @Schema(example = "Passport") public String name; - @ApiModelProperty(example = "Passport information") + @Schema(example = "Passport information") public String description; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } - @ApiModel(value = "PutCodeValueDataResponse") + @Schema(description = "PutCodeValueDataResponse") public static final class PutCodeValueDataResponse { private PutCodeValueDataResponse() { @@ -99,27 +98,27 @@ final class CodeValuesApiResourceSwagger { private PutCodeValuechangesSwagger() {} - @ApiModelProperty(example = "Passport") + @Schema(example = "Passport") public String name; - @ApiModelProperty(example = "Passport information") + @Schema(example = "Passport information") public String description; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; public PutCodeValuechangesSwagger changes; } - @ApiModel(value = "DeleteCodeValueDataResponse") + @Schema(description = "DeleteCodeValueDataResponse") public static final class DeleteCodeValueDataResponse { private DeleteCodeValueDataResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java index 5f59030ee..761a77ae4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.codes.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -59,11 +59,9 @@ import org.springframework.stereotype.Component; @Path("/codes") @Component @Scope("singleton") -@Api(tags = { "Codes" }) -@SwaggerDefinition(tags = { - @Tag(name = "Codes", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n" - + "\n" - + "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc") }) +@Tag(name = "Codes", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n" + + "\n" + + "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc") public class CodesApiResource { /** @@ -92,9 +90,9 @@ public class CodesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Codes", notes = "Returns the list of codes.\n" + "\n" + "Example Requests:\n" + "\n" + "codes") + @Operation(summary = "Retrieve Codes", description = "Returns the list of codes.\n" + "\n" + "Example Requests:\n" + "\n" + "codes") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.GetCodesResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = CodesApiResourceSwagger.GetCodesResponse.class)))) }) public String retrieveCodes(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -108,11 +106,11 @@ public class CodesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Code", notes = "Creates a code. Codes created through api are always 'user defined' and so system defined is marked as false.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodesApiResourceSwagger.PostCodesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.PostCodesResponse.class) }) - public String createCode(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a Code", description = "Creates a code. Codes created through api are always 'user defined' and so system defined is marked as false.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CodesApiResourceSwagger.PostCodesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodesApiResourceSwagger.PostCodesResponse.class))) }) + public String createCode(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createCode().withJson(apiRequestBodyAsJson).build(); @@ -125,9 +123,11 @@ public class CodesApiResource { @Path("{codeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Code", notes = "Returns the details of a Code.\n" + "\n" + "Example Requests:\n" + "\n" + "codes/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.GetCodesResponse.class) }) - public String retrieveCode(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, @Context final UriInfo uriInfo) { + @Operation(summary = "Retrieve a Code", description = "Returns the details of a Code.\n" + "\n" + "Example Requests:\n" + "\n" + + "codes/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodesApiResourceSwagger.GetCodesResponse.class))) }) + public String retrieveCode(@PathParam("codeId") @Parameter(description = "codeId") final Long codeId, @Context final UriInfo uriInfo) { final CodeData code = this.readPlatformService.retrieveCode(codeId); @@ -139,12 +139,12 @@ public class CodesApiResource { @Path("{codeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Code", notes = "Updates the details of a code if it is not system defined.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodesApiResourceSwagger.PutCodesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.PutCodesResponse.class) }) - public String updateCode(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Code", description = "Updates the details of a code if it is not system defined.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CodesApiResourceSwagger.PutCodesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodesApiResourceSwagger.PutCodesResponse.class))) }) + public String updateCode(@PathParam("codeId") @Parameter(description = "codeId") final Long codeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCode(codeId).withJson(apiRequestBodyAsJson).build(); @@ -157,9 +157,10 @@ public class CodesApiResource { @Path("{codeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Code", notes = "Deletes a code if it is not system defined.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.DeleteCodesResponse.class) }) - public String deleteCode(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId) { + @Operation(summary = "Delete a Code", description = "Deletes a code if it is not system defined.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CodesApiResourceSwagger.DeleteCodesResponse.class))) }) + public String deleteCode(@PathParam("codeId") @Parameter(description = "codeId") final Long codeId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCode(codeId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResourceSwagger.java index 924196685..92dbfe026 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.codes.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 29/7/17. @@ -30,55 +29,55 @@ final class CodesApiResourceSwagger { // this class is only for Swagger Live Documentation } - @ApiModel(value = "GetCodesResponse") + @Schema(description = "GetCodesResponse") public static final class GetCodesResponse { private GetCodesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Education") + @Schema(example = "Education") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean systemDefined; } - @ApiModel(value = "PostCodesRequest") + @Schema(description = "PostCodesRequest") public static final class PostCodesRequest { private PostCodesRequest() { } - @ApiModelProperty(example = "MyNewCode") + @Schema(example = "MyNewCode") public String name; } - @ApiModel(value = "PostCodesResponse") + @Schema(description = "PostCodesResponse") public static final class PostCodesResponse { private PostCodesResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } - @ApiModel(value = "PutCodesRequest") + @Schema(description = "PutCodesRequest") public static final class PutCodesRequest { private PutCodesRequest() { } - @ApiModelProperty(example = "MyNewCode(changed)") + @Schema(example = "MyNewCode(changed)") public String name; } - @ApiModel(value = "PutCodesResponse") + @Schema(description = "PutCodesResponse") public static final class PutCodesResponse { private PutCodesResponse() { @@ -89,23 +88,23 @@ final class CodesApiResourceSwagger { private PutCodesApichangesSwagger() {} - @ApiModelProperty(example = "MyNewCode(changed)") + @Schema(example = "MyNewCode(changed)") public String name; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; public PutCodesApichangesSwagger changes; } - @ApiModel(value = "DeleteCodesResponse") + @Schema(description = "DeleteCodesResponse") public static final class DeleteCodesResponse { private DeleteCodesResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java index bddbbc2bb..a27a6aa1d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.infrastructure.configuration.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -54,11 +53,9 @@ import org.springframework.stereotype.Component; @Path("/externalservice") @Component @Scope("singleton") -@Api(tags = { "External Services" }) -@SwaggerDefinition(tags = { - @Tag(name = "External Services", description = "External Services Configuration related to set of supported configurations for third party services like Amazon S3 and SMTP:\n" - + "\n" + "S3 (Amazon S3):\n" + "s3_access_key -\n" + "s3_bucket_name -\n" + "s3_secret_key -\n" + "\n" + "\n" - + "SMTP (Email Service):\n" + "username -\n" + "password -\n" + "host -\n" + "port -\n" + "useTLS -") }) +@Tag(name = "External Services", description = "External Services Configuration related to set of supported configurations for third party services like Amazon S3 and SMTP:\n" + + "\n" + "S3 (Amazon S3):\n" + "s3_access_key -\n" + "s3_bucket_name -\n" + "s3_secret_key -\n" + "\n" + "\n" + + "SMTP (Email Service):\n" + "username -\n" + "password -\n" + "host -\n" + "port -\n" + "useTLS -") public class ExternalServicesConfigurationApiResource { private final PlatformSecurityContext context; @@ -87,10 +84,11 @@ public class ExternalServicesConfigurationApiResource { @Path("{servicename}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve External Services Configuration", notes = "Returns a external Service configurations based on the Service Name.\n" + @Operation(summary = "Retrieve External Services Configuration", description = "Returns a external Service configurations based on the Service Name.\n" + "\n" + "Service Names supported are S3 and SMTP.\n" + "\n" + "Example Requests:\n" + "\n" + "externalservice/SMTP") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ExternalServicesPropertiesData.class) }) - public String retrieveOne(@PathParam("servicename") @ApiParam(value = "servicename") final String serviceName, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ExternalServicesPropertiesData.class))) }) + public String retrieveOne(@PathParam("servicename") @Parameter(description = "servicename") final String serviceName, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(ExternalServiceConfigurationApiConstant.EXTERNAL_SERVICE_RESOURCE_NAME); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -104,13 +102,13 @@ public class ExternalServicesConfigurationApiResource { @Path("{servicename}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update External Service", notes = "Updates the external Service Configuration for a Service Name.\n" + "\n" + @Operation(summary = "Update External Service", description = "Updates the external Service Configuration for a Service Name.\n" + "\n" + "Example: \n" + "\n" + "externalservice/S3") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ExternalServicesConfigurationApiResourceSwagger.PutExternalServiceRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "") }) - public String updateExternalServiceProperties(@PathParam("servicename") @ApiParam(value = "servicename") final String serviceName, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ExternalServicesConfigurationApiResourceSwagger.PutExternalServiceRequest.class))) + @ApiResponses({ @ApiResponse(responseCode = "200", description = "") }) + public String updateExternalServiceProperties( + @PathParam("servicename") @Parameter(description = "servicename") final String serviceName, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { // ExternalServicesData external = // this.externalServiceReadPlatformService.getExternalServiceDetailsByServiceName(serviceName); final CommandWrapper commandRequest = new CommandWrapperBuilder().updateExternalServiceProperties(serviceName) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResourceSwagger.java index e43519104..60b4fc764 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.configuration.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 30/7/17. @@ -30,16 +29,16 @@ final class ExternalServicesConfigurationApiResourceSwagger { } - @ApiModel(value = "PutExternalServiceRequest") + @Schema(description = "PutExternalServiceRequest") public static final class PutExternalServiceRequest { private PutExternalServiceRequest() { } - @ApiModelProperty(example = "test@mifos.org") + @Schema(example = "test@mifos.org") public String username; - @ApiModelProperty(example = "XXXX") + @Schema(example = "XXXX") public String password; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java index 6d65348eb..50017769e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.configuration.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -59,17 +59,15 @@ import org.springframework.stereotype.Component; @Path("/configurations") @Component @Scope("singleton") -@Api(tags = { "Global Configuration" }) -@SwaggerDefinition(tags = { - @Tag(name = "Global Configuration", description = "Global configuration related to set of supported enable/disable configurations:\n" - + "\n" + "maker-checker - defaults to false - if true turns on maker-checker functionality\n" - + "reschedule-future-repayments - defaults to false - if true reschedules repayemnts which falls on a non-working day to configured repayment rescheduling rule\n" - + "allow-transactions-on-non_workingday - defaults to false - if true allows transactions on non-working days\n" - + "reschedule-repayments-on-holidays - defaults to false - if true reschedules repayemnts which falls on a non-working day to defined reschedule date\n" - + "allow-transactions-on-holiday - defaults to false - if true allows transactions on holidays\n" - + "savings-interest-posting-current-period-end - Set it at the database level before any savings interest is posted. When set as false(default), interest will be posted on the first date of next period. If set as true, interest will be posted on last date of current period. There is no difference in the interest amount posted.\n" - + "financial-year-beginning-month - Set it at the database level before any savings interest is posted. Allowed values 1 - 12 (January - December). Interest posting periods are evaluated based on this configuration.\n" - + "meetings-mandatory-for-jlg-loans - if set to true, enforces all JLG loans to follow a meeting schedule belonging to either the parent group or Center.") }) +@Tag(name = "Global Configuration", description = "Global configuration related to set of supported enable/disable configurations:\n" + "\n" + + "maker-checker - defaults to false - if true turns on maker-checker functionality\n" + + "reschedule-future-repayments - defaults to false - if true reschedules repayemnts which falls on a non-working day to configured repayment rescheduling rule\n" + + "allow-transactions-on-non_workingday - defaults to false - if true allows transactions on non-working days\n" + + "reschedule-repayments-on-holidays - defaults to false - if true reschedules repayemnts which falls on a non-working day to defined reschedule date\n" + + "allow-transactions-on-holiday - defaults to false - if true allows transactions on holidays\n" + + "savings-interest-posting-current-period-end - Set it at the database level before any savings interest is posted. When set as false(default), interest will be posted on the first date of next period. If set as true, interest will be posted on last date of current period. There is no difference in the interest amount posted.\n" + + "financial-year-beginning-month - Set it at the database level before any savings interest is posted. Allowed values 1 - 12 (January - December). Interest posting periods are evaluated based on this configuration.\n" + + "meetings-mandatory-for-jlg-loans - if set to true, enforces all JLG loans to follow a meeting schedule belonging to either the parent group or Center.") public class GlobalConfigurationApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration")); @@ -100,14 +98,14 @@ public class GlobalConfigurationApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Global Configuration | Retrieve Global Configuration for surveys", notes = "Returns the list global enable/disable configurations.\n" + @Operation(summary = "Retrieve Global Configuration | Retrieve Global Configuration for surveys", description = "Returns the list global enable/disable configurations.\n" + "\n" + "Example Requests:\n" + "\n" + "configurations\n\n" + "\n" + "Returns the list global enable/disable survey configurations.\n" + "\n" + "Example Requests:\n" + "\n" + "configurations/survey") @ApiResponses({ - @ApiResponse(code = 200, message = "List of example \n response \nsurveys response \ngiven below", response = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "List of example \\n response \\nsurveys response \\ngiven below", content = @Content(array = @ArraySchema(schema = @Schema(implementation = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class)))) }) public String retrieveConfiguration(@Context final UriInfo uriInfo, - @DefaultValue("false") @QueryParam("survey") @ApiParam(value = "survey") final boolean survey) { + @DefaultValue("false") @QueryParam("survey") @Parameter(description = "survey") final boolean survey) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -121,11 +119,12 @@ public class GlobalConfigurationApiResource { @Path("{configId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Global Configuration", notes = "Returns a global enable/disable configurations.\n" + "\n" + @Operation(summary = "Retrieve Global Configuration", description = "Returns a global enable/disable configurations.\n" + "\n" + "Example Requests:\n" + "\n" + "configurations/1") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class) }) - public String retrieveOne(@PathParam("configId") @ApiParam(value = "configId") final Long configId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class))) }) + public String retrieveOne(@PathParam("configId") @Parameter(description = "configId") final Long configId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -139,13 +138,12 @@ public class GlobalConfigurationApiResource { @Path("{configId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Global Configuration", notes = "Updates an enable/disable global configuration item.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = GlobalConfigurationApiResourceSwagger.PutGlobalConfigurationsRequest.class) }) + @Operation(summary = "Update Global Configuration", description = "Updates an enable/disable global configuration item.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = GlobalConfigurationApiResourceSwagger.PutGlobalConfigurationsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = GlobalConfigurationApiResourceSwagger.PutGlobalConfigurationsResponse.class) }) - public String updateConfiguration(@PathParam("configId") @ApiParam(value = "configId") final Long configId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = GlobalConfigurationApiResourceSwagger.PutGlobalConfigurationsResponse.class))) }) + public String updateConfiguration(@PathParam("configId") @Parameter(description = "configId") final Long configId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateGlobalConfiguration(configId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResourceSwagger.java index bb50dd86a..cd1cdd2c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.configuration.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.infrastructure.configuration.data.GlobalConfigurationPropertyData; @@ -32,7 +31,7 @@ final class GlobalConfigurationApiResourceSwagger { } - @ApiModel(value = "GetGlobalConfigurationsResponse") + @Schema(description = "GetGlobalConfigurationsResponse") public static final class GetGlobalConfigurationsResponse { private GetGlobalConfigurationsResponse() {} @@ -40,18 +39,18 @@ final class GlobalConfigurationApiResourceSwagger { public List globalConfiguration; } - @ApiModel(value = "PutGlobalConfigurationsRequest") + @Schema(description = "PutGlobalConfigurationsRequest") public static final class PutGlobalConfigurationsRequest { private PutGlobalConfigurationsRequest() {} - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean enabled; - @ApiModelProperty(example = "2") - public Long value; + @Schema(example = "2") + public Long description; } - @ApiModel(value = "PutGlobalConfigurationsResponse") + @Schema(description = "PutGlobalConfigurationsResponse") public static final class PutGlobalConfigurationsResponse { private PutGlobalConfigurationsResponse() {} @@ -60,11 +59,11 @@ final class GlobalConfigurationApiResourceSwagger { private PutGlobalConfigurationsResponsechangesSwagger() {} - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean enabled; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; public PutGlobalConfigurationsResponsechangesSwagger changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java index a7993969d..f5c1e24b1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java @@ -19,7 +19,6 @@ package org.apache.fineract.infrastructure.creditbureau.api; -import io.swagger.annotations.Api; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -57,7 +56,6 @@ import org.springframework.stereotype.Component; @Path("/CreditBureauConfiguration") @Component @Scope("singleton") -@Api(value = "CreditBureau Configuration") public class CreditBureauConfigurationAPI { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java index c4829a099..c5759d9c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -57,16 +57,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -//import org.slf4j.Logger; - @Path("/datatables") @Component @Scope("singleton") -@Api(tags = { "Data Tables" }) -@SwaggerDefinition(tags = { - @Tag(name = "Data Tables", description = "The datatables API allows you to plug-in your own tables (MySql) that have a relationship to a Apache Fineract core table. For example, you might want to add some extra client fields and record information about each of the clients' family members. Via the API you can create, read, update and delete entries for each 'plugged-in' table. The API checks for permission and for 'data scoping' (only data within the users' office hierarchy can be managed by the user).\n" - + "\n" - + "The Apache Fineract Reference App uses a JQuery plug-in called stretchydatatables (which in turn uses this datatables resource) to provide a pretty flexible CRUD (Create, Read, Update, Delete) User Interface.") }) +@Tag(name = "Data Tables", description = "The datatables API allows you to plug-in your own tables (MySql) that have a relationship to a Apache Fineract core table. For example, you might want to add some extra client fields and record information about each of the clients' family members. Via the API you can create, read, update and delete entries for each 'plugged-in' table. The API checks for permission and for 'data scoping' (only data within the users' office hierarchy can be managed by the user).\n" + + "\n" + + "The Apache Fineract Reference App uses a JQuery plug-in called stretchydatatables (which in turn uses this datatables resource) to provide a pretty flexible CRUD (Create, Read, Update, Delete) User Interface.") public class DatatablesApiResource { private final PlatformSecurityContext context; @@ -91,13 +87,12 @@ public class DatatablesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Data Tables", notes = "Lists registered data tables and the Apache Fineract Core application table they are registered to.\n" + @Operation(summary = "List Data Tables", description = "Lists registered data tables and the Apache Fineract Core application table they are registered to.\n" + "\n" + "ARGUMENTS\n" + "\n" + "apptable - optional" + "\n" + "The Apache Fineract core application table.\n" + "\n" - + "Example Requests:\n" + "\n" + "datatables?apptable=m_client\n" + "\n" + "\n" - + "datatables", responseContainer = "List", response = DatatablesApiResourceSwagger.GetDataTablesResponse.class) + + "Example Requests:\n" + "\n" + "datatables?apptable=m_client\n" + "\n" + "\n" + "datatables") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.GetDataTablesResponse.class, responseContainer = "list") }) - public String getDatatables(@QueryParam("apptable") @ApiParam(value = "apptable") final String apptable, + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = DatatablesApiResourceSwagger.GetDataTablesResponse.class)))) }) + public String getDatatables(@QueryParam("apptable") @Parameter(description = "apptable") final String apptable, @Context final UriInfo uriInfo) { final List result = this.readWriteNonCoreDataService.retrieveDatatableNames(apptable); @@ -109,7 +104,7 @@ public class DatatablesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create Data Table", notes = "Create a new data table and registers it with the Apache Fineract Core application table.\n" + @Operation(summary = "Create Data Table", description = "Create a new data table and registers it with the Apache Fineract Core application table.\n" + "\n" + "Field Descriptions\n" + "\n" + "Mandatory - datatableName : \n" + "\nThe name of the Data Table.\n" + "\n" + "Mandatory - apptableName\n" + "\n" + "Application table name. Must be one of the following:\n" + "\n" + "m_client\n" + "\n" + "m_group" + "\n" + "\n" + "m_loan" + "\n" + "\n" + "m_office" + "\n" + "\n" + "m_saving_account" + "\n" + "\n" @@ -121,15 +116,15 @@ public class DatatablesApiResource { + "\n" + "\n" + "Mandatory - type" + "\n" + "\n" + "Column type. Must be one of the following:" + "\n" + "\n" + "Boolean" + "\n" + "\n" + "Date" + "\n" + "\n" + "DateTime" + "\n" + "\n" + "Decimal" + "\n" + "\n" + "Dropdown" + "\n" + "\n" + "\n" + "Number" + "\n" + "\n" + "String" + "\n" + "\n" + "Text" + "\n" + "\n" + "Mandatory [type = Dropdown] - code" + "\n" + "\n" - + "Used in Code Value fields. Column name becomes: code_cd_name. Mandatory if using type Dropdown, otherwise an error is returned." + + "Used in Code description fields. Column name becomes: code_cd_name. Mandatory if using type Dropdown, otherwise an error is returned." + "\n" + "\n" + "Optional - mandatory" + "\n" + "\n" + "Determines whether this column must have a value in every entry. Optional, defaults to false." + "\n" + "\n" + "Mandatory [type = String] - length" + "\n" + "\n" + "Length of the text field. Mandatory if type String is used, otherwise an error is returned.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PostDataTablesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PostDataTablesResponse.class) }) - public String createDatatable(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesResponse.class))) }) + public String createDatatable(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createDBDatatable(apiRequestBodyAsJson).build(); @@ -141,12 +136,12 @@ public class DatatablesApiResource { @Path("{datatableName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Data Table", notes = "Modifies fields of a data table. If the apptableName parameter is passed, data table is deregistered and registered with the new application table.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PutDataTablesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesResponse.class) }) - public String updateDatatable(@PathParam("datatableName") @ApiParam(value = "datatableName") final String datatableName, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update Data Table", description = "Modifies fields of a data table. If the apptableName parameter is passed, data table is deregistered and registered with the new application table.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesResponse.class))) }) + public String updateDatatable(@PathParam("datatableName") @Parameter(description = "datatableName") final String datatableName, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateDBDatatable(datatableName, apiRequestBodyAsJson).build(); @@ -158,10 +153,11 @@ public class DatatablesApiResource { @Path("{datatableName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete Data Table", notes = "Deletes a data table and deregisters it from the Apache Fineract Core application table.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.DeleteDataTablesResponse.class) }) - public String deleteDatatable(@PathParam("datatableName") @ApiParam(value = "datatableName") final String datatableName, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Delete Data Table", description = "Deletes a data table and deregisters it from the Apache Fineract Core application table.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.DeleteDataTablesResponse.class))) }) + public String deleteDatatable(@PathParam("datatableName") @Parameter(description = "datatableName") final String datatableName, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteDBDatatable(datatableName, apiRequestBodyAsJson).build(); @@ -173,13 +169,13 @@ public class DatatablesApiResource { @Path("register/{datatable}/{apptable}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Register Data Table", notes = "Registers a data table with the Apache Fineract Core application table. This allows the data table to be maintained through the API. In case the datatable is a PPI (survey table), a parameter category should be pass along with the request. The API currently support one category (200)") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PostDataTablesRegisterDatatableAppTable.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesResponse.class) }) - public String registerDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, - @PathParam("apptable") @ApiParam(value = "apptable") final String apptable, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Register Data Table", description = "Registers a data table with the Apache Fineract Core application table. This allows the data table to be maintained through the API. In case the datatable is a PPI (survey table), a parameter category should be pass along with the request. The API currently support one category (200)") + @RequestBody(content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesRegisterDatatableAppTable.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesResponse.class))) }) + public String registerDatatable(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, + @PathParam("apptable") @Parameter(description = "apptable") final String apptable, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().registerDBDatatable(datatable, apptable) .withJson(apiRequestBodyAsJson).build(); @@ -193,9 +189,10 @@ public class DatatablesApiResource { @Path("deregister/{datatable}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Deregister Data Table", notes = "Deregisters a data table. It will no longer be available through the API.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesResponse.class) }) - public String deregisterDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable) { + @Operation(summary = "Deregister Data Table", description = "Deregisters a data table. It will no longer be available through the API.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesResponse.class))) }) + public String deregisterDatatable(@PathParam("datatable") @Parameter(description = "datatable") final String datatable) { this.readWriteNonCoreDataService.deregisterDatatable(datatable); @@ -208,9 +205,10 @@ public class DatatablesApiResource { @Path("{datatable}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Data Table Details", notes = "Lists a registered data table details and the Apache Fineract Core application table they are registered to.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.GetDataTablesResponse.class) }) - public String getDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, + @Operation(summary = "Retrieve Data Table Details", description = "Lists a registered data table details and the Apache Fineract Core application table they are registered to.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.GetDataTablesResponse.class))) }) + public String getDatatable(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, @Context final UriInfo uriInfo) { final DatatableData result = this.readWriteNonCoreDataService.retrieveDatatable(datatable); @@ -223,17 +221,18 @@ public class DatatablesApiResource { @Path("{datatable}/{apptableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Entry(s) from Data Table", notes = "Gets the entry (if it exists) for data tables that are one to one with the application table. \n" + @Operation(summary = "Retrieve Entry(s) from Data Table", description = "Gets the entry (if it exists) for data tables that are one to one with the application table. \n" + "Gets the entries (if they exist) for data tables that are one to many with the application table.\n" + "\n" + "Note: The 'fields' parameter is not available for datatables.\n" + "\n" + "ARGUMENTS\n" + "orderoptional Specifies the order in which data is returned.genericResultSetoptional, defaults to false If 'true' an optimised JSON format is returned suitable for tabular display of data. This format is used by the default data tables UI functionality.\n" + "Example Requests:\n" + "\n" + "datatables/extra_client_details/1\n" + "\n" + "\n" + "datatables/extra_family_details/1?order=`Date of Birth` desc\n" + "\n" + "\n" + "datatables/extra_client_details/1?genericResultSet=true") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.GetDataTablesAppTableIdResponse.class) }) - public String getDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, - @QueryParam("order") @ApiParam(value = "order") final String order, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.GetDataTablesAppTableIdResponse.class))) }) + public String getDatatable(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId, + @QueryParam("order") @Parameter(description = "order") final String order, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasDatatableReadPermission(datatable); @@ -282,15 +281,14 @@ public class DatatablesApiResource { @Path("{datatable}/{apptableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create Entry in Data Table", notes = "Adds a row to the data table.\n" + "\n" + @Operation(summary = "Create Entry in Data Table", description = "Adds a row to the data table.\n" + "\n" + "Note that the default datatable UI functionality converts any field name containing spaces to underscores when using the API. This means the field name \"Business Description\" is considered the same as \"Business_Description\". So you shouldn't have both \"versions\" in any data table.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PostDataTablesAppTableIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesAppTableIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PostDataTablesAppTableIdResponse.class) }) - public String createDatatableEntry(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PostDataTablesAppTableIdResponse.class))) }) + public String createDatatableEntry(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createDatatable(datatable, apptableId, null) // @@ -306,13 +304,13 @@ public class DatatablesApiResource { @Path("{datatable}/{apptableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Entry in Data Table (One to One)", notes = "Updates the row (if it exists) of the data table.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PutDataTablesAppTableIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesAppTableIdResponse.class) }) - public String updateDatatableEntryOnetoOne(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update Entry in Data Table (One to One)", description = "Updates the row (if it exists) of the data table.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesAppTableIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesAppTableIdResponse.class))) }) + public String updateDatatableEntryOnetoOne(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateDatatable(datatable, apptableId, null) // @@ -328,15 +326,14 @@ public class DatatablesApiResource { @Path("{datatable}/{apptableId}/{datatableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Entry in Data Table (One to Many)", notes = "Updates the row (if it exists) of the data table.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PutDataTablesAppTableIdDatatableIdRequest.class) }) + @Operation(summary = "Update Entry in Data Table (One to Many)", description = "Updates the row (if it exists) of the data table.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesAppTableIdDatatableIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesAppTableIdDatatableIdResponse.class) }) - public String updateDatatableEntryOneToMany(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, - @PathParam("datatableId") @ApiParam(value = "datatableId") final Long datatableId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.PutDataTablesAppTableIdDatatableIdResponse.class))) }) + public String updateDatatableEntryOneToMany(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId, + @PathParam("datatableId") @Parameter(description = "datatableId") final Long datatableId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateDatatable(datatable, apptableId, datatableId) // @@ -352,12 +349,12 @@ public class DatatablesApiResource { @Path("{datatable}/{apptableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete Entry(s) in Data Table", notes = "Deletes the entry (if it exists) for data tables that are one-to-one with the application table. \n" + @Operation(summary = "Delete Entry(s) in Data Table", description = "Deletes the entry (if it exists) for data tables that are one-to-one with the application table. \n" + "Deletes the entries (if they exist) for data tables that are one-to-many with the application table.") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdResponse.class) }) - public String deleteDatatableEntries(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdResponse.class))) }) + public String deleteDatatableEntries(@PathParam("datatable") @Parameter(description = "datatable") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteDatatable(datatable, apptableId, null) // @@ -372,14 +369,14 @@ public class DatatablesApiResource { @Path("{datatable}/{apptableId}/{datatableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete Entry in Datatable (One to Many)", notes = "Deletes the entry (if it exists) for data tables that are one to many with the application table.\n" + @Operation(summary = "Delete Entry in Datatable (One to Many)", description = "Deletes the entry (if it exists) for data tables that are one to many with the application table.\n" + "\n") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdDatatableIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdDatatableIdResponse.class))) }) public String deleteDatatableEntries( - @PathParam("datatable") @ApiParam(value = "datatable", type = "body", example = "{}") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, - @PathParam("datatableId") @ApiParam(value = "datatableId") final Long datatableId) { + @PathParam("datatable") @Parameter(description = "datatable", example = "{}") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId, + @PathParam("datatableId") @Parameter(description = "datatableId") final Long datatableId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteDatatable(datatable, apptableId, datatableId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java index 6bbceaf18..4e4facf2b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData; import org.apache.fineract.infrastructure.dataqueries.data.ResultsetRowData; @@ -33,48 +32,48 @@ final class DatatablesApiResourceSwagger { } - @ApiModel(value = "GetDataTablesResponse") + @Schema(description = "GetDataTablesResponse") public static final class GetDataTablesResponse { private GetDataTablesResponse() { } - @ApiModelProperty(example = "m_client") + @Schema(example = "m_client") public String appTableName; - @ApiModelProperty(example = "extra_client_details") + @Schema(example = "extra_client_details") public String datatableName; public List column; } - @ApiModel(value = "PostDataTablesRequest") + @Schema(description = "PostDataTablesRequest") public static final class PostDataTablesRequest { private PostDataTablesRequest() { } - @ApiModelProperty(example = "m_client") + @Schema(example = "m_client") public String applicationTableName; - @ApiModelProperty(example = "extra_client_details") + @Schema(example = "extra_client_details") public String registeredTableName; - @ApiModelProperty(example = "true") + @Schema(required = false, description = "Allows to create multiple entries in the Data Table. Optional, defaults to false. If this property is not provided Data Table will allow only one entry.", example = "true") public boolean multiRow; public List columnHeaderData; } - @ApiModel(value = "PostDataTablesResponse") + @Schema(description = "PostDataTablesResponse") public static final class PostDataTablesResponse { private PostDataTablesResponse() { } - @ApiModelProperty(example = "extra_client_details") + @Schema(example = "extra_client_details") public String resourceIdentifier; } - @ApiModel(value = "PutDataTablesRequest") + @Schema(description = "PutDataTablesRequest") public static final class PutDataTablesRequest { private PutDataTablesRequest() { @@ -85,7 +84,7 @@ final class DatatablesApiResourceSwagger { private PutDataTablesRequestDropColumns() {} - @ApiModelProperty(example = "Gender_cd_Question") + @Schema(example = "Gender_cd_Question") public String name; } @@ -93,13 +92,13 @@ final class DatatablesApiResourceSwagger { private PutDataTablesRequestAddColumns() {} - @ApiModelProperty(example = "Question") + @Schema(example = "Question") public String name; - @ApiModelProperty(example = "Dropdown") + @Schema(example = "Dropdown") public String type; - @ApiModelProperty(example = "Gender") + @Schema(example = "Gender") public String code; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean mandatory; } @@ -107,92 +106,92 @@ final class DatatablesApiResourceSwagger { private PutDataTablesRequestChangeColumns() {} - @ApiModelProperty(example = "Question") + @Schema(example = "Question") public String name; - @ApiModelProperty(example = "Question 2") + @Schema(example = "Question 2") public String newName; - @ApiModelProperty(example = "Gender") + @Schema(example = "Gender") public String code; - @ApiModelProperty(example = "Gender2") + @Schema(example = "Gender2") public String newCode; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean mandatory; } - @ApiModelProperty(example = "m_client") + @Schema(example = "m_client") public String appTableName; public List dropColumns; public List addColumns; public List ChangeColumns; } - @ApiModel(value = "PutDataTablesResponse") + @Schema(description = "PutDataTablesResponse") public static final class PutDataTablesResponse { private PutDataTablesResponse() { } - @ApiModelProperty(example = "extra_client_details") + @Schema(example = "extra_client_details") public String resourceIdentifier; } - @ApiModel(value = "DeleteDataTablesResponse") + @Schema(description = "DeleteDataTablesResponse") public static final class DeleteDataTablesResponse { private DeleteDataTablesResponse() { } - @ApiModelProperty(example = "extra_client_details") + @Schema(example = "extra_client_details") public String resourceIdentifier; } - @ApiModel(value = "PostDataTablesRegisterDatatableAppTable") + @Schema(description = "PostDataTablesRegisterDatatableAppTable") public static final class PostDataTablesRegisterDatatableAppTable { private PostDataTablesRegisterDatatableAppTable() {} } - @ApiModel(value = "PostDataTablesAppTableIdRequest") + @Schema(description = "PostDataTablesAppTableIdRequest") public static final class PostDataTablesAppTableIdRequest { private PostDataTablesAppTableIdRequest() { } - @ApiModelProperty(example = "Livestock sales") + @Schema(example = "Livestock sales") public String BusinessDescription; - @ApiModelProperty(example = "First comment made") + @Schema(example = "First comment made") public String Comment; - @ApiModelProperty(example = "Primary") + @Schema(example = "Primary") public String Education_cv; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Long Gender_cd; - @ApiModelProperty(example = "8.5") + @Schema(example = "8.5") public Double HighestRatePaid; - @ApiModelProperty(example = "01 October 2012") + @Schema(example = "01 October 2012") public String NextVisit; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Long YearsinBusiness; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModel(value = "PostDataTablesAppTableIdResponse ") + @Schema(description = "PostDataTablesAppTableIdResponse ") public static final class PostDataTablesAppTableIdResponse { private PostDataTablesAppTableIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "GetDataTablesAppTableIdResponse") + @Schema(description = "GetDataTablesAppTableIdResponse") public static final class GetDataTablesAppTableIdResponse { private GetDataTablesAppTableIdResponse() { @@ -203,18 +202,18 @@ final class DatatablesApiResourceSwagger { public List data; } - @ApiModel(value = "PutDataTablesAppTableIdRequest") + @Schema(description = "PutDataTablesAppTableIdRequest") public static final class PutDataTablesAppTableIdRequest { private PutDataTablesAppTableIdRequest() { } - @ApiModelProperty(example = "Livestock sales updated") + @Schema(example = "Livestock sales updated") public String BusinessDescription; } - @ApiModel(value = "PutDataTablesAppTableIdResponse") + @Schema(description = "PutDataTablesAppTableIdResponse") public static final class PutDataTablesAppTableIdResponse { private PutDataTablesAppTableIdResponse() { @@ -225,68 +224,68 @@ final class DatatablesApiResourceSwagger { private PutDataTablesAppTableIdResponseChanges() {} - @ApiModelProperty(example = "Livestock sales updated") + @Schema(example = "Livestock sales updated") public String BusinessDescription; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutDataTablesAppTableIdResponseChanges changes; } - @ApiModel(value = "PutDataTablesAppTableIdDatatableIdRequest") + @Schema(description = "PutDataTablesAppTableIdDatatableIdRequest") public static final class PutDataTablesAppTableIdDatatableIdRequest { private PutDataTablesAppTableIdDatatableIdRequest() { } - @ApiModelProperty(example = "01 June 1982") + @Schema(example = "01 June 1982") public String DateOfBirth; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Long Education_cdHighest; - @ApiModelProperty(example = "June") + @Schema(example = "June") public String Name; - @ApiModelProperty(example = "More notes") + @Schema(example = "More notes") public String OtherNotes; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Long PointsScore; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModel(value = "PutDataTablesAppTableIdDatatableIdResponse ") + @Schema(description = "PutDataTablesAppTableIdDatatableIdResponse ") public static final class PutDataTablesAppTableIdDatatableIdResponse { private PutDataTablesAppTableIdDatatableIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "DeleteDataTablesDatatableAppTableIdResponse ") + @Schema(description = "DeleteDataTablesDatatableAppTableIdResponse ") public static final class DeleteDataTablesDatatableAppTableIdResponse { private DeleteDataTablesDatatableAppTableIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "DeleteDataTablesDatatableAppTableIdDatatableIdResponse ") + @Schema(description = "DeleteDataTablesDatatableAppTableIdDatatableIdResponse ") public static final class DeleteDataTablesDatatableAppTableIdDatatableIdResponse { private DeleteDataTablesDatatableAppTableIdDatatableIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java index 6ef832978..4a8d61faf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -60,8 +60,7 @@ import org.springframework.stereotype.Component; @Path("/entityDatatableChecks") @Component @Scope("singleton") -@Api(tags = { "Entity Datatable Check" }) -@SwaggerDefinition(tags = { @Tag(name = "Entity Data Table", description = "This defines Entity-Datatable Check.") }) +@Tag(name = "Entity Data Table", description = "This defines Entity-Datatable Check.") public class EntityDatatableChecksApiResource { private final PlatformSecurityContext context; @@ -86,17 +85,17 @@ public class EntityDatatableChecksApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Entity-Datatable Checks", notes = "The list capability of Entity-Datatable Checks can support pagination.\n" + @Operation(summary = "List Entity-Datatable Checks", description = "The list capability of Entity-Datatable Checks can support pagination.\n" + "\n" + "OPTIONAL ARGUMENTS\n" + "offset Integer optional, defaults to 0 Indicates the result from which pagination startslimit Integer optional, defaults to 200 Restricts the size of results returned. To override the default and return all entries you must explicitly pass a non-positive integer value for limit e.g. limit=0, or limit=-1\n" + "Example Request:\n" + "\n" + "entityDatatableChecks?offset=0&limit=15") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.GetEntityDatatableChecksResponse.class, responseContainer = "list") }) - public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("status") @ApiParam(value = "status") final Long status, - @QueryParam("entity") @ApiParam(value = "entity") final String entity, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit) { + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EntityDatatableChecksApiResourceSwagger.GetEntityDatatableChecksResponse.class)))) }) + public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("status") @Parameter(description = "status") final Long status, + @QueryParam("entity") @Parameter(description = "entity") final String entity, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit) { final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit); final Page result = this.readEntityDatatableChecksService.retrieveAll(searchParameters, status, entity, productId); @@ -109,10 +108,10 @@ public class EntityDatatableChecksApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Entity-Datatable Checks Template", notes = "This is a convenience resource useful for building maintenance user interface screens for Entity-Datatable Checks applications. The template data returned consists of:\n" - + "\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "entityDatatableChecks/template") + @Operation(summary = "Retrieve Entity-Datatable Checks Template", description = "This is a convenience resource useful for building maintenance user interface screens for Entity-Datatable Checks applications. The template data returned consists of:\n" + + "\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "entityDatatableChecks/template") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.GetEntityDatatableChecksTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = EntityDatatableChecksApiResourceSwagger.GetEntityDatatableChecksTemplateResponse.class))) }) public String getTemplate(@Context final UriInfo uriInfo) { final EntityDataTableChecksTemplateData result = this.readEntityDatatableChecksService.retrieveTemplate(); @@ -124,13 +123,12 @@ public class EntityDatatableChecksApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create Entity-Datatable Checks", notes = "Mandatory Fields : \n" + "entity, status, datatableName\n" + "\n" + @Operation(summary = "Create Entity-Datatable Checks", description = "Mandatory Fields : \n" + "entity, status, datatableName\n" + "\n" + "Non-Mandatory Fields : \n" + "productId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = EntityDatatableChecksApiResourceSwagger.PostEntityDatatableChecksTemplateRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = EntityDatatableChecksApiResourceSwagger.PostEntityDatatableChecksTemplateRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.PostEntityDatatableChecksTemplateResponse.class) }) - public String createEntityDatatableCheck(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = EntityDatatableChecksApiResourceSwagger.PostEntityDatatableChecksTemplateResponse.class))) }) + public String createEntityDatatableCheck(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createEntityDatatableChecks(apiRequestBodyAsJson).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); @@ -141,11 +139,11 @@ public class EntityDatatableChecksApiResource { @Path("{entityDatatableCheckId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete Entity-Datatable Checks", notes = "Deletes an existing Entity-Datatable Check") + @Operation(summary = "Delete Entity-Datatable Checks", description = "Deletes an existing Entity-Datatable Check") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.DeleteEntityDatatableChecksTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = EntityDatatableChecksApiResourceSwagger.DeleteEntityDatatableChecksTemplateResponse.class))) }) public String deleteDatatable( - @PathParam("entityDatatableCheckId") @ApiParam(value = "entityDatatableCheckId") final long entityDatatableCheckId, + @PathParam("entityDatatableCheckId") @Parameter(description = "entityDatatableCheckId") final long entityDatatableCheckId, final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResourceSwagger.java index aa2ef207c..00eb785d1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.List; import org.apache.fineract.infrastructure.core.data.EnumOptionData; @@ -37,7 +36,7 @@ final class EntityDatatableChecksApiResourceSwagger { } - @ApiModel(value = "GetEntityDatatableChecksResponse") + @Schema(description = "GetEntityDatatableChecksResponse") public static final class GetEntityDatatableChecksResponse { private GetEntityDatatableChecksResponse() {} @@ -52,7 +51,7 @@ final class EntityDatatableChecksApiResourceSwagger { public String productName; } - @ApiModel(value = "GetEntityDatatableChecksTemplateResponse") + @Schema(description = "GetEntityDatatableChecksTemplateResponse") public static final class GetEntityDatatableChecksTemplateResponse { private GetEntityDatatableChecksTemplateResponse() {} @@ -67,42 +66,42 @@ final class EntityDatatableChecksApiResourceSwagger { public Collection savingsProductDatas; } - @ApiModel(value = "PostEntityDatatableChecksTemplateRequest") + @Schema(description = "PostEntityDatatableChecksTemplateRequest") public static final class PostEntityDatatableChecksTemplateRequest { private PostEntityDatatableChecksTemplateRequest() { } - @ApiModelProperty(example = "m_loan") + @Schema(example = "m_loan") public String entity; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Long status; - @ApiModelProperty(example = "Additional Details") + @Schema(example = "Additional Details") public String datatableName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long productId; } - @ApiModel(value = "PostEntityDatatableChecksTemplateResponse") + @Schema(description = "PostEntityDatatableChecksTemplateResponse") public static final class PostEntityDatatableChecksTemplateResponse { private PostEntityDatatableChecksTemplateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "DeleteEntityDatatableChecksTemplateResponse") + @Schema(description = "DeleteEntityDatatableChecksTemplateResponse") public static final class DeleteEntityDatatableChecksTemplateResponse { private DeleteEntityDatatableChecksTemplateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java index d244745b8..1f13ab5a1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -59,8 +59,7 @@ import org.springframework.stereotype.Component; @Path("/reports") @Component @Scope("singleton") -@Api(tags = { "Reports" }) -@SwaggerDefinition(tags = { @Tag(name = "Reports", description = "Non-core reports can be added, updated and deleted.") }) +@Tag(name = "Reports", description = "Non-core reports can be added, updated and deleted.") public class ReportsApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType", "reportSubType", @@ -88,9 +87,9 @@ public class ReportsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Reports", notes = "Lists all reports and their parameters.\n" + "\n" + "Example Request:\n" + "\n" - + "reports", responseContainer = "List", response = ReportsApiResourceSwagger.GetReportsResponse.class) - @ApiResponses({ @ApiResponse(code = 200, message = "") }) + @Operation(summary = "List Reports", description = "Lists all reports and their parameters.\n" + "\n" + "Example Request:\n" + "\n" + + "reports") + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ReportsApiResourceSwagger.GetReportsResponse.class)))) public String retrieveReportList(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -105,10 +104,11 @@ public class ReportsApiResource { @Path("{id}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Report\n", notes = "Example Requests:\n" + "\n" + "reports/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Report\n", description = "Example Requests:\n" + "\n" + "reports/1\n" + "\n" + "\n" + "reports/1?template=true") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.GetReportsResponse.class) }) - public String retrieveReport(@PathParam("id") @ApiParam(value = "id") final Long id, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.GetReportsResponse.class))) }) + public String retrieveReport(@PathParam("id") @Parameter(description = "id") final Long id, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -126,9 +126,10 @@ public class ReportsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Report Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "\n" + "Example Request : \n" + "\n" + "reports/template") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.GetReportsTemplateResponse.class) }) + @Operation(summary = "Retrieve Report Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "\n" + "Example Request : \n" + "\n" + "reports/template") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.GetReportsTemplateResponse.class))) }) public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -143,11 +144,11 @@ public class ReportsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Report", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportsApiResourceSwagger.PostRepostRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.PostReportsResponse.class) }) - public String createReport(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a Report", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.PostRepostRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.PostReportsResponse.class))) }) + public String createReport(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createReport().withJson(apiRequestBodyAsJson).build(); @@ -160,12 +161,12 @@ public class ReportsApiResource { @Path("{id}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Report", notes = "Only the useReport value can be updated for core reports.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportsApiResourceSwagger.PutReportRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.PutReportResponse.class) }) - public String updateReport(@PathParam("id") @ApiParam(value = "id") final Long id, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Report", description = "Only the useReport description can be updated for core reports.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.PutReportRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.PutReportResponse.class))) }) + public String updateReport(@PathParam("id") @Parameter(description = "id") final Long id, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateReport(id).withJson(apiRequestBodyAsJson).build(); @@ -178,9 +179,10 @@ public class ReportsApiResource { @Path("{id}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Report", notes = "Only non-core reports can be deleted.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.DeleteReportsResponse.class) }) - public String deleteReport(@PathParam("id") @ApiParam(value = "id") final Long id) { + @Operation(summary = "Delete a Report", description = "Only non-core reports can be deleted.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportsApiResourceSwagger.DeleteReportsResponse.class))) }) + public String deleteReport(@PathParam("id") @Parameter(description = "id") final Long id) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteReport(id).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResourceSwagger.java index 248b567f6..5b60662bb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import java.util.List; import org.apache.fineract.infrastructure.dataqueries.data.ReportParameterData; @@ -33,35 +32,35 @@ final class ReportsApiResourceSwagger { } - @ApiModel(value = "GetReportsResponse") + @Schema(description = "GetReportsResponse") public static final class GetReportsResponse { private GetReportsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Client Listing") + @Schema(example = "Client Listing") public String reportName; - @ApiModelProperty(example = "Table") + @Schema(example = "Table") public String reportType; public String reportSubType; - @ApiModelProperty(example = "Client") + @Schema(example = "Client") public String reportCategory; - @ApiModelProperty(example = "Individual Client Report Lists the small number of defined fields on the client table. Would expect to copy this report and add any one to one additional data for specific tenant needs. Can be run for any size MFI but you expect it only to be run within a branch for larger ones. Depending on how many columns are displayed, there is probably is a limit of about 20/50k clients returned for html display (export to excel doesnt have that client browser/memory impact).") + @Schema(example = "Individual Client Report Lists the small number of defined fields on the client table. Would expect to copy this report and add any one to one additional data for specific tenant needs. Can be run for any size MFI but you expect it only to be run within a branch for larger ones. Depending on how many columns are displayed, there is probably is a limit of about 20/50k clients returned for html display (export to excel doesnt have that client browser/memory impact).") public String description; - @ApiModelProperty(example = "") + @Schema(example = "") public String reportSql; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean coreReport; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean useReport; public Collection reportParameters; } - @ApiModel(value = "GetReportsTemplateResponse") + @Schema(description = "GetReportsTemplateResponse") public static final class GetReportsTemplateResponse { private GetReportsTemplateResponse() { @@ -73,53 +72,53 @@ final class ReportsApiResourceSwagger { public Collection allowedParameters; } - @ApiModel(value = "PostRepostRequest") + @Schema(description = "PostRepostRequest") public static final class PostRepostRequest { private PostRepostRequest() { } - @ApiModelProperty(example = "Completely New Report") + @Schema(example = "Completely New Report") public String reportName; - @ApiModelProperty(example = "Table") + @Schema(example = "Table") public String reportType; - @ApiModelProperty(example = "") + @Schema(example = "") public String reportSubType; - @ApiModelProperty(example = "Loan") + @Schema(example = "Loan") public String reportCategory; - @ApiModelProperty(example = "Just An Example") + @Schema(example = "Just An Example") public String description; - @ApiModelProperty(example = "select 'very good sql' as AComment") + @Schema(example = "select 'very good sql' as AComment") public String reportSql; public Collection reportParameters; } - @ApiModel(value = "PostReportsResponse") + @Schema(description = "PostReportsResponse") public static final class PostReportsResponse { private PostReportsResponse() { } - @ApiModelProperty(example = "132") + @Schema(example = "132") public long resourceId; } - @ApiModel(value = "PutReportRequest") + @Schema(description = "PutReportRequest") public static final class PutReportRequest { private PutReportRequest() { } - @ApiModelProperty(example = "Completely New Report") + @Schema(example = "Completely New Report") public String reportName; public Collection reportParameters; } - @ApiModel(value = "PutReportResponse") + @Schema(description = "PutReportResponse") public static final class PutReportResponse { private PutReportResponse() { @@ -132,24 +131,24 @@ final class ReportsApiResourceSwagger { } - @ApiModelProperty(example = "Changed New Report") + @Schema(example = "Changed New Report") public String reportName; public Collection reportParameters; } - @ApiModelProperty(example = "132") + @Schema(example = "132") public long resourceId; public PutReportResponseChanges changes; } - @ApiModel(value = "DeleteReportsResponse") + @Schema(description = "DeleteReportsResponse") public static final class DeleteReportsResponse { private DeleteReportsResponse() { } - @ApiModelProperty(example = "132") + @Schema(example = "132") public long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java index d82042a6c..ee05b1bb7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 java.io.File; import java.util.HashMap; import java.util.Map; @@ -62,8 +62,7 @@ import org.springframework.stereotype.Component; @Path("/runreports") @Component @Scope("singleton") -@Api(tags = { "Run Reports" }) -@SwaggerDefinition(tags = { @Tag(name = "Run Reports", description = "") }) +@Tag(name = "Run Reports", description = "") public class RunreportsApiResource { private final PlatformSecurityContext context; @@ -87,7 +86,7 @@ public class RunreportsApiResource { @Path("{reportName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON, "text/csv", "application/vnd.ms-excel", "application/pdf", "text/html" }) - @ApiOperation(value = "Running a Report", notes = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n" + @Operation(summary = "Running a Report", description = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n" + "\n" + "Reports can also be used to provide data for searching and workflow functionality.\n" + "\n" + "The default output is a JSON formatted \"Generic Resultset\". The Generic Resultset contains Column Heading as well as Data information. However, you can export to CSV format by simply adding \"&exportCSV=true\" to the end of your URL.\n" + "\n" @@ -105,10 +104,11 @@ public class RunreportsApiResource { + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=CSV&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=PDF&R_officeId=1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RunreportsApiResourceSwagger.GetReportNameResponse.class) }) - public Response runReport(@PathParam("reportName") @ApiParam(value = "reportName") final String reportName, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RunreportsApiResourceSwagger.GetReportNameResponse.class))) }) + public Response runReport(@PathParam("reportName") @Parameter(description = "reportName") final String reportName, @Context final UriInfo uriInfo, - @DefaultValue("false") @QueryParam("isSelfServiceUserReport") @ApiParam(value = "isSelfServiceUserReport") final boolean isSelfServiceUserReport) { + @DefaultValue("false") @QueryParam("isSelfServiceUserReport") @Parameter(description = "isSelfServiceUserReport") final boolean isSelfServiceUserReport) { final MultivaluedMap queryParams = uriInfo.getQueryParameters(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResourceSwagger.java index 7d4393afb..63fb56294 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResourceSwagger.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.dataqueries.api; -import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData; import org.apache.fineract.infrastructure.dataqueries.data.ResultsetRowData; @@ -31,7 +31,7 @@ final class RunreportsApiResourceSwagger { } - @ApiModel(value = "GetReportNameResponse") + @Schema(description = "GetReportNameResponse") public static final class GetReportNameResponse { private GetReportNameResponse() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java index 2aa88d349..da9912085 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java @@ -21,13 +21,14 @@ package org.apache.fineract.infrastructure.documentmanagement.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataBodyPart; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -64,12 +65,10 @@ import org.springframework.stereotype.Component; @Path("{entityType}/{entityId}/documents") @Component @Scope("singleton") -@Api(tags = { "Documents" }) -@SwaggerDefinition(tags = { - @Tag(name = "Documents", description = "Multiple Documents (a combination of a name, description and a file) may be attached to different Entities like Clients, Groups, Staff, Loans, Savings and Client Identifiers in the system\n" - + "\n" + "Note: The currently allowed Entities are\n" + "\n" + "Clients: URL Pattern as clients\n" - + "Staff: URL Pattern as staff\n" + "Loans: URL Pattern as loans\n" + "Savings: URL Pattern as savings\n" - + "Client Identifiers: URL Pattern as client_identifiers\n" + "Groups: URL Pattern as groups") }) +@Tag(name = "Documents", description = "Multiple Documents (a combination of a name, description and a file) may be attached to different Entities like Clients, Groups, Staff, Loans, Savings and Client Identifiers in the system\n" + + "\n" + "Note: The currently allowed Entities are\n" + "\n" + "Clients: URL Pattern as clients\n" + "Staff: URL Pattern as staff\n" + + "Loans: URL Pattern as loans\n" + "Savings: URL Pattern as savings\n" + "Client Identifiers: URL Pattern as client_identifiers\n" + + "Groups: URL Pattern as groups") public class DocumentManagementApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -97,13 +96,13 @@ public class DocumentManagementApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List documents", notes = "Example Requests:\n" + "\n" + "clients/1/documents\n" + "\n" + @Operation(summary = "List documents", description = "Example Requests:\n" + "\n" + "clients/1/documents\n" + "\n" + "client_identifiers/1/documents\n" + "\n" + "loans/1/documents?fields=name,description") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DocumentManagementApiResourceSwagger.GetEntityTypeEntityIdDocumentsResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = DocumentManagementApiResourceSwagger.GetEntityTypeEntityIdDocumentsResponse.class)))) }) public String retreiveAllDocuments(@Context final UriInfo uriInfo, - @PathParam("entityType") @ApiParam(value = "entityType") final String entityType, - @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId) { + @PathParam("entityType") @Parameter(description = "entityType") final String entityType, + @PathParam("entityId") @Parameter(description = "entityId") final Long entityId) { this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType); @@ -116,20 +115,20 @@ public class DocumentManagementApiResource { @POST @Consumes({ MediaType.MULTIPART_FORM_DATA }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Document", notes = "Note: A document is created using a Multi-part form upload \n" + "\n" + @Operation(summary = "Create a Document", description = "Note: A document is created using a Multi-part form upload \n" + "\n" + "Body Parts\n" + "\n" + "name : \n" + "Name or summary of the document\n" + "\n" + "description : \n" + "Description of the document\n" + "\n" + "file : \n" + "The file to be uploaded\n" + "\n" + "Mandatory Fields : \n" + "file and description") @ApiResponses({ - @ApiResponse(code = 200, message = "Not Shown (multi-part form data)", response = DocumentManagementApiResourceSwagger.PostEntityTypeEntityIdDocumentsResponse.class) }) - public String createDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, - @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @HeaderParam("Content-Length") @ApiParam(value = "Content-Length") final Long fileSize, - @FormDataParam("file") @ApiParam(value = "file") final InputStream inputStream, - @FormDataParam("file") final @ApiParam(value = "file") FormDataContentDisposition fileDetails, - @FormDataParam("file") @ApiParam(value = "file") final FormDataBodyPart bodyPart, - @FormDataParam("name") @ApiParam(value = "name") final String name, - @FormDataParam("description") @ApiParam(value = "description") final String description) { + @ApiResponse(responseCode = "200", description = "Not Shown (multi-part form data)", content = @Content(schema = @Schema(implementation = DocumentManagementApiResourceSwagger.PostEntityTypeEntityIdDocumentsResponse.class))) }) + public String createDocument(@PathParam("entityType") @Parameter(description = "entityType") final String entityType, + @PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @HeaderParam("Content-Length") @Parameter(description = "Content-Length") final Long fileSize, + @FormDataParam("file") @Parameter(description = "file") final InputStream inputStream, + @FormDataParam("file") final @Parameter(description = "file") FormDataContentDisposition fileDetails, + @FormDataParam("file") @Parameter(description = "file") final FormDataBodyPart bodyPart, + @FormDataParam("name") @Parameter(description = "name") final String name, + @FormDataParam("description") @Parameter(description = "description") final String description) { /** * TODO: also need to have a backup and stop reading from stream after max size is reached to protect against @@ -151,20 +150,20 @@ public class DocumentManagementApiResource { @Path("{documentId}") @Consumes({ MediaType.MULTIPART_FORM_DATA }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Document", notes = "Note: A document is updated using a Multi-part form upload \n" + "Body Parts\n" + @Operation(summary = "Update a Document", description = "Note: A document is updated using a Multi-part form upload \n" + "Body Parts\n" + "name\n" + "Name or summary of the document\n" + "description\n" + "Description of the document\n" + "file\n" + "The file to be uploaded") @ApiResponses({ - @ApiResponse(code = 200, message = "Not Shown (multi-part form data)", response = DocumentManagementApiResourceSwagger.PutEntityTypeEntityIdDocumentsResponse.class) }) - public String updateDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, - @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @PathParam("documentId") @ApiParam(value = "documentId") final Long documentId, - @HeaderParam("Content-Length") @ApiParam(value = "Content-Length") final Long fileSize, - @FormDataParam("file") @ApiParam(value = "file") final InputStream inputStream, - @FormDataParam("file") @ApiParam(value = "file") final FormDataContentDisposition fileDetails, - @FormDataParam("file") @ApiParam(value = "file") final FormDataBodyPart bodyPart, - @FormDataParam("name") @ApiParam(value = "name") final String name, - @FormDataParam("description") @ApiParam(value = "description") final String description) { + @ApiResponse(responseCode = "200", description = "Not Shown (multi-part form data)", content = @Content(schema = @Schema(implementation = DocumentManagementApiResourceSwagger.PutEntityTypeEntityIdDocumentsResponse.class))) }) + public String updateDocument(@PathParam("entityType") @Parameter(description = "entityType") final String entityType, + @PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @PathParam("documentId") @Parameter(description = "documentId") final Long documentId, + @HeaderParam("Content-Length") @Parameter(description = "Content-Length") final Long fileSize, + @FormDataParam("file") @Parameter(description = "file") final InputStream inputStream, + @FormDataParam("file") @Parameter(description = "file") final FormDataContentDisposition fileDetails, + @FormDataParam("file") @Parameter(description = "file") final FormDataBodyPart bodyPart, + @FormDataParam("name") @Parameter(description = "name") final String name, + @FormDataParam("description") @Parameter(description = "description") final String description) { final Set modifiedParams = new HashSet<>(); modifiedParams.add("name"); @@ -197,13 +196,13 @@ public class DocumentManagementApiResource { @Path("{documentId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Document", notes = "Example Requests:\n" + "\n" + "clients/1/documents/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Document", description = "Example Requests:\n" + "\n" + "clients/1/documents/1\n" + "\n" + "\n" + "loans/1/documents/1\n" + "\n" + "\n" + "client_identifiers/1/documents/1?fields=name,description") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DocumentManagementApiResourceSwagger.GetEntityTypeEntityIdDocumentsResponse.class) }) - public String getDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, - @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @PathParam("documentId") @ApiParam(value = "documentId") final Long documentId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DocumentManagementApiResourceSwagger.GetEntityTypeEntityIdDocumentsResponse.class))) }) + public String getDocument(@PathParam("entityType") @Parameter(description = "entityType") final String entityType, + @PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @PathParam("documentId") @Parameter(description = "documentId") final Long documentId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType); @@ -217,12 +216,12 @@ public class DocumentManagementApiResource { @Path("{documentId}/attachment") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_OCTET_STREAM }) - @ApiOperation(value = "Retrieve Binary File associated with Document", notes = "Request used to download the file associated with the document\n" + @Operation(summary = "Retrieve Binary File associated with Document", description = "Request used to download the file associated with the document\n" + "\n" + "Example Requests:\n" + "\n" + "clients/1/documents/1/attachment\n" + "\n" + "\n" + "loans/1/documents/1/attachment") - @ApiResponses({ @ApiResponse(code = 200, message = "Not Shown: The corresponding Binary file") }) - public Response downloadFile(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, - @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @PathParam("documentId") @ApiParam(value = "documentId") final Long documentId) { + @ApiResponses({ @ApiResponse(responseCode = "200", description = "Not Shown: The corresponding Binary file") }) + public Response downloadFile(@PathParam("entityType") @Parameter(description = "entityType") final String entityType, + @PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @PathParam("documentId") @Parameter(description = "documentId") final Long documentId) { this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType); @@ -238,12 +237,12 @@ public class DocumentManagementApiResource { @Path("{documentId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Remove a Document", notes = "") + @Operation(summary = "Remove a Document", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = DocumentManagementApiResourceSwagger.DeleteEntityTypeEntityIdDocumentsResponse.class) }) - public String deleteDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, - @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @PathParam("documentId") @ApiParam(value = "documentId") final Long documentId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = DocumentManagementApiResourceSwagger.DeleteEntityTypeEntityIdDocumentsResponse.class))) }) + public String deleteDocument(@PathParam("entityType") @Parameter(description = "entityType") final String entityType, + @PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @PathParam("documentId") @Parameter(description = "documentId") final Long documentId) { final DocumentCommand documentCommand = new DocumentCommand(null, documentId, entityType, entityId, null, null, null, null, null, null); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResourceSwagger.java index 94dd1754e..0d9dc4eec 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.documentmanagement.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 7/8/17. @@ -31,49 +30,49 @@ final class DocumentManagementApiResourceSwagger { } - @ApiModel(value = "GetEntityTypeEntityIdDocumentsResponse") + @Schema(description = "GetEntityTypeEntityIdDocumentsResponse") public static final class GetEntityTypeEntityIdDocumentsResponse { private GetEntityTypeEntityIdDocumentsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "clients") + @Schema(example = "clients") public String parentEntityType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long parentEntityId; - @ApiModelProperty(example = "Client Details Form") + @Schema(example = "Client Details Form") public String name; - @ApiModelProperty(example = "CGAP.pdf") + @Schema(example = "CGAP.pdf") public String fileName; - @ApiModelProperty(example = "5246719") + @Schema(example = "5246719") public Long size; - @ApiModelProperty(example = "application/pdf") + @Schema(example = "application/pdf") public String type; - @ApiModelProperty(example = "A signed form signed by new member") + @Schema(example = "A signed form signed by new member") public String description; - @ApiModelProperty(example = "") + @Schema(example = "") public String location; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer storageType; } - @ApiModel(value = "PostEntityTypeEntityIdDocumentsResponse") + @Schema(description = "PostEntityTypeEntityIdDocumentsResponse") public static final class PostEntityTypeEntityIdDocumentsResponse { private PostEntityTypeEntityIdDocumentsResponse() { } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long resourceId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public String resourceIdentifier; } - @ApiModel(value = "PutEntityTypeEntityIdDocumentsResponse") + @Schema(description = "PutEntityTypeEntityIdDocumentsResponse") public static final class PutEntityTypeEntityIdDocumentsResponse { private PutEntityTypeEntityIdDocumentsResponse() { @@ -88,14 +87,14 @@ final class DocumentManagementApiResourceSwagger { } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long resourceId; public PutEntityTypeEntityIdDocumentsResponse.PutEntityTypeEntityIdDocumentsResponseChangesSwagger changes; - @ApiModelProperty(example = "3") + @Schema(example = "3") public String resourceIdentifier; } - @ApiModel(value = "DeleteEntityTypeEntityIdDocumentsResponse") + @Schema(description = "DeleteEntityTypeEntityIdDocumentsResponse") public static final class DeleteEntityTypeEntityIdDocumentsResponse { private DeleteEntityTypeEntityIdDocumentsResponse() { @@ -110,10 +109,10 @@ final class DocumentManagementApiResourceSwagger { } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long resourceId; public DeleteEntityTypeEntityIdDocumentsResponse.PutEntityTypeEntityIdDocumentsResponseChangesSwagger changes; - @ApiModelProperty(example = "3") + @Schema(example = "3") public String resourceIdentifier; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java index d587b7b95..1d681fcdf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java @@ -21,7 +21,6 @@ package org.apache.fineract.infrastructure.documentmanagement.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataBodyPart; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; import java.io.InputStream; import java.util.Base64; import javax.ws.rs.Consumes; @@ -56,7 +55,7 @@ import org.springframework.stereotype.Component; @Path("{entity}/{entityId}/images") @Component @Scope("singleton") -@Api(value = "DomainName//api//v1//{entity}//{entityId}//images", description = "") + public class ImagesApiResource { private final PlatformSecurityContext context; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java index 74d3715eb..04621372b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java @@ -18,7 +18,6 @@ */ package org.apache.fineract.infrastructure.entityaccess.api; -import io.swagger.annotations.Api; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -51,7 +50,7 @@ import org.springframework.stereotype.Component; @Produces({ MediaType.APPLICATION_JSON }) @Component @Scope("singleton") -@Api(value = "DomainName/api/v1/entitytoentitymapping", description = "") // https://github.com/swagger-api/swagger-ui/issues/1655 + public class FineractEntityApiResource { private final PlatformSecurityContext context; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java index 1d6f00180..3be95524e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java @@ -21,15 +21,15 @@ package org.apache.fineract.infrastructure.hooks.api; import static org.apache.fineract.infrastructure.hooks.api.HookApiConstants.HOOK_RESOURCE_NAME; import static org.apache.fineract.infrastructure.hooks.api.HookApiConstants.RESPONSE_DATA_PARAMETERS; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -61,9 +61,7 @@ import org.springframework.stereotype.Component; @Produces({ MediaType.APPLICATION_JSON }) @Component @Scope("singleton") -@Api(tags = { "Hooks" }) -@SwaggerDefinition(tags = { - @Tag(name = "Hooks", description = "Hooks are a mechanism to trigger custom code on the occurence of events. ") }) +@Tag(name = "Hooks", description = "Hooks are a mechanism to trigger custom code on the occurence of events. ") public class HookApiResource { private final PlatformSecurityContext context; @@ -84,10 +82,9 @@ public class HookApiResource { } @GET - @ApiOperation(value = "Retrieve Hooks", notes = "Returns the list of hooks.\n" + "\n" + "Example Requests:\n" + "\n" - + "hooks", responseContainer = "List", response = HookApiResourceSwagger.GetHookResponse.class) + @Operation(summary = "Retrieve Hooks", description = "Returns the list of hooks.\n" + "\n" + "Example Requests:\n" + "\n" + "hooks") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.GetHookResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = HookApiResourceSwagger.GetHookResponse.class)))) }) public String retrieveHooks(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(HOOK_RESOURCE_NAME); @@ -100,9 +97,11 @@ public class HookApiResource { @GET @Path("{hookId}") - @ApiOperation(value = "Retrieve a Hook", notes = "Returns the details of a Hook.\n" + "\n" + "Example Requests:\n" + "\n" + "hooks/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.GetHookResponse.class) }) - public String retrieveHook(@PathParam("hookId") @ApiParam(value = "hookId") final Long hookId, @Context final UriInfo uriInfo) { + @Operation(summary = "Retrieve a Hook", description = "Returns the details of a Hook.\n" + "\n" + "Example Requests:\n" + "\n" + + "hooks/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.GetHookResponse.class))) }) + public String retrieveHook(@PathParam("hookId") @Parameter(description = "hookId") final Long hookId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(HOOK_RESOURCE_NAME); @@ -119,9 +118,10 @@ public class HookApiResource { @GET @Path("template") - @ApiOperation(value = "Retrieve Hooks Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "hooks/template") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.GetHookTemplateResponse.class) }) + @Operation(summary = "Retrieve Hooks Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "hooks/template") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.GetHookTemplateResponse.class))) }) public String template(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(HOOK_RESOURCE_NAME); @@ -133,16 +133,16 @@ public class HookApiResource { } @POST - @ApiOperation(value = "Create a Hook", notes = "The following parameters can be passed for the creation of a hook :-\n" + "\n" + @Operation(summary = "Create a Hook", description = "The following parameters can be passed for the creation of a hook :-\n" + "\n" + "name - string - Required. The name of the template that is being called. (See /hooks/template for the list of valid hook names.)\n" + "\n" + "isActive - boolean - Determines whether the hook is actually triggered.\n" + "\n" + "events - array - Determines what events the hook is triggered for.\n" + "\n" + "config - hash - Required. Key/value pairs to provide settings for this hook. These settings vary between the templates.\n" + "\n" + "templateId - Optional. The UGD template ID associated with the same entity (client or loan).") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", dataType = "body", required = true, type = "body", dataTypeClass = HookApiResourceSwagger.PostHookRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.PostHookResponse.class) }) - public String createHook(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.PostHookRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.PostHookResponse.class))) }) + public String createHook(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createHook().withJson(apiRequestBodyAsJson).build(); @@ -153,12 +153,12 @@ public class HookApiResource { @PUT @Path("{hookId}") - @ApiOperation(value = "Update a Hook", notes = "Updates the details of a hook.") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", dataType = "body", required = true, type = "body", dataTypeClass = HookApiResourceSwagger.PutHookRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.PutHookResponse.class) }) - public String updateHook(@PathParam("hookId") @ApiParam(value = "hookId") final Long hookId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Hook", description = "Updates the details of a hook.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.PutHookRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.PutHookResponse.class))) }) + public String updateHook(@PathParam("hookId") @Parameter(description = "hookId") final Long hookId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateHook(hookId).withJson(apiRequestBodyAsJson).build(); @@ -169,9 +169,10 @@ public class HookApiResource { @DELETE @Path("{hookId}") - @ApiOperation(value = "Delete a Hook", notes = "Deletes a hook.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.DeleteHookResponse.class) }) - public String deleteHook(@PathParam("hookId") @ApiParam(value = "hookId") final Long hookId) { + @Operation(summary = "Delete a Hook", description = "Deletes a hook.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HookApiResourceSwagger.DeleteHookResponse.class))) }) + public String deleteHook(@PathParam("hookId") @Parameter(description = "hookId") final Long hookId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteHook(hookId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResourceSwagger.java index 0c4703f11..383cd9ee1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.hooks.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.infrastructure.hooks.data.Event; import org.apache.fineract.infrastructure.hooks.data.Field; @@ -37,64 +36,64 @@ final class HookApiResourceSwagger { } - @ApiModel(value = "PostHookRequest") + @Schema(description = "PostHookRequest") public static final class PostHookRequest { private PostHookRequest() { } - @ApiModelProperty(example = "Web") + @Schema(example = "Web") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "Kremlin") + @Schema(example = "Kremlin") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long templateId; public List events; public List config; } - @ApiModel(value = "PostHookResponse") + @Schema(description = "PostHookResponse") public static final class PostHookResponse { private PostHookResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } - @ApiModel(value = "GetHookResponse") + @Schema(description = "GetHookResponse") public static final class GetHookResponse { private GetHookResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Web") + @Schema(example = "Web") public String name; - @ApiModelProperty(example = "Kremlin") + @Schema(example = "Kremlin") public String displayName; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "[2014, 9, 16]") + @Schema(example = "[2014, 9, 16]") public LocalDate createdAt; - @ApiModelProperty(example = "[2014, 9, 16]") + @Schema(example = "[2014, 9, 16]") public LocalDate updatedAt; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long templateId; - @ApiModelProperty(example = "My UGD") + @Schema(example = "My UGD") public String templateName; public List events; public List config; } - @ApiModel(value = "GetHookTemplateResponse") + @Schema(description = "GetHookTemplateResponse") public static final class GetHookTemplateResponse { private GetHookTemplateResponse() { @@ -105,37 +104,37 @@ final class HookApiResourceSwagger { public List groupings; } - @ApiModel(value = "DeleteHookResponse") + @Schema(description = "DeleteHookResponse") public static final class DeleteHookResponse { private DeleteHookResponse() { } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; } - @ApiModel(value = "PutHookRequest") + @Schema(description = "PutHookRequest") public static final class PutHookRequest { private PutHookRequest() { } - @ApiModelProperty(example = "Web") + @Schema(example = "Web") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "Kremlin") + @Schema(example = "Kremlin") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long templateId; public List events; public List config; } - @ApiModel(value = "PutHookResponse") + @Schema(description = "PutHookResponse") public static final class PutHookResponse { private PutHookResponse() { @@ -146,14 +145,14 @@ final class HookApiResourceSwagger { private PutHookResponseChangesSwagger() {} - @ApiModelProperty(example = "Kremlin") + @Schema(example = "Kremlin") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public List events; public List config; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long resourceId; public PutHookResponseChangesSwagger changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java index 448c4fda5..af877d5ca 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.infrastructure.jobs.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -49,8 +49,8 @@ import org.springframework.stereotype.Component; @Path("/scheduler") @Component -@Api(tags = { "Scheduler" }) -@SwaggerDefinition(tags = { @Tag(name = "Scheduler", description = "") }) + +@Tag(name = "Scheduler", description = "") public class SchedulerApiResource { private final PlatformSecurityContext context; @@ -70,9 +70,10 @@ public class SchedulerApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Scheduler Status", notes = "Returns the scheduler status.\n" + "\n" + "Example Requests:\n" + "\n" + @Operation(summary = "Retrieve Scheduler Status", description = "Returns the scheduler status.\n" + "\n" + "Example Requests:\n" + "\n" + "scheduler") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SchedulerApiResourceSwagger.GetSchedulerResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SchedulerApiResourceSwagger.GetSchedulerResponse.class))) }) public String retrieveStatus(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME); final boolean isSchedulerRunning = this.jobRegisterService.isSchedulerRunning(); @@ -85,10 +86,11 @@ public class SchedulerApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Activate Scheduler Jobs | Suspend Scheduler Jobs", notes = "Activates the scheduler job service. | Suspends the scheduler job service.") - @ApiResponses({ @ApiResponse(code = 200, message = "POST : scheduler?command=start\n\n" + "\n" + "POST : scheduler?command=stop") }) + @Operation(summary = "Activate Scheduler Jobs | Suspend Scheduler Jobs", description = "Activates the scheduler job service. | Suspends the scheduler job service.") + @ApiResponses({ @ApiResponse(responseCode = "200", description = "POST : scheduler?command=start\n\n" + "\n" + + "POST : scheduler?command=stop") }) public Response changeSchedulerStatus( - @QueryParam(SchedulerJobApiConstants.COMMAND) @ApiParam(value = "command") final String commandParam) { + @QueryParam(SchedulerJobApiConstants.COMMAND) @Parameter(description = "command") final String commandParam) { // check the logged in user have permissions to update scheduler status final boolean hasNotPermission = this.context.authenticatedUser().hasNotPermissionForAnyOf("ALL_FUNCTIONS", "UPDATE_SCHEDULER"); if (hasNotPermission) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResourceSwagger.java index 3b462ed6d..1d9960fac 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.jobs.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 12/8/17. @@ -30,14 +29,14 @@ final class SchedulerApiResourceSwagger { } - @ApiModel(value = "GetSchedulerResponse") + @Schema(description = "GetSchedulerResponse") public static final class GetSchedulerResponse { private GetSchedulerResponse() { } - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean active; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java index e9635fb43..3967c8f57 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.jobs.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -64,9 +64,7 @@ import org.springframework.stereotype.Component; @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Component -@Api(tags = { "MIFOSX-BATCH JOBS" }) -@SwaggerDefinition(tags = { - @Tag(name = "MIFOSX-BATCH JOBS", description = "Batch jobs (also known as cron jobs on Unix-based systems) are a series of back-end jobs executed on a computer at a particular time defined in job's cron expression.\n\n At any point, you can view the list of batch jobs scheduled to run along with other details specific to each job. Manually you can execute the jobs at any point of time.\n\n The scheduler status can be either \"Active\" or \"Standby\". If the scheduler status is Active, it indicates that all batch jobs are running/ will run as per the specified schedule.If the scheduler status is Standby, it will ensure all scheduled batch runs are suspended.") }) +@Tag(name = "MIFOSX-BATCH JOBS", description = "Batch jobs (also known as cron jobs on Unix-based systems) are a series of back-end jobs executed on a computer at a particular time defined in job's cron expression.\n\n At any point, you can view the list of batch jobs scheduled to run along with other details specific to each job. Manually you can execute the jobs at any point of time.\n\n The scheduler status can be either \"Active\" or \"Standby\". If the scheduler status is Active, it indicates that all batch jobs are running/ will run as per the specified schedule.If the scheduler status is Standby, it will ensure all scheduled batch runs are suspended.") public class SchedulerJobApiResource { private final SchedulerJobRunnerReadService schedulerJobRunnerReadService; @@ -93,9 +91,10 @@ public class SchedulerJobApiResource { } @GET - @ApiOperation(value = "Retrieve Scheduler Jobs", notes = "Returns the list of jobs.\n" + "\n" + "Example Requests:\n" + "\n" + "jobs") + @Operation(summary = "Retrieve Scheduler Jobs", description = "Returns the list of jobs.\n" + "\n" + "Example Requests:\n" + "\n" + + "jobs") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = SchedulerJobApiResourceSwagger.GetJobsResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SchedulerJobApiResourceSwagger.GetJobsResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME); final List jobDetailDatas = this.schedulerJobRunnerReadService.findAllJobDeatils(); @@ -105,9 +104,10 @@ public class SchedulerJobApiResource { @GET @Path("{" + SchedulerJobApiConstants.JOB_ID + "}") - @ApiOperation(value = "Retrieve a Job", notes = "Returns the details of a Job.\n" + "\n" + "Example Requests:\n" + "\n" + "jobs/5") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SchedulerJobApiResourceSwagger.GetJobsResponse.class) }) - public String retrieveOne(@PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId, + @Operation(summary = "Retrieve a Job", description = "Returns the details of a Job.\n" + "\n" + "Example Requests:\n" + "\n" + "jobs/5") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SchedulerJobApiResourceSwagger.GetJobsResponse.class))) }) + public String retrieveOne(@PathParam(SchedulerJobApiConstants.JOB_ID) @Parameter(description = "jobId") final Long jobId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME); final JobDetailData jobDetailData = this.schedulerJobRunnerReadService.retrieveOne(jobId); @@ -117,15 +117,15 @@ public class SchedulerJobApiResource { @GET @Path("{" + SchedulerJobApiConstants.JOB_ID + "}/" + SchedulerJobApiConstants.JOB_RUN_HISTORY) - @ApiOperation(value = "Retrieve Job Run History", notes = "Example Requests:\n" + "\n" + "jobs/5/runhistory?offset=0&limit=200") + @Operation(summary = "Retrieve Job Run History", description = "Example Requests:\n" + "\n" + "jobs/5/runhistory?offset=0&limit=200") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = SchedulerJobApiResourceSwagger.GetJobsJobIDJobRunHistoryResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SchedulerJobApiResourceSwagger.GetJobsJobIDJobRunHistoryResponse.class))) }) public String retrieveHistory(@Context final UriInfo uriInfo, - @PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @PathParam(SchedulerJobApiConstants.JOB_ID) @Parameter(description = "jobId") final Long jobId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME); final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit, orderBy, sortOrder); final Page jobhistoryDetailData = this.schedulerJobRunnerReadService.retrieveJobHistory(jobId, @@ -137,10 +137,10 @@ public class SchedulerJobApiResource { @POST @Path("{" + SchedulerJobApiConstants.JOB_ID + "}") - @ApiOperation(value = "Run a Job", notes = "Manually Execute Specific Job.") - @ApiResponses({ @ApiResponse(code = 200, message = "POST: jobs/1?command=executeJob") }) - public Response executeJob(@PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId, - @QueryParam(SchedulerJobApiConstants.COMMAND) @ApiParam(value = "command") final String commandParam) { + @Operation(summary = "Run a Job", description = "Manually Execute Specific Job.") + @ApiResponses({ @ApiResponse(responseCode = "200", description = "POST: jobs/1?command=executeJob") }) + public Response executeJob(@PathParam(SchedulerJobApiConstants.JOB_ID) @Parameter(description = "jobId") final Long jobId, + @QueryParam(SchedulerJobApiConstants.COMMAND) @Parameter(description = "command") final String commandParam) { // check the logged in user have permissions to execute scheduler jobs final boolean hasNotPermission = this.context.authenticatedUser().hasNotPermissionForAnyOf("ALL_FUNCTIONS", "EXECUTEJOB_SCHEDULER"); if (hasNotPermission) { @@ -159,12 +159,11 @@ public class SchedulerJobApiResource { @PUT @Path("{" + SchedulerJobApiConstants.JOB_ID + "}") - @ApiOperation(value = "Update a Job", notes = "Updates the details of a job.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SchedulerJobApiResourceSwagger.PutJobsJobIDRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "") }) - public String updateJobDetail(@PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(summary = "Update a Job", description = "Updates the details of a job.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SchedulerJobApiResourceSwagger.PutJobsJobIDRequest.class))) + @ApiResponses({ @ApiResponse(responseCode = "200", description = "") }) + public String updateJobDetail(@PathParam(SchedulerJobApiConstants.JOB_ID) @Parameter(description = "jobId") final Long jobId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateJobDetail(jobId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResourceSwagger.java index 641debd71..1224abe06 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.jobs.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Date; import java.util.List; import org.apache.fineract.infrastructure.jobs.data.JobDetailHistoryData; @@ -33,47 +32,47 @@ final class SchedulerJobApiResourceSwagger { } - @ApiModel(value = "GetJobsResponse") + @Schema(description = "GetJobsResponse") public static final class GetJobsResponse { private GetJobsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long jobId; - @ApiModelProperty(example = "Update loan Summary") + @Schema(example = "Update loan Summary") public String displayName; - @ApiModelProperty(example = "") + @Schema(example = "") public Date nextRunTime; - @ApiModelProperty(example = "") + @Schema(example = "") public String initializingError; - @ApiModelProperty(example = "0 0 22 1/1 * ? *") + @Schema(example = "0 0 22 1/1 * ? *") public String cronExpression; - @ApiModelProperty(example = "false") + @Schema(example = "false") public boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public boolean currentlyRunning; public JobDetailHistoryData lastRunHistory; } - @ApiModel(value = "PutJobsJobsIDRequest") + @Schema(description = "PutJobsJobsIDRequest") public static final class PutJobsJobIDRequest { private PutJobsJobIDRequest() { } - @ApiModelProperty(example = "Update loan Summary") + @Schema(example = "Update loan Summary") public String displayName; - @ApiModelProperty(example = "0 0 22 1/1 * ? *") + @Schema(example = "0 0 22 1/1 * ? *") public String cronExpression; - @ApiModelProperty(example = "false") + @Schema(example = "false") public boolean active; } - @ApiModel(value = "GetJobsJobIDJobRunHistoryResponse") + @Schema(description = "GetJobsJobIDJobRunHistoryResponse") public static final class GetJobsJobIDJobRunHistoryResponse { private GetJobsJobIDJobRunHistoryResponse() { @@ -84,19 +83,19 @@ final class SchedulerJobApiResourceSwagger { private JobDetailHistoryDataSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long version; - @ApiModelProperty(example = "Jul 16, 2013 12:00:00 PM") + @Schema(example = "Jul 16, 2013 12:00:00 PM") public Date jobRunStartTime; - @ApiModelProperty(example = "Jul 16, 2013 12:00:00 PM") + @Schema(example = "Jul 16, 2013 12:00:00 PM") public Date jobRunEndTime; - @ApiModelProperty(example = "success") + @Schema(example = "success") public String status; - @ApiModelProperty(example = "cron") + @Schema(example = "cron") public String triggerType; } - @ApiModelProperty(example = "8") + @Schema(example = "8") public int totalFilteredRecords; public List pageItems; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java index 076fc65e8..577f47fbe 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.infrastructure.reportmailingjob.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -59,9 +59,7 @@ import org.springframework.stereotype.Component; @Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RESOURCE_NAME) @Component @Scope("singleton") -@Api(tags = { "Report Mailing Jobs" }) -@SwaggerDefinition(tags = { - @Tag(name = "Report Mailing Jobs", description = "This resource allows you to create a scheduled job that runs a report and sents it by email to specified email addresses.\n\nThe scheduled job can be configured to run once or on a regular basis (once a day, twice a week, etc)") }) +@Tag(name = "Report Mailing Jobs", description = "This resource allows you to create a scheduled job that runs a report and sents it by email to specified email addresses.\n\nThe scheduled job can be configured to run once or on a regular basis (once a day, twice a week, etc)") public class ReportMailingJobApiResource { private final PlatformSecurityContext platformSecurityContext; @@ -86,14 +84,13 @@ public class ReportMailingJobApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Report Mailing Job", notes = "Mandatory Fields: " + @Operation(summary = "Create a Report Mailing Job", description = "Mandatory Fields: " + "name, startDateTime, stretchyReportId, emailRecipients, emailSubject, emailMessage, emailAttachmentFileFormatId, recurrence, isActive\n" + "\n" + "Optional Fields: " + "description, stretchyReportParamMap") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportMailingJobApiResourceSwagger.PostReportMailingJobsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.PostReportMailingJobsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.PostReportMailingJobsResponse.class) }) - public String createReportMailingJob(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.PostReportMailingJobsResponse.class))) }) + public String createReportMailingJob(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandWrapper = new CommandWrapperBuilder() .createReportMailingJob(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME).withJson(apiRequestBodyAsJson).build(); @@ -106,13 +103,12 @@ public class ReportMailingJobApiResource { @Path("{entityId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Report Mailing Job\n", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportMailingJobApiResourceSwagger.PutReportMailingJobsRequest.class) }) + @Operation(summary = "Update a Report Mailing Job\n", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.PutReportMailingJobsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.PutReportMailingJobsResponse.class) }) - public String updateReportMailingJob(@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.PutReportMailingJobsResponse.class))) }) + public String updateReportMailingJob(@PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandWrapper = new CommandWrapperBuilder() .updateReportMailingJob(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME, entityId).withJson(apiRequestBodyAsJson) .build(); @@ -126,13 +122,12 @@ public class ReportMailingJobApiResource { @Path("{entityId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Report Mailing Job", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportMailingJobApiResourceSwagger.DeleteReportMailingJobsRequest.class) }) + @Operation(summary = "Delete a Report Mailing Job", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.DeleteReportMailingJobsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.DeleteReportMailingJobsResponse.class) }) - public String deleteReportMailingJob(@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.DeleteReportMailingJobsResponse.class))) }) + public String deleteReportMailingJob(@PathParam("entityId") @Parameter(description = "entityId") final Long entityId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandWrapper = new CommandWrapperBuilder() .deleteReportMailingJob(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME, entityId).withJson(apiRequestBodyAsJson) .build(); @@ -146,11 +141,11 @@ public class ReportMailingJobApiResource { @Path("{entityId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Report Mailing Job", notes = "Example Requests:\n" + "\n" + "reportmailingjobs/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Report Mailing Job", description = "Example Requests:\n" + "\n" + "reportmailingjobs/1\n" + "\n" + "\n" + "reportmailingjobs/1?template=true") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.GetReportMailingJobsResponse.class) }) - public String retrieveReportMailingJob(@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.GetReportMailingJobsResponse.class))) }) + public String retrieveReportMailingJob(@PathParam("entityId") @Parameter(description = "entityId") final Long entityId, @Context final UriInfo uriInfo) { this.platformSecurityContext.authenticatedUser() .validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME); @@ -172,10 +167,10 @@ public class ReportMailingJobApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Report Mailing Job Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for report mailing job applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "reportmailingjobs/template") + @Operation(summary = "Retrieve Report Mailing Job Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for report mailing job applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "reportmailingjobs/template") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.GetReportMailingJobsTemplate.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.GetReportMailingJobsTemplate.class))) }) public String retrieveReportMailingJobTemplate(@Context final UriInfo uriInfo) { this.platformSecurityContext.authenticatedUser() .validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME); @@ -191,14 +186,14 @@ public class ReportMailingJobApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Report Mailing Jobs", notes = "Example Requests:\n" + "\n" + "reportmailingjobs") + @Operation(summary = "List Report Mailing Jobs", description = "Example Requests:\n" + "\n" + "reportmailingjobs") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.GetReportMailingJobsResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ReportMailingJobApiResourceSwagger.GetReportMailingJobsResponse.class)))) }) public String retrieveAllReportMailingJobs(@Context final UriInfo uriInfo, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.platformSecurityContext.authenticatedUser() .validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResourceSwagger.java index 189ca90e8..93349bf48 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.reportmailingjob.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.dataqueries.data.ReportData; @@ -35,120 +34,120 @@ final class ReportMailingJobApiResourceSwagger { } - @ApiModel(value = "GetReportMailingJobsTemplate") + @Schema(description = "GetReportMailingJobsTemplate") public static final class GetReportMailingJobsTemplate { private GetReportMailingJobsTemplate() { } - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean isActive; public List emailAttachmentFileFormatOptions; public List stretchyReportParamDateOptions; } - @ApiModel(value = "GetReportMailingJobsResponse") + @Schema(description = "GetReportMailingJobsResponse") public static final class GetReportMailingJobsResponse { private GetReportMailingJobsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String name; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String description; - @ApiModelProperty(example = "1469627093000") + @Schema(example = "1469627093000") public DateTime startDateTime; - @ApiModelProperty(example = "") + @Schema(example = "") public String recurrence; public ReportMailingJobTimelineData timeline; - @ApiModelProperty(example = "info@musonisystem.com") + @Schema(example = "info@musonisystem.com") public String emailRecipients; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String emailSubject; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String emailMessage; - @ApiModelProperty(example = "") + @Schema(example = "") public EnumOptionData emailAttachmentFileFormat; - @ApiModelProperty(example = "") + @Schema(example = "") public ReportData stretchyReport; - @ApiModelProperty(example = "{\"startDate\":\"2016-07-01\",\"endDate\":\"2016-08-02\",\"selectOffice\":\"1\",\"environementUrl\":\"environementUrl\"}") + @Schema(example = "{\"startDate\":\"2016-07-01\",\"endDate\":\"2016-08-02\",\"selectOffice\":\"1\",\"environementUrl\":\"environementUrl\"}") public String stretchyReportParamMap; - @ApiModelProperty(example = "1469627093000") + @Schema(example = "1469627093000") public DateTime nextRunDateTime; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer numberOfRuns; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean isActive; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long runAsUserId; } - @ApiModel(value = "PostReportMailingJobsRequest") + @Schema(description = "PostReportMailingJobsRequest") public static final class PostReportMailingJobsRequest { private PostReportMailingJobsRequest() { } - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy HH:mm:ss") + @Schema(example = "dd-MM-yyyy HH:mm:ss") public String dateFormat; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String name; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String description; - @ApiModelProperty(example = "1469627093000") + @Schema(example = "1469627093000") public DateTime startDateTime; - @ApiModelProperty(example = "120") + @Schema(example = "120") public Long stretchyReportId; - @ApiModelProperty(example = "info@musonisystem.com") + @Schema(example = "info@musonisystem.com") public String emailRecipients; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String emailSubject; - @ApiModelProperty(example = "Client Numbers Report") + @Schema(example = "Client Numbers Report") public String emailMessage; - @ApiModelProperty(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR") + @Schema(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR") public String recurrence; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean isActive; - @ApiModelProperty(example = "{\"startDate\":\"2016-07-01\",\"endDate\":\"2016-08-02\",\"selectOffice\":\"1\",\"environementUrl\":\"environementUrl\"}") + @Schema(example = "{\"startDate\":\"2016-07-01\",\"endDate\":\"2016-08-02\",\"selectOffice\":\"1\",\"environementUrl\":\"environementUrl\"}") public String stretchyReportParamMap; } - @ApiModel(value = "PostReportMailingJobsResponse") + @Schema(description = "PostReportMailingJobsResponse") public static final class PostReportMailingJobsResponse { private PostReportMailingJobsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PutReportMailingJobsRequest") + @Schema(description = "PutReportMailingJobsRequest") public static final class PutReportMailingJobsRequest { private PutReportMailingJobsRequest() { } - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy HH:mm:ss") + @Schema(example = "dd-MM-yyyy HH:mm:ss") public String dateFormat; - @ApiModelProperty(example = "10-08-2016 23:30:00") + @Schema(example = "10-08-2016 23:30:00") public DateTime startDateTime; } - @ApiModel(value = "PutReportMailingJobsResponse") + @Schema(description = "PutReportMailingJobsResponse") public static final class PutReportMailingJobsResponse { private PutReportMailingJobsResponse() { @@ -159,16 +158,16 @@ final class ReportMailingJobApiResourceSwagger { private PutReportMailingJobsResponseChanges() {} - @ApiModelProperty(example = "10-08-2016 23:30:00") + @Schema(example = "10-08-2016 23:30:00") public DateTime startDateTime; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutReportMailingJobsResponseChanges changes; } - @ApiModel(value = "DeleteReportMailingJobsRequest ") + @Schema(description = "DeleteReportMailingJobsRequest ") public static final class DeleteReportMailingJobsRequest { private DeleteReportMailingJobsRequest() { @@ -176,14 +175,14 @@ final class ReportMailingJobApiResourceSwagger { } } - @ApiModel(value = "DeleteReportMailingJobsResponse") + @Schema(description = "DeleteReportMailingJobsResponse") public static final class DeleteReportMailingJobsResponse { private DeleteReportMailingJobsResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java index 7bd2e5a41..9d9cb5b37 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.infrastructure.reportmailingjob.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -47,8 +47,8 @@ import org.springframework.stereotype.Component; @Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RUN_HISTORY_RESOURCE_NAME) @Component -@Api(tags = { "List Report Mailing Job History" }) -@SwaggerDefinition(tags = { @Tag(name = "List Report Mailing Job History", description = "") }) + +@Tag(name = "List Report Mailing Job History", description = "") public class ReportMailingJobRunHistoryApiResource { private final PlatformSecurityContext platformSecurityContext; @@ -70,15 +70,16 @@ public class ReportMailingJobRunHistoryApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Report Mailing Job History", notes = "The list capability of report mailing job history can support pagination and sorting.\n" + @Operation(summary = "List Report Mailing Job History", description = "The list capability of report mailing job history can support pagination and sorting.\n" + "\n" + "Example Requests:\n" + "\n" + "reportmailingjobrunhistory/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = ReportMailingJobRunHistoryData.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ReportMailingJobRunHistoryData.class))) }) public String retrieveAllByReportMailingJobId(@Context final UriInfo uriInfo, - @QueryParam("reportMailingJobId") @ApiParam(value = "reportMailingJobId") final Long reportMailingJobId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @QueryParam("reportMailingJobId") @Parameter(description = "reportMailingJobId") final Long reportMailingJobId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.platformSecurityContext.authenticatedUser() .validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME); final SearchParameters searchParameters = SearchParameters.fromReportMailingJobRunHistory(offset, limit, orderBy, sortOrder); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResourceSwagger.java index 3e0ce9845..c864787de 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.reportmailingjob.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.joda.time.DateTime; /** @@ -31,26 +30,26 @@ final class ReportMailingJobRunHistoryApiResourceSwagger { } - @ApiModel(value = "GetReportMailingJobRunHistoryResponse") + @Schema(description = "GetReportMailingJobRunHistoryResponse") public static final class GetReportMailingJobRunHistoryResponse { private GetReportMailingJobRunHistoryResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long reportMailingJobId; - @ApiModelProperty(example = "1469627093050") + @Schema(example = "1469627093050") public DateTime startDateTime; - @ApiModelProperty(example = "1469627093050") + @Schema(example = "1469627093050") public DateTime endDateTime; - @ApiModelProperty(example = "success") + @Schema(example = "success") public String status; - @ApiModelProperty(example = "") + @Schema(example = "") public String errorMessage; - @ApiModelProperty(example = "") + @Schema(example = "") public String errorLog; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java index d3ed86423..977f44206 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java @@ -20,12 +20,12 @@ package org.apache.fineract.infrastructure.security.api; import com.google.gson.Gson; import com.sun.jersey.core.util.Base64; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +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 java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; @@ -58,9 +58,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") @Profile("basicauth") @Path("/authentication") -@Api(tags = { "Authentication HTTP Basic" }) -@SwaggerDefinition(tags = { - @Tag(name = "Authentication HTTP Basic", description = "An API capability that allows client applications to verify authentication details using HTTP Basic Authentication.") }) +@Tag(name = "Authentication HTTP Basic", description = "An API capability that allows client applications to verify authentication details using HTTP Basic Authentication.") public class AuthenticationApiResource { public static class AuthenticateRequest { @@ -88,9 +86,10 @@ public class AuthenticationApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Verify authentication", notes = "Authenticates the credentials provided and returns the set roles and permissions allowed.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = AuthenticationApiResourceSwagger.PostAuthenticationResponse.class), - @ApiResponse(code = 400, message = "Unauthenticated. Please login") }) + @Operation(summary = "Verify authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = AuthenticationApiResourceSwagger.PostAuthenticationResponse.class))), + @ApiResponse(responseCode = "400", description = "Unauthenticated. Please login") }) public String authenticate(final String apiRequestBodyAsJson) { // TODO FINERACT-819: sort out Jersey so JSON conversion does not have // to be done explicitly via GSON here, but implicit by arg diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java index 7b511fef1..efc555985 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.security.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.useradministration.data.RoleData; @@ -33,32 +32,32 @@ final class AuthenticationApiResourceSwagger { } - @ApiModel(value = "PostAuthenticationResponse") + @Schema(description = "PostAuthenticationResponse") public static final class PostAuthenticationResponse { private PostAuthenticationResponse() { } - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String username; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long userId; - @ApiModelProperty(example = "bWlmb3M6cGFzc3dvcmQ=") + @Schema(example = "bWlmb3M6cGFzc3dvcmQ=") public String base64EncodedAuthenticationKey; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean authenticated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long staffId; - @ApiModelProperty(example = "Director, Program") + @Schema(example = "Director, Program") public String staffDisplayName; public EnumOptionData organisationalRole; public Collection roles; - @ApiModelProperty(example = "ALL_FUNCTIONS") + @Schema(example = "ALL_FUNCTIONS") public Collection permissions; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java index 3dd768b00..d6b7c97c6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.infrastructure.security.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 java.util.ArrayList; import java.util.Collection; import java.util.Set; @@ -58,8 +58,8 @@ import org.springframework.stereotype.Component; @Component @Profile("oauth") @Scope("singleton") -@Api(tags = { "Fetch authenticated user details" }) -@SwaggerDefinition(tags = { @Tag(name = "Fetch authenticated user details", description = "") }) + +@Tag(name = "Fetch authenticated user details", description = "") @SuppressWarnings("deprecation") // TODO FINERACT-1012 public class UserDetailsApiResource { @@ -80,9 +80,11 @@ public class UserDetailsApiResource { @GET @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Fetch authenticated user details\n", notes = "checks the Authentication and returns the set roles and permissions allowed.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = UserDetailsApiResourceSwagger.GetUserDetailsResponse.class) }) - public String fetchAuthenticatedUserData(@QueryParam("access_token") @ApiParam(value = "access_token") final String accessToken) { + @Operation(summary = "Fetch authenticated user details\n", description = "checks the Authentication and returns the set roles and permissions allowed.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = UserDetailsApiResourceSwagger.GetUserDetailsResponse.class))) }) + public String fetchAuthenticatedUserData( + @QueryParam("access_token") @Parameter(description = "access_token") final String accessToken) { final Authentication authentication = this.tokenServices.loadAuthentication(accessToken); if (authentication.isAuthenticated()) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResourceSwagger.java index 72cd2729f..5b6fabb54 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.security.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.useradministration.data.RoleData; @@ -33,32 +32,32 @@ final class UserDetailsApiResourceSwagger { } - @ApiModel(value = "GetUserDetailsResponse") + @Schema(description = "GetUserDetailsResponse") public static final class GetUserDetailsResponse { private GetUserDetailsResponse() { } - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String username; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long userId; - @ApiModelProperty(example = "bWlmb3M6cGFzc3dvcmQ=") + @Schema(example = "bWlmb3M6cGFzc3dvcmQ=") public String accessToken; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean authenticated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long staffId; - @ApiModelProperty(example = "mifosStaffDisplayName") + @Schema(example = "mifosStaffDisplayName") public String staffDisplayName; public EnumOptionData organisationalRole; public Collection roles; - @ApiModelProperty(example = "ALL_FUNCTIONS") + @Schema(example = "ALL_FUNCTIONS") public Collection permissions; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java index 3d0025f5f..c07134555 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java @@ -18,7 +18,6 @@ */ package org.apache.fineract.infrastructure.sms.api; -import io.swagger.annotations.Api; import java.util.Collection; import java.util.Date; import javax.ws.rs.Consumes; @@ -55,7 +54,7 @@ import org.springframework.stereotype.Component; @Produces({ MediaType.APPLICATION_JSON }) @Component @Scope("singleton") -@Api(value = "SMS", description = "") + public class SmsApiResource { private final String resourceNameForPermissions = "SMS"; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java index a5aa6a717..9f6dc577c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java @@ -18,7 +18,6 @@ */ package org.apache.fineract.infrastructure.survey.api; -import io.swagger.annotations.Api; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -45,7 +44,7 @@ import org.springframework.stereotype.Component; @Path("/likelihood") @Component @Scope("singleton") -@Api(value = "Likelihood") + public class LikelihoodApiResource { private final DefaultToApiJsonSerializer toApiJsonSerializer; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java index 3aaca6970..ee098b27a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java @@ -18,7 +18,6 @@ */ package org.apache.fineract.infrastructure.survey.api; -import io.swagger.annotations.Api; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -37,7 +36,7 @@ import org.springframework.stereotype.Component; @Path("/povertyLine") @Component @Scope("singleton") -@Api(value = "Poverty Line") + public class PovertyLineApiResource { private final DefaultToApiJsonSerializer toApiJsonSerializer; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java index 9d8b46354..573352705 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.infrastructure.survey.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -57,7 +58,7 @@ import org.springframework.stereotype.Component; @Path("/survey") @Component @Scope("singleton") -@Api(value = "Survey", description = "") + public class SurveyApiResource { private final DefaultToApiJsonSerializer toApiJsonSerializer; @@ -84,9 +85,9 @@ public class SurveyApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve surveys", notes = "Retrieve surveys. This allows to retrieve the list of survey tables registered .") + @Operation(summary = "Retrieve surveys", description = "Retrieve surveys. This allows to retrieve the list of survey tables registered .") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = SurveyApiResourceSwagger.GetSurveyResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SurveyApiResourceSwagger.GetSurveyResponse.class)))) }) public String retrieveSurveys() { this.context.authenticatedUser().validateHasReadPermission(SurveyApiConstants.SURVEY_RESOURCE_NAME); @@ -99,9 +100,10 @@ public class SurveyApiResource { @Path("{surveyName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve survey", notes = "Lists a registered survey table details and the Apache Fineract Core application table they are registered to.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SurveyApiResourceSwagger.GetSurveyResponse.class) }) - public String retrieveSurvey(@PathParam("surveyName") @ApiParam(value = "surveyName") final String surveyName) { + @Operation(summary = "Retrieve survey", description = "Lists a registered survey table details and the Apache Fineract Core application table they are registered to.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SurveyApiResourceSwagger.GetSurveyResponse.class))) }) + public String retrieveSurvey(@PathParam("surveyName") @Parameter(description = "surveyName") final String surveyName) { this.context.authenticatedUser().validateHasReadPermission(SurveyApiConstants.SURVEY_RESOURCE_NAME); @@ -115,14 +117,14 @@ public class SurveyApiResource { @Path("{surveyName}/{apptableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create an entry in the survey table", notes = "Insert and entry in a survey table (full fill the survey)." + "\n" - + "\n" + "Refer Link for sample Body: [ https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm#survey_create ] ") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdRequest.class) }) + @Operation(summary = "Create an entry in the survey table", description = "Insert and entry in a survey table (full fill the survey)." + + "\n" + "\n" + + "Refer Link for sample Body: [ https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm#survey_create ] ") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdResponse.class) }) - public String createDatatableEntry(@PathParam("surveyName") @ApiParam(value = "surveyName") final String datatable, - @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdResponse.class))) }) + public String createDatatableEntry(@PathParam("surveyName") @Parameter(description = "surveyName") final String datatable, + @PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId, final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .fullFilSurvey(datatable, apptableId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResourceSwagger.java index 34709a8fc..1f34c05a1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.infrastructure.survey.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData; import org.joda.time.DateTime; @@ -33,7 +32,7 @@ final class SurveyApiResourceSwagger { } - @ApiModel(value = "GetSurveyResponse") + @Schema(description = "GetSurveyResponse") public static final class GetSurveyResponse { private GetSurveyResponse() { @@ -46,65 +45,65 @@ final class SurveyApiResourceSwagger { } - @ApiModelProperty(example = "m_client") + @Schema(example = "m_client") public String applicationTableName; - @ApiModelProperty(example = "ppi_kenya_2005") + @Schema(example = "ppi_kenya_2005") public String registeredTableName; public List columnHeaderData; } public GetSurveyResponseDatatableData datatableData; - @ApiModelProperty(example = "false") + @Schema(example = "false") public boolean enabled; } - @ApiModel(value = "PostSurveySurveyNameApptableIdRequest") + @Schema(description = "PostSurveySurveyNameApptableIdRequest") public static final class PostSurveySurveyNameApptableIdRequest { private PostSurveySurveyNameApptableIdRequest() { } - @ApiModelProperty(example = "167") + @Schema(example = "167") public Long ppi_household_members_cd_q1_householdmembers; - @ApiModelProperty(example = "174") + @Schema(example = "174") public Long ppi_highestschool_cd_q2_highestschool; - @ApiModelProperty(example = "180") + @Schema(example = "180") public Long ppi_businessoccupation_cd_q3_businessoccupation; - @ApiModelProperty(example = "184") + @Schema(example = "184") public Long ppi_habitablerooms_cd_q4_habitablerooms; - @ApiModelProperty(example = "188") + @Schema(example = "188") public Long ppi_floortype_cd_q5_floortype; - @ApiModelProperty(example = "190") + @Schema(example = "190") public Long ppi_lightingsource_cd_q6_lightingsource; - @ApiModelProperty(example = "193") + @Schema(example = "193") public Long ppi_irons_cd_q7_irons; - @ApiModelProperty(example = "195") + @Schema(example = "195") public Long ppi_mosquitonets_cd_q8_mosquitonets; - @ApiModelProperty(example = "198") + @Schema(example = "198") public Long ppi_towels_cd_q9_towels; - @ApiModelProperty(example = "201") + @Schema(example = "201") public Long ppi_fryingpans_cd_q10_fryingpans; - @ApiModelProperty(example = "2014-12-02 20:30:00") + @Schema(example = "2014-12-02 20:30:00") public DateTime Date; - @ApiModelProperty(example = "Y-m-d H:i:s") + @Schema(example = "Y-m-d H:i:s") public DateTime dateFormat; - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; } - @ApiModel(value = "PostSurveySurveyNameApptableIdResponse") + @Schema(description = "PostSurveySurveyNameApptableIdResponse") public static final class PostSurveySurveyNameApptableIdResponse { private PostSurveySurveyNameApptableIdResponse() { } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long officeId; - @ApiModelProperty(example = "87") + @Schema(example = "87") public Long clientId; - @ApiModelProperty(example = "87") + @Schema(example = "87") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java index 2e0abe071..10684bdcf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java @@ -20,15 +20,14 @@ package org.apache.fineract.interoperation.api; import static org.apache.fineract.interoperation.util.InteropUtil.ENTITY_NAME_QUOTE; import static org.apache.fineract.interoperation.util.InteropUtil.ENTITY_NAME_REQUEST; -import static org.apache.fineract.interoperation.util.InteropUtil.ROOT_PATH; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import javax.ws.rs.Consumes; @@ -71,7 +70,7 @@ import org.springframework.stereotype.Component; @Path("/interoperation") // api/v1/ @Component @Scope -@Api(value = ROOT_PATH, description = "") + public class InteropApiResource { private PlatformSecurityContext context; @@ -97,8 +96,8 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("health") - @ApiOperation(value = "Query Interoperation Health Request", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) + @Operation(summary = "Query Interoperation Health Request", description = "") + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) public String health(@Context UriInfo uriInfo) { return "OK"; } @@ -107,9 +106,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("accounts/{accountId}") - @ApiOperation(value = "Query Interoperation Account details", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropAccountData.class) }) - public String getAccountDetails(@PathParam("accountId") @ApiParam(value = "accountId") String accountId, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation Account details", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropAccountData.class))) }) + public String getAccountDetails(@PathParam("accountId") @Parameter(description = "accountId") String accountId, + @Context UriInfo uriInfo) { InteropAccountData result = interopService.getAccountDetails(accountId); ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -120,13 +121,15 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("accounts/{accountId}/transactions") - @ApiOperation(value = "Query transactions by Account Id", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropTransactionsData.class) }) - public String getAccountTransactions(@PathParam("accountId") @ApiParam(value = "accountId") String accountId, - @DefaultValue("true") @QueryParam("debit") @ApiParam(value = "debit") boolean debit, - @DefaultValue("false") @QueryParam("credit") @ApiParam(value = "credit") boolean credit, - @QueryParam("fromBookingDateTime") @ApiParam(value = "fromBookingDateTime") String fromBookingDateTime, - @QueryParam("toBookingDateTime") @ApiParam(value = "toBookingDateTime") String toBookingDateTime, @Context UriInfo uriInfo) { + @Operation(summary = "Query transactions by Account Id", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionsData.class))) }) + public String getAccountTransactions(@PathParam("accountId") @Parameter(description = "accountId") String accountId, + @DefaultValue("true") @QueryParam("debit") @Parameter(description = "debit") boolean debit, + @DefaultValue("false") @QueryParam("credit") @Parameter(description = "credit") boolean credit, + @QueryParam("fromBookingDateTime") @Parameter(description = "fromBookingDateTime") String fromBookingDateTime, + @QueryParam("toBookingDateTime") @Parameter(description = "toBookingDateTime") String toBookingDateTime, + @Context UriInfo uriInfo) { LocalDateTime transactionsFrom = fromBookingDateTime == null ? null : LocalDateTime.parse(fromBookingDateTime, DateTimeFormatter.ISO_LOCAL_DATE_TIME); LocalDateTime transactionsTo = toBookingDateTime == null ? null @@ -142,9 +145,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("accounts/{accountId}/identifiers") - @ApiOperation(value = "Query Interoperation secondary identifiers by Account Id", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifiersResponseData.class) }) - public String getAccountIdentifiers(@PathParam("accountId") @ApiParam(value = "accountId") String accountId, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation secondary identifiers by Account Id", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifiersResponseData.class))) }) + public String getAccountIdentifiers(@PathParam("accountId") @Parameter(description = "accountId") String accountId, + @Context UriInfo uriInfo) { InteropIdentifiersResponseData result = interopService.getAccountIdentifiers(accountId); ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -155,10 +160,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("parties/{idType}/{idValue}") - @ApiOperation(value = "Query Interoperation Account by secondary identifier", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifierAccountResponseData.class) }) - public String getAccountByIdentifier(@PathParam("idType") @ApiParam(value = "idType") InteropIdentifierType idType, - @PathParam("idValue") @ApiParam(value = "idValue") String idValue, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation Account by secondary identifier", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) }) + public String getAccountByIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType, + @PathParam("idValue") @Parameter(description = "idValue") String idValue, @Context UriInfo uriInfo) { InteropIdentifierAccountResponseData result = interopService.getAccountByIdentifier(idType, idValue, null); ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -169,11 +175,12 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("parties/{idType}/{idValue}/{subIdOrType}") - @ApiOperation(value = "Query Interoperation Account by secondary identifier", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifierAccountResponseData.class) }) - public String getAccountByIdentifier(@PathParam("idType") @ApiParam(value = "idType") InteropIdentifierType idType, - @PathParam("idValue") @ApiParam(value = "idValue") String idValue, - @PathParam("subIdOrType") @ApiParam(value = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation Account by secondary identifier", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) }) + public String getAccountByIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType, + @PathParam("idValue") @Parameter(description = "idValue") String idValue, + @PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) { InteropIdentifierAccountResponseData result = interopService.getAccountByIdentifier(idType, idValue, subIdOrType); ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -184,12 +191,12 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("parties/{idType}/{idValue}") - @ApiOperation(value = "Interoperation Identifier registration", httpMethod = "POST", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropIdentifierRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifierAccountResponseData.class) }) - public String registerAccountIdentifier(@PathParam("idType") @ApiParam(value = "idType") InteropIdentifierType idType, - @PathParam("idValue") @ApiParam(value = "idValue") String idValue, @ApiParam(hidden = true) String identifierJson, + @Operation(summary = "Interoperation Identifier registration", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) }) + public String registerAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType, + @PathParam("idValue") @Parameter(description = "idValue") String idValue, @Parameter(hidden = true) String identifierJson, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().registerAccountIdentifier(idType, idValue, null) .withJson(identifierJson).build(); @@ -205,14 +212,14 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("parties/{idType}/{idValue}/{subIdOrType}") - @ApiOperation(value = "Interoperation Identifier registration", httpMethod = "POST", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropIdentifierRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifierAccountResponseData.class) }) - public String registerAccountIdentifier(@PathParam("idType") @ApiParam(value = "idType") InteropIdentifierType idType, - @PathParam("idValue") @ApiParam(value = "idValue") String idValue, - @PathParam("subIdOrType") @ApiParam(value = "subIdOrType") String subIdOrType, @ApiParam(hidden = true) String identifierJson, - @Context UriInfo uriInfo) { + @Operation(summary = "Interoperation Identifier registration", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) }) + public String registerAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType, + @PathParam("idValue") @Parameter(description = "idValue") String idValue, + @PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, + @Parameter(hidden = true) String identifierJson, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().registerAccountIdentifier(idType, idValue, subIdOrType) .withJson(identifierJson).build(); @@ -227,12 +234,12 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("parties/{idType}/{idValue}") - @ApiOperation(value = "Allow Interoperation Identifier registration", httpMethod = "DELETE", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropIdentifierRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifierAccountResponseData.class) }) - public String deleteAccountIdentifier(@PathParam("idType") @ApiParam(value = "idType") InteropIdentifierType idType, - @PathParam("idValue") @ApiParam(value = "idValue") String idValue, @Context UriInfo uriInfo) { + @Operation(summary = "Allow Interoperation Identifier registration", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) }) + public String deleteAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType, + @PathParam("idValue") @Parameter(description = "idValue") String idValue, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().deleteAccountIdentifier(idType, idValue, null).build(); InteropIdentifierAccountResponseData result = (InteropIdentifierAccountResponseData) commandsSourceService @@ -246,13 +253,13 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("parties/{idType}/{idValue}/{subIdOrType}") - @ApiOperation(value = "Allow Interoperation Identifier registration", httpMethod = "DELETE", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropIdentifierRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropIdentifierAccountResponseData.class) }) - public String deleteAccountIdentifier(@PathParam("idType") @ApiParam(value = "idType") InteropIdentifierType idType, - @PathParam("idValue") @ApiParam(value = "idValue") String idValue, - @PathParam("subIdOrType") @ApiParam(value = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) { + @Operation(summary = "Allow Interoperation Identifier registration", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) }) + public String deleteAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType, + @PathParam("idValue") @Parameter(description = "idValue") String idValue, + @PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().deleteAccountIdentifier(idType, idValue, subIdOrType).build(); InteropIdentifierAccountResponseData result = (InteropIdentifierAccountResponseData) commandsSourceService @@ -266,10 +273,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("transactions/{transactionCode}/requests/{requestCode}") - @ApiOperation(value = "Query Interoperation Transaction Request", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropTransactionRequestResponseData.class) }) - public String getTransactionRequest(@PathParam("transactionCode") @ApiParam(value = "transactionCode") String transactionCode, - @PathParam("requestCode") @ApiParam(value = "requestCode") String requestCode, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation Transaction Request", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionRequestResponseData.class))) }) + public String getTransactionRequest(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode, + @PathParam("requestCode") @Parameter(description = "requestCode") String requestCode, @Context UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_REQUEST); InteropTransactionRequestResponseData result = interopService.getTransactionRequest(transactionCode, requestCode); @@ -282,11 +290,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("requests") - @ApiOperation(value = "Allow Interoperation Transaction Request", httpMethod = "POST", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropTransactionRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropTransactionRequestResponseData.class) }) - public String createTransactionRequest(@ApiParam(hidden = true) String quotesJson, @Context UriInfo uriInfo) { + @Operation(summary = "Allow Interoperation Transaction Request", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropTransactionRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionRequestResponseData.class))) }) + public String createTransactionRequest(@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().createTransactionRequest().withJson(quotesJson).build(); InteropTransactionRequestResponseData result = (InteropTransactionRequestResponseData) commandsSourceService @@ -300,10 +308,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("transactions/{transactionCode}/quotes/{quoteCode}") - @ApiOperation(value = "Query Interoperation Quote", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropQuoteResponseData.class) }) - public String getQuote(@PathParam("transactionCode") @ApiParam(value = "transactionCode") String transactionCode, - @PathParam("quoteCode") @ApiParam(value = "quoteCode") String quoteCode, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation Quote", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropQuoteResponseData.class))) }) + public String getQuote(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode, + @PathParam("quoteCode") @Parameter(description = "quoteCode") String quoteCode, @Context UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_QUOTE); InteropQuoteResponseData result = interopService.getQuote(transactionCode, quoteCode); @@ -316,11 +325,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("quotes") - @ApiOperation(value = "Calculate Interoperation Quote", httpMethod = "POST", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropQuoteRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropQuoteResponseData.class) }) - public String createQuote(@ApiParam(hidden = true) String quotesJson, @Context UriInfo uriInfo) { + @Operation(summary = "Calculate Interoperation Quote", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropQuoteRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropQuoteResponseData.class))) }) + public String createQuote(@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().createQuotes().withJson(quotesJson).build(); InteropQuoteResponseData result = (InteropQuoteResponseData) commandsSourceService.logCommandSource(commandRequest); @@ -333,10 +342,11 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("transactions/{transactionCode}/transfers/{transferCode}") - @ApiOperation(value = "Query Interoperation Transfer", httpMethod = "GET", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropTransferResponseData.class) }) - public String getTransfer(@PathParam("transactionCode") @ApiParam(value = "transactionCode") String transactionCode, - @PathParam("transferCode") @ApiParam(value = "transferCode") String transferCode, @Context UriInfo uriInfo) { + @Operation(summary = "Query Interoperation Transfer", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransferResponseData.class))) }) + public String getTransfer(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode, + @PathParam("transferCode") @Parameter(description = "transferCode") String transferCode, @Context UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_QUOTE); InteropTransferResponseData result = interopService.getTransfer(transactionCode, transferCode); @@ -349,12 +359,12 @@ public class InteropApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("transfers") - @ApiOperation(value = "Prepare Interoperation Transfer", httpMethod = "POST", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InteropTransferRequestData.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = InteropTransferResponseData.class) }) - public String performTransfer(@QueryParam("action") @ApiParam(value = "action") String action, - @ApiParam(hidden = true) String quotesJson, @Context UriInfo uriInfo) { + @Operation(summary = "Prepare Interoperation Transfer", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropTransferRequestData.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransferResponseData.class))) }) + public String performTransfer(@QueryParam("action") @Parameter(description = "action") String action, + @Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) { CommandWrapper commandRequest = new InteropWrapperBuilder().performTransfer(InteropTransferActionType.valueOf(action)) .withJson(quotesJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java index 8c7bdfef2..5e0477846 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.mix.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.sql.Date; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -37,8 +35,8 @@ import org.springframework.stereotype.Component; @Path("/mixreport") @Component @Scope("singleton") -@Api(tags = { "Mix Report" }) -@SwaggerDefinition(tags = { @Tag(name = "Mix Report", description = "") }) + +@Tag(name = "Mix Report", description = "") public class MixReportApiResource { private final XBRLResultService xbrlResultService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java index 66cf6a75c..f35b91e8d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.mix.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -45,8 +43,8 @@ import org.springframework.stereotype.Component; @Path("/mixtaxonomy") @Component @Scope("singleton") -@Api(tags = { "Mix Taxonomy" }) -@SwaggerDefinition(tags = { @Tag(name = "Mix Taxonomy", description = "") }) + +@Tag(name = "Mix Taxonomy", description = "") public class MixTaxonomyApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java index 096a7b406..0e202ca50 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.mix.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -49,8 +47,8 @@ import org.springframework.stereotype.Component; @Path("/mixmapping") @Component @Scope("singleton") -@Api(tags = { "Mix Mapping " }) -@SwaggerDefinition(tags = { @Tag(name = "Mix Mapping", description = "") }) + +@Tag(name = "Mix Mapping", description = "") public class MixTaxonomyMappingApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("identifier", "config")); diff --git a/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java index 524bc1b36..5ae26807c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.notification.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; @@ -45,8 +43,8 @@ import org.springframework.stereotype.Component; @Path("/notifications") @Component @Scope("singleton") -@Api(tags = { "Notification" }) -@SwaggerDefinition(tags = { @Tag(name = "Notification", description = "") }) + +@Tag(name = "Notification", description = "") public class NotificationApiResource { private final PlatformSecurityContext context; diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java index 24165a277..8bf6cd67c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java @@ -21,15 +21,15 @@ package org.apache.fineract.organisation.holiday.api; import static org.apache.fineract.organisation.holiday.api.HolidayApiConstants.HOLIDAY_RESOURCE_NAME; import static org.apache.fineract.organisation.holiday.api.HolidayApiConstants.HOLIDAY_RESPONSE_DATA_PARAMETERS; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import java.util.Date; import javax.ws.rs.Consumes; @@ -64,13 +64,11 @@ import org.springframework.stereotype.Component; @Path("/holidays") @Component @Scope("singleton") -@Api(tags = { "Holidays" }) -@SwaggerDefinition(tags = { - @Tag(name = "Holidays", description = "Some MFI's span large regions where different branch offices might observe different holidays. They need the ability to define holidays for specific branch offices and be able to set the repayment rule to follow during those holidays.\n" - + "\n" - + "The reschedule of repayments to repaymentsRescheduledTo date during defined holidays is turned on/off by enabling/disabling reschedule-repayments-on-holidays in Global configurations.\n" - + "\n" - + "Allow Repayment transactions on a defined holidays is turned on/off by enabling/disabling allow-transactions-on-holiday in Global configurations.") }) +@Tag(name = "Holidays", description = "Some MFI's span large regions where different branch offices might observe different holidays. They need the ability to define holidays for specific branch offices and be able to set the repayment rule to follow during those holidays.\n" + + "\n" + + "The reschedule of repayments to repaymentsRescheduledTo date during defined holidays is turned on/off by enabling/disabling reschedule-repayments-on-holidays in Global configurations.\n" + + "\n" + + "Allow Repayment transactions on a defined holidays is turned on/off by enabling/disabling allow-transactions-on-holiday in Global configurations.") public class HolidaysApiResource { private final DefaultToApiJsonSerializer toApiJsonSerializer; @@ -94,12 +92,12 @@ public class HolidaysApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Holiday", notes = "Mandatory Fields: " + @Operation(summary = "Create a Holiday", description = "Mandatory Fields: " + "name, description, fromDate, toDate, repaymentsRescheduledTo, offices") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = HolidaysApiResourceSwagger.PostHolidaysRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.PostHolidaysResponse.class) }) - public String createNewHoliday(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.PostHolidaysRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.PostHolidaysResponse.class))) }) + public String createNewHoliday(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createHoliday().withJson(apiRequestBodyAsJson).build(); @@ -112,14 +110,14 @@ public class HolidaysApiResource { @Path("{holidayId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Activate a Holiday", notes = "Always Holidays are created in pending state. This API allows to activate a holiday.\n" + @Operation(summary = "Activate a Holiday", description = "Always Holidays are created in pending state. This API allows to activate a holiday.\n" + "\n" + "Only the active holidays are considered for rescheduling the loan repayment.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = HolidaysApiResourceSwagger.PostHolidaysHolidayIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.PostHolidaysHolidayIdResponse.class) }) - public String handleCommands(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.PostHolidaysHolidayIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.PostHolidaysHolidayIdResponse.class))) }) + public String handleCommands(@PathParam("holidayId") @Parameter(description = "holidayId") final Long holidayId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String jsonApiRequest = apiRequestBodyAsJson; if (StringUtils.isBlank(jsonApiRequest)) { @@ -145,9 +143,11 @@ public class HolidaysApiResource { @Path("{holidayId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Holiday", notes = "Example Requests:\n" + "\n" + "holidays/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.GetHolidaysResponse.class) }) - public String retrieveOne(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId, @Context final UriInfo uriInfo) { + @Operation(summary = "Retrieve a Holiday", description = "Example Requests:\n" + "\n" + "holidays/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.GetHolidaysResponse.class))) }) + public String retrieveOne(@PathParam("holidayId") @Parameter(description = "holidayId") final Long holidayId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(HOLIDAY_RESOURCE_NAME); @@ -162,12 +162,12 @@ public class HolidaysApiResource { @Path("{holidayId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Holiday", notes = "If a holiday is in pending state (created and not activated) then all fields are allowed to modify. Once holidays become active only name and descriptions are allowed to modify.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = HolidaysApiResourceSwagger.PutHolidaysHolidayIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.PutHolidaysHolidayIdResponse.class) }) - public String update(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @Operation(summary = "Update a Holiday", description = "If a holiday is in pending state (created and not activated) then all fields are allowed to modify. Once holidays become active only name and descriptions are allowed to modify.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.PutHolidaysHolidayIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.PutHolidaysHolidayIdResponse.class))) }) + public String update(@PathParam("holidayId") @Parameter(description = "holidayId") final Long holidayId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateHoliday(holidayId).withJson(jsonRequestBody).build(); @@ -180,9 +180,10 @@ public class HolidaysApiResource { @Path("{holidayId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Holiday", notes = "This API allows to delete a holiday. This is a soft delete the deleted holiday status is marked as deleted.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.DeleteHolidaysHolidayIdResponse.class) }) - public String delete(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId) { + @Operation(summary = "Delete a Holiday", description = "This API allows to delete a holiday. This is a soft delete the deleted holiday status is marked as deleted.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = HolidaysApiResourceSwagger.DeleteHolidaysHolidayIdResponse.class))) }) + public String delete(@PathParam("holidayId") @Parameter(description = "holidayId") final Long holidayId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteHoliday(holidayId).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.toApiJsonSerializer.serialize(result); @@ -195,15 +196,15 @@ public class HolidaysApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Holidays", notes = "Example Requests:\n" + "\n" + "holidays?officeId=1") + @Operation(summary = "List Holidays", description = "Example Requests:\n" + "\n" + "holidays?officeId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.GetHolidaysResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = HolidaysApiResourceSwagger.GetHolidaysResponse.class)))) }) public String retrieveAllHolidays(@Context final UriInfo uriInfo, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @QueryParam("fromDate") @ApiParam(value = "fromDate") final DateParam fromDateParam, - @QueryParam("toDate") @ApiParam(value = "toDate") final DateParam toDateParam, - @QueryParam("locale") @ApiParam(value = "locale") final String locale, - @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat) { + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @QueryParam("fromDate") @Parameter(description = "fromDate") final DateParam fromDateParam, + @QueryParam("toDate") @Parameter(description = "toDate") final DateParam toDateParam, + @QueryParam("locale") @Parameter(description = "locale") final String locale, + @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat) { this.context.authenticatedUser().validateHasReadPermission(HOLIDAY_RESOURCE_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResourceSwagger.java index 5a7b6730b..b690cb439 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.holiday.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.joda.time.LocalDate; @@ -33,29 +32,29 @@ final class HolidaysApiResourceSwagger { } - @ApiModel(value = "GetHolidaysResponse") + @Schema(description = "GetHolidaysResponse") public static final class GetHolidaysResponse { private GetHolidaysResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Good Friday") + @Schema(example = "Good Friday") public String name; - @ApiModelProperty(example = "[2013, 10, 26]") + @Schema(example = "[2013, 10, 26]") public LocalDate fromDate; - @ApiModelProperty(example = "[2013, 10, 26]") + @Schema(example = "[2013, 10, 26]") public LocalDate toDate; - @ApiModelProperty(example = "[2013, 10, 27]") + @Schema(example = "[2013, 10, 27]") public LocalDate repaymentsRescheduledTo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; public EnumOptionData status; } - @ApiModel(value = "PostHolidaysRequest") + @Schema(description = "PostHolidaysRequest") public static final class PostHolidaysRequest { private PostHolidaysRequest() { @@ -68,39 +67,39 @@ final class HolidaysApiResourceSwagger { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; } - @ApiModelProperty(example = "Good Friday") + @Schema(example = "Good Friday") public String name; - @ApiModelProperty(example = "Good Friday") + @Schema(example = "Good Friday") public String description; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "25 October 2013") + @Schema(example = "25 October 2013") public LocalDate fromDate; - @ApiModelProperty(example = "25 October 2013") + @Schema(example = "25 October 2013") public LocalDate toDate; - @ApiModelProperty(example = "26 October 2013") + @Schema(example = "26 October 2013") public LocalDate repaymentsRescheduledTo; public List offices; } - @ApiModel(value = "PostHolidaysResponse") + @Schema(description = "PostHolidaysResponse") public static final class PostHolidaysResponse { private PostHolidaysResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PostHolidaysHolidayIdRequest") + @Schema(description = "PostHolidaysHolidayIdRequest") public static final class PostHolidaysHolidayIdRequest { private PostHolidaysHolidayIdRequest() { @@ -108,31 +107,31 @@ final class HolidaysApiResourceSwagger { } } - @ApiModel(value = "PostHolidaysHolidayIdResponse") + @Schema(description = "PostHolidaysHolidayIdResponse") public static final class PostHolidaysHolidayIdResponse { private PostHolidaysHolidayIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PutHolidaysHolidayIdRequest") + @Schema(description = "PutHolidaysHolidayIdRequest") public static final class PutHolidaysHolidayIdRequest { private PutHolidaysHolidayIdRequest() { } - @ApiModelProperty(example = "Independence day") + @Schema(example = "Independence day") public String name; - @ApiModelProperty(example = "Holiday for Independence day celebration") + @Schema(example = "Holiday for Independence day celebration") public String description; } - @ApiModel(value = "PutHolidaysHolidayIdResponse") + @Schema(description = "PutHolidaysHolidayIdResponse") public static final class PutHolidaysHolidayIdResponse { private PutHolidaysHolidayIdResponse() { @@ -143,25 +142,25 @@ final class HolidaysApiResourceSwagger { private PutHolidaysHolidayIdResponseChanges() {} - @ApiModelProperty(example = "Independence day") + @Schema(example = "Independence day") public String name; - @ApiModelProperty(example = "Holiday for Independence day celebration") + @Schema(example = "Holiday for Independence day celebration") public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutHolidaysHolidayIdResponseChanges changes; } - @ApiModel(value = "DeleteHolidaysHolidayIdResponse") + @Schema(description = "DeleteHolidaysHolidayIdResponse") public static final class DeleteHolidaysHolidayIdResponse { private DeleteHolidaysHolidayIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java index dd5797d8a..937e80de6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.organisation.monetary.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -55,9 +54,8 @@ import org.springframework.stereotype.Component; @Path("/currencies") @Component @Scope("singleton") -@Api(tags = { "Currency" }) -@SwaggerDefinition(tags = { - @Tag(name = "Currency", description = "Application related configuration around viewing/updating the currencies permitted for use within the MFI.") }) + +@Tag(name = "Currency", description = "Application related configuration around viewing/updating the currencies permitted for use within the MFI.") public class CurrenciesApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("selectedCurrencyOptions", "currencyOptions")); @@ -85,9 +83,10 @@ public class CurrenciesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Currency Configuration", notes = "Returns the list of currencies permitted for use AND the list of currencies not selected (but available for selection).\n" + @Operation(summary = "Retrieve Currency Configuration", description = "Returns the list of currencies permitted for use AND the list of currencies not selected (but available for selection).\n" + "\n" + "Example Requests:\n" + "\n" + "currencies\n" + "\n" + "\n" + "currencies?fields=selectedCurrencyOptions") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CurrenciesApiResourceSwagger.GetCurrenciesResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CurrenciesApiResourceSwagger.GetCurrenciesResponse.class))) }) public String retrieveCurrencies(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -101,11 +100,11 @@ public class CurrenciesApiResource { @PUT @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Currency Configuration", notes = "Updates the list of currencies permitted for use.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CurrenciesApiResourceSwagger.PutCurrenciesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CurrenciesApiResourceSwagger.PutCurrenciesResponse.class) }) - public String updateCurrencies(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update Currency Configuration", description = "Updates the list of currencies permitted for use.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CurrenciesApiResourceSwagger.PutCurrenciesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CurrenciesApiResourceSwagger.PutCurrenciesResponse.class))) }) + public String updateCurrencies(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateCurrencies() // diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResourceSwagger.java index 9335fd813..4b2ba30bc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.monetary.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.apache.fineract.organisation.monetary.data.CurrencyData; @@ -32,7 +31,7 @@ final class CurrenciesApiResourceSwagger { } - @ApiModel(value = "GetCurrenciesResponse") + @Schema(description = "GetCurrenciesResponse") public static final class GetCurrenciesResponse { private GetCurrenciesResponse() { @@ -43,28 +42,28 @@ final class CurrenciesApiResourceSwagger { public Collection currencyOptions; } - @ApiModel(value = "PutCurrenciesRequest") + @Schema(description = "PutCurrenciesRequest") public static final class PutCurrenciesRequest { private PutCurrenciesRequest() { } - @ApiModelProperty(example = "[\"KES\",\n" + " \"BND\",\n" + " \"LBP\",\n" + " \"GHC\",\n" - + " \"USD\",\n" + " \"XOF\",\n" + " \"AED\",\n" + " \"AMD\"]") + @Schema(example = "[\"KES\",\n" + " \"BND\",\n" + " \"LBP\",\n" + " \"GHC\",\n" + " \"USD\",\n" + + " \"XOF\",\n" + " \"AED\",\n" + " \"AMD\"]") public String currencies; } - @ApiModel(value = "PutCurrenciesResponse") + @Schema(description = "PutCurrenciesResponse") public static final class PutCurrenciesResponse { private PutCurrenciesResponse() { } - @ApiModelProperty(example = "[\"KES\",\n" + " \"BND\",\n" + " \"LBP\",\n" + " \"GHC\",\n" - + " \"USD\",\n" + " \"XOF\",\n" + " \"AED\",\n" + " \"AMD\"]") + @Schema(example = "[\"KES\",\n" + " \"BND\",\n" + " \"LBP\",\n" + " \"GHC\",\n" + " \"USD\",\n" + + " \"XOF\",\n" + " \"AED\",\n" + " \"AMD\"]") public String currencies; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java index 929fe9cd8..0cec6e75b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java @@ -18,7 +18,6 @@ */ package org.apache.fineract.organisation.office.api; -import io.swagger.annotations.Api; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -50,7 +49,7 @@ import org.springframework.stereotype.Component; @Path("/officetransactions") @Component @Scope("singleton") -@Api(value = "officetransactions", description = "") + public class OfficeTransactionsApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java index 12c412fc4..3158ee903 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java @@ -20,15 +20,15 @@ package org.apache.fineract.organisation.office.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -68,9 +68,7 @@ import org.springframework.stereotype.Component; @Path("/offices") @Component @Scope("singleton") -@Api(tags = { "Offices" }) -@SwaggerDefinition(tags = { - @Tag(name = "Offices", description = "Offices are used to model an MFIs structure. A hierarchical representation of offices is supported. There will always be at least one office (which represents the MFI or an MFIs head office). All subsequent offices added must have a parent office.") }) +@Tag(name = "Offices", description = "Offices are used to model an MFIs structure. A hierarchical representation of offices is supported. There will always be at least one office (which represents the MFI or an MFIs head office). All subsequent offices added must have a parent office.") public class OfficesApiResource { /** @@ -107,14 +105,14 @@ public class OfficesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Offices", notes = "Example Requests:\n" + "\n" + "offices\n" + "\n" + "\n" + @Operation(summary = "List Offices", description = "Example Requests:\n" + "\n" + "offices\n" + "\n" + "\n" + "offices?fields=id,name,openingDate") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.GetOfficesResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesResponse.class)))) }) public String retrieveOffices(@Context final UriInfo uriInfo, - @DefaultValue("false") @QueryParam("includeAllOffices") @ApiParam(value = "includeAllOffices") final boolean onlyManualEntries, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @DefaultValue("false") @QueryParam("includeAllOffices") @Parameter(description = "includeAllOffices") final boolean onlyManualEntries, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -130,9 +128,10 @@ public class OfficesApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Office Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "offices/template") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.GetOfficesTemplateResponse.class) }) + @Operation(summary = "Retrieve Office Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "offices/template") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesTemplateResponse.class))) }) public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -149,11 +148,11 @@ public class OfficesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create an Office", notes = "Mandatory Fields\n" + "name, openingDate, parentId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = OfficesApiResourceSwagger.PostOfficesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.PostOfficesResponse.class) }) - public String createOffice(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create an Office", description = "Mandatory Fields\n" + "name, openingDate, parentId") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PostOfficesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PostOfficesResponse.class))) }) + public String createOffice(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createOffice() // @@ -169,10 +168,12 @@ public class OfficesApiResource { @Path("{officeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve an Office", notes = "Example Requests:\n" + "\n" + "offices/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve an Office", description = "Example Requests:\n" + "\n" + "offices/1\n" + "\n" + "\n" + "offices/1?template=true\n" + "\n" + "\n" + "offices/1?fields=id,name,parentName") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.GetOfficesResponse.class) }) - public String retreiveOffice(@PathParam("officeId") @ApiParam(value = "officeId") final Long officeId, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesResponse.class))) }) + public String retreiveOffice(@PathParam("officeId") @Parameter(description = "officeId") final Long officeId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -191,12 +192,12 @@ public class OfficesApiResource { @Path("{officeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Office", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = OfficesApiResourceSwagger.PutOfficesOfficeIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.PutOfficesOfficeIdResponse.class) }) - public String updateOffice(@PathParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update Office", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PutOfficesOfficeIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PutOfficesOfficeIdResponse.class))) }) + public String updateOffice(@PathParam("officeId") @Parameter(description = "officeId") final Long officeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateOffice(officeId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResourceSwagger.java index 8a78eab18..05274d18f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.office.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.joda.time.LocalDate; @@ -32,90 +31,90 @@ final class OfficesApiResourceSwagger { } - @ApiModel(value = "GetOfficesResponse") + @Schema(description = "GetOfficesResponse") public static final class GetOfficesResponse { private GetOfficesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public String externalId; - @ApiModelProperty(example = "[2009, 1, 1]") + @Schema(example = "[2009, 1, 1]") public LocalDate openingDate; - @ApiModelProperty(example = ".") + @Schema(example = ".") public String hierarchy; - // @ApiModelProperty(example = "") + // @Schema(example = "") // public Long parentId; - // @ApiModelProperty(example = "") + // @Schema(example = "") // public String parentName; } - @ApiModel(value = "GetOfficesTemplateResponse") + @Schema(description = "GetOfficesTemplateResponse") public static final class GetOfficesTemplateResponse { private GetOfficesTemplateResponse() { } - @ApiModelProperty(example = "[2009, 1, 1]") + @Schema(example = "[2009, 1, 1]") public LocalDate openingDate; public Collection allowedParents; } - @ApiModel(value = "PostOfficesRequest") + @Schema(description = "PostOfficesRequest") public static final class PostOfficesRequest { private PostOfficesRequest() { } - @ApiModelProperty(example = "Good Friday") + @Schema(example = "Good Friday") public String name; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "01 July 2007") + @Schema(example = "01 July 2007") public LocalDate openingDate; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long parentId; - @ApiModelProperty(example = "SYS54-88") + @Schema(example = "SYS54-88") public String externalId; } - @ApiModel(value = "PostOfficesResponse") + @Schema(description = "PostOfficesResponse") public static final class PostOfficesResponse { private PostOfficesResponse() { } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long officeId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long resourceId; } - @ApiModel(value = "PutOfficesOfficeIdRequest") + @Schema(description = "PutOfficesOfficeIdRequest") public static final class PutOfficesOfficeIdRequest { private PutOfficesOfficeIdRequest() { } - @ApiModelProperty(example = "Name is updated") + @Schema(example = "Name is updated") public String name; } - @ApiModel(value = "PutOfficesOfficeIdResponse") + @Schema(description = "PutOfficesOfficeIdResponse") public static final class PutOfficesOfficeIdResponse { private PutOfficesOfficeIdResponse() { @@ -128,13 +127,13 @@ final class OfficesApiResourceSwagger { } - @ApiModelProperty(example = "Name is updated") + @Schema(example = "Name is updated") public String name; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long officeId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long resourceId; public PutOfficesOfficeIdResponseChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java index 9b7a86553..88b07ed1d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.organisation.provisioning.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -50,8 +48,8 @@ import org.springframework.stereotype.Component; @Path("/provisioningcategory") @Component @Scope("singleton") -@Api(tags = { "Provisioning Category" }) -@SwaggerDefinition(tags = { @Tag(name = "Provisioning Category", description = "") }) + +@Tag(name = "Provisioning Category", description = "") public class ProvisioningCategoryApiResource { private final PlatformSecurityContext platformSecurityContext; diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java index e3ad1d281..762831c25 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.organisation.provisioning.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -60,8 +60,8 @@ import org.springframework.stereotype.Component; @Path("/provisioningcriteria") @Component @Scope("singleton") -@Api(tags = { "Provisioning Criteria" }) -@SwaggerDefinition(tags = { @Tag(name = "Provisioning Criteria", description = "This defines the Provisioning Criteria") }) + +@Tag(name = "Provisioning Criteria", description = "This defines the Provisioning Criteria") public class ProvisioningCriteriaApiResource { private final PlatformSecurityContext platformSecurityContext; @@ -110,10 +110,10 @@ public class ProvisioningCriteriaApiResource { @Path("{criteriaId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieves a Provisioning Criteria", notes = "Retrieves a Provisioning Criteria") + @Operation(summary = "Retrieves a Provisioning Criteria", description = "Retrieves a Provisioning Criteria") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.GetProvisioningCriteriaCriteriaIdResponse.class) }) - public String retrieveProvisioningCriteria(@PathParam("criteriaId") @ApiParam(value = "criteriaId") final Long criteriaId, + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.GetProvisioningCriteriaCriteriaIdResponse.class))) }) + public String retrieveProvisioningCriteria(@PathParam("criteriaId") @Parameter(description = "criteriaId") final Long criteriaId, @Context final UriInfo uriInfo) { platformSecurityContext.authenticatedUser(); ProvisioningCriteriaData criteria = this.provisioningCriteriaReadPlatformService.retrieveProvisioningCriteria(criteriaId); @@ -127,9 +127,9 @@ public class ProvisioningCriteriaApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieves all created Provisioning Criterias", notes = "Retrieves all created Provisioning Criterias") + @Operation(summary = "Retrieves all created Provisioning Criterias", description = "Retrieves all created Provisioning Criterias") @ApiResponses({ - @ApiResponse(code = 200, message = "", responseContainer = "List", response = ProvisioningCriteriaApiResourceSwagger.GetProvisioningCriteriaResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.GetProvisioningCriteriaResponse.class)))) }) public String retrieveAllProvisioningCriterias(@Context final UriInfo uriInfo) { platformSecurityContext.authenticatedUser(); Collection data = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias(); @@ -140,13 +140,12 @@ public class ProvisioningCriteriaApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a new Provisioning Criteria", notes = "Creates a new Provisioning Criteria\n" + "\n" + @Operation(summary = "Create a new Provisioning Criteria", description = "Creates a new Provisioning Criteria\n" + "\n" + "Mandatory Fields: \n" + "criteriaName\n" + "provisioningcriteria\n" + "\n" + "Optional Fields: \n" + "loanProducts") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ProvisioningCriteriaApiResourceSwagger.PostProvisioningCriteriaRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.PostProvisioningCriteriaRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.PostProvisioningCriteriaResponse.class) }) - public String createProvisioningCriteria(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.PostProvisioningCriteriaResponse.class))) }) + public String createProvisioningCriteria(@Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = null; this.platformSecurityContext.authenticatedUser(); commandWrapper = new CommandWrapperBuilder().createProvisioningCriteria().withJson(apiRequestBodyAsJson).build(); @@ -158,14 +157,13 @@ public class ProvisioningCriteriaApiResource { @Path("{criteriaId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Updates a new Provisioning Criteria", notes = "Updates a new Provisioning Criteria\n" + "\n" + @Operation(summary = "Updates a new Provisioning Criteria", description = "Updates a new Provisioning Criteria\n" + "\n" + "Optional Fields\n" + "criteriaName, loanProducts, provisioningcriteria") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ProvisioningCriteriaApiResourceSwagger.PutProvisioningCriteriaRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.PutProvisioningCriteriaRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.PutProvisioningCriteriaResponse.class) }) - public String updateProvisioningCriteria(@PathParam("criteriaId") @ApiParam(value = "criteriaId") final Long criteriaId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.PutProvisioningCriteriaResponse.class))) }) + public String updateProvisioningCriteria(@PathParam("criteriaId") @Parameter(description = "criteriaId") final Long criteriaId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { this.platformSecurityContext.authenticatedUser(); final CommandWrapper commandRequest = new CommandWrapperBuilder().updateProvisioningCriteria(criteriaId) .withJson(apiRequestBodyAsJson).build(); @@ -177,10 +175,10 @@ public class ProvisioningCriteriaApiResource { @Path("{criteriaId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Deletes Provisioning Criteria", notes = "Deletes Provisioning Criteria") + @Operation(summary = "Deletes Provisioning Criteria", description = "Deletes Provisioning Criteria") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.DeleteProvisioningCriteriaResponse.class) }) - public String deleteProvisioningCriteria(@PathParam("criteriaId") @ApiParam(value = "criteriaId") final Long criteriaId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ProvisioningCriteriaApiResourceSwagger.DeleteProvisioningCriteriaResponse.class))) }) + public String deleteProvisioningCriteria(@PathParam("criteriaId") @Parameter(description = "criteriaId") final Long criteriaId) { this.platformSecurityContext.authenticatedUser(); final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteProvisioningCriteria(criteriaId).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResourceSwagger.java index e523511b6..afe7f739d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.provisioning.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.apache.fineract.organisation.provisioning.data.ProvisioningCriteriaDefinitionData; import org.apache.fineract.portfolio.loanproduct.data.LoanProductData; @@ -33,76 +32,76 @@ final class ProvisioningCriteriaApiResourceSwagger { } - @ApiModel(value = "PostProvisioningCriteriaRequest") + @Schema(description = "PostProvisioningCriteriaRequest") public static final class PostProvisioningCriteriaRequest { private PostProvisioningCriteriaRequest() { } - @ApiModelProperty(example = "High Risk Products Criteria") + @Schema(example = "High Risk Products Criteria") public String criteriaName; public Collection loanProducts; public Collection provisioningcriteria; } - @ApiModel(value = "PostProvisioningCriteriaResponse") + @Schema(description = "PostProvisioningCriteriaResponse") public static final class PostProvisioningCriteriaResponse { private PostProvisioningCriteriaResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "GetProvisioningCriteriaResponse") + @Schema(description = "GetProvisioningCriteriaResponse") public static final class GetProvisioningCriteriaResponse { private GetProvisioningCriteriaResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long criteriaId; - @ApiModelProperty(example = "High Risk Products Criteria") + @Schema(example = "High Risk Products Criteria") public String criteriaName; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdBy; } - @ApiModel(value = "GetProvisioningCriteriaCriteriaIdResponse") + @Schema(description = "GetProvisioningCriteriaCriteriaIdResponse") public static final class GetProvisioningCriteriaCriteriaIdResponse { private GetProvisioningCriteriaCriteriaIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long criteriaId; - @ApiModelProperty(example = "High Risk Products Criteria") + @Schema(example = "High Risk Products Criteria") public String criteriaName; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdBy; public Collection loanProducts; public Collection provisioningcriteria; } - @ApiModel(value = "PutProvisioningCriteriaRequest") + @Schema(description = "PutProvisioningCriteriaRequest") public static final class PutProvisioningCriteriaRequest { private PutProvisioningCriteriaRequest() { } - @ApiModelProperty(example = "High Risk Products Criteria") + @Schema(example = "High Risk Products Criteria") public String criteriaName; public Collection loanProducts; public Collection provisioningcriteria; } - @ApiModel(value = "PutProvisioningCriteriaResponse") + @Schema(description = "PutProvisioningCriteriaResponse") public static final class PutProvisioningCriteriaResponse { private PutProvisioningCriteriaResponse() { @@ -113,23 +112,23 @@ final class ProvisioningCriteriaApiResourceSwagger { private PutProvisioningCriteriaResponseChanges() {} - @ApiModelProperty(example = "High Risk Products Criteria") + @Schema(example = "High Risk Products Criteria") public String criteriaName; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutProvisioningCriteriaResponseChanges changes; } - @ApiModel(value = "DeleteProvisioningCriteriaResponse") + @Schema(description = "DeleteProvisioningCriteriaResponse") public static final class DeleteProvisioningCriteriaResponse { private DeleteProvisioningCriteriaResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java index 59e19cd9a..0131495d0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java @@ -20,15 +20,15 @@ package org.apache.fineract.organisation.staff.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -69,9 +69,7 @@ import org.springframework.stereotype.Component; @Path("/staff") @Component @Scope("singleton") -@Api(tags = { "Staff" }) -@SwaggerDefinition(tags = { - @Tag(name = "Staff", description = "Allows you to model staff members. At present the key role of significance is whether this staff member is a loan officer or not.") }) +@Tag(name = "Staff", description = "Allows you to model staff members. At present the key role of significance is whether this staff member is a loan officer or not.") public class StaffApiResource { /** @@ -111,20 +109,20 @@ public class StaffApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Staff", notes = "Returns the list of staff members.\n" + "\n" + "Example Requests:\n" + "\n" + @Operation(summary = "Retrieve Staff", description = "Returns the list of staff members.\n" + "\n" + "Example Requests:\n" + "\n" + "staff\n\n\n\n" + "\n" + "Retrieve a Staff by status\n" + "\n" + "Returns the details of a Staff based on status.\n" + "\n" + "By default it Returns all the ACTIVE Staff.\n" + "\n" + "If status=INACTIVE, then it returns all INACTIVE Staff.\n" + "\n" + "and for status=ALL, it Returns both ACTIVE and INACTIVE Staff.\n" + "\n" + "Example Requests:\n" + "\n" + "staff?status=active") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.GetStaffResponse.class, responseContainer = "List"), - @ApiResponse(code = 200, message = "GET https://DomainName/api/v1/staff?status={ACTIVE|INACTIVE|ALL}", response = StaffApiResourceSwagger.GetStaffResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = StaffApiResourceSwagger.GetStaffResponse.class)))), + @ApiResponse(responseCode = "200", description = "GET https://DomainName/api/v1/staff?status={ACTIVE|INACTIVE|ALL}", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.GetStaffResponse.class))) }) public String retrieveStaff(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @DefaultValue("false") @QueryParam("staffInOfficeHierarchy") @ApiParam(value = "staffInOfficeHierarchy") final boolean staffInOfficeHierarchy, - @DefaultValue("false") @QueryParam("loanOfficersOnly") @ApiParam(value = "loanOfficersOnly") final boolean loanOfficersOnly, - @DefaultValue("active") @QueryParam("status") @ApiParam(value = "status") final String status) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @DefaultValue("false") @QueryParam("staffInOfficeHierarchy") @Parameter(description = "staffInOfficeHierarchy") final boolean staffInOfficeHierarchy, + @DefaultValue("false") @QueryParam("loanOfficersOnly") @Parameter(description = "loanOfficersOnly") final boolean loanOfficersOnly, + @DefaultValue("active") @QueryParam("status") @Parameter(description = "status") final String status) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -142,12 +140,12 @@ public class StaffApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a staff member", notes = "Creates a staff member.\n" + "\n" + "Mandatory Fields: \n" + @Operation(summary = "Create a staff member", description = "Creates a staff member.\n" + "\n" + "Mandatory Fields: \n" + "officeId, firstname, lastname\n" + "\n" + "Optional Fields: \n" + "isLoanOfficer, isActive") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = StaffApiResourceSwagger.PostStaffRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.PostStaffResponse.class) }) - public String createStaff(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.PostStaffRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.PostStaffResponse.class))) }) + public String createStaff(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createStaff().withJson(apiRequestBodyAsJson).build(); @@ -160,10 +158,12 @@ public class StaffApiResource { @Path("{staffId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Staff Member", notes = "Returns the details of a Staff Member.\n" + "\n" + "Example Requests:\n" + @Operation(summary = "Retrieve a Staff Member", description = "Returns the details of a Staff Member.\n" + "\n" + "Example Requests:\n" + "\n" + "staff/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.GetStaffResponse.class) }) - public String retreiveStaff(@PathParam("staffId") @ApiParam(value = "staffId") final Long staffId, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.GetStaffResponse.class))) }) + public String retreiveStaff(@PathParam("staffId") @Parameter(description = "staffId") final Long staffId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -181,12 +181,12 @@ public class StaffApiResource { @Path("{staffId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Staff Member", notes = "Updates the details of a staff member.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = StaffApiResourceSwagger.PutStaffRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.PutStaffResponse.class) }) - public String updateStaff(@PathParam("staffId") @ApiParam(value = "staffId") final Long staffId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Staff Member", description = "Updates the details of a staff member.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.PutStaffRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.PutStaffResponse.class))) }) + public String updateStaff(@PathParam("staffId") @Parameter(description = "staffId") final Long staffId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateStaff(staffId).withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResourceSwagger.java index f9f83b9ea..bfa5a810b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.staff.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.joda.time.LocalDate; /** @@ -32,94 +31,94 @@ final class StaffApiResourceSwagger { } - @ApiModel(value = "PostStaffRequest") + @Schema(description = "PostStaffRequest") public static final class PostStaffRequest { private PostStaffRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "John") + @Schema(example = "John") public String firstname; - @ApiModelProperty(example = "Doe") + @Schema(example = "Doe") public String lastname; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isLoanOfficer; - @ApiModelProperty(example = "17H") + @Schema(example = "17H") public String externalId; - @ApiModelProperty(example = "+353851239876") + @Schema(example = "+353851239876") public String mobileNo; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "01 January 2009") + @Schema(example = "01 January 2009") public LocalDate joiningDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; } - @ApiModel(value = "PostStaffResponse") + @Schema(description = "PostStaffResponse") public static final class PostStaffResponse { private PostStaffResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "GetStaffResponse") + @Schema(description = "GetStaffResponse") public static final class GetStaffResponse { private GetStaffResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "John") + @Schema(example = "John") public String firstname; - @ApiModelProperty(example = "Doe") + @Schema(example = "Doe") public String lastname; - @ApiModelProperty(example = "Doe, John") + @Schema(example = "Doe, John") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isLoanOfficer; - @ApiModelProperty(example = "17H") + @Schema(example = "17H") public String externalId; - @ApiModelProperty(example = "+353851239876") + @Schema(example = "+353851239876") public Boolean isActive; - @ApiModelProperty(example = "[2009,8,1]") + @Schema(example = "[2009,8,1]") public LocalDate joiningDate; } - @ApiModel(value = "PutStaffRequest") + @Schema(description = "PutStaffRequest") public static final class PutStaffRequest { private PutStaffRequest() { } - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isLoanOfficer; - @ApiModelProperty(example = "17Hbb") + @Schema(example = "17Hbb") public String externalId; } - @ApiModel(value = "PutStaffResponse") + @Schema(description = "PutStaffResponse") public static final class PutStaffResponse { private PutStaffResponse() { @@ -130,15 +129,15 @@ final class StaffApiResourceSwagger { private PutStaffResponseChanges() {} - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isLoanOfficer; - @ApiModelProperty(example = "17Hbb") + @Schema(example = "17Hbb") public String externalId; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java index e85ee4f04..ac8fddd6e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.organisation.teller.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Collection; import java.util.Date; import javax.ws.rs.Consumes; @@ -41,8 +39,8 @@ import org.springframework.stereotype.Component; @Path("cashiers") @Component @Scope("singleton") -@Api(tags = { "Cashiers" }) -@SwaggerDefinition(tags = { @Tag(name = "Cashiers", description = "") }) + +@Tag(name = "Cashiers", description = "") public class CashierApiResource { private final DefaultToApiJsonSerializer jsonSerializer; diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java index 50ff531e1..430d6950b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.organisation.teller.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import java.util.Date; import javax.ws.rs.Consumes; @@ -64,9 +64,8 @@ import org.springframework.stereotype.Component; @Path("tellers") @Component @Scope("singleton") -@Api(tags = { "Teller Cash Management" }) -@SwaggerDefinition(tags = { - @Tag(name = "Teller Cash Management", description = "Teller cash management which will allow an organization to manage their cash transactions at branches or head office more effectively.") }) + +@Tag(name = "Teller Cash Management", description = "Teller cash management which will allow an organization to manage their cash transactions at branches or head office more effectively.") public class TellerApiResource { private final PlatformSecurityContext securityContext; @@ -88,10 +87,10 @@ public class TellerApiResource { @GET @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "List all tellers", notes = "Retrieves list tellers") + @Operation(summary = "List all tellers", description = "Retrieves list tellers") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersResponse.class, responseContainer = "List") }) - public String getTellerData(@QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersResponse.class)))) }) + public String getTellerData(@QueryParam("officeId") @Parameter(description = "officeId") final Long officeId) { final Collection foundTellers = this.readPlatformService.getTellers(officeId); return this.jsonSerializer.serialize(foundTellers); @@ -101,9 +100,10 @@ public class TellerApiResource { @Path("{tellerId}") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Retrieve tellers", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersResponse.class) }) - public String findTeller(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId) { + @Operation(summary = "Retrieve tellers", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersResponse.class))) }) + public String findTeller(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId) { final TellerData teller = this.readPlatformService.findTeller(tellerId); return this.jsonSerializer.serialize(teller); @@ -112,12 +112,12 @@ public class TellerApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create teller", notes = "Mandatory Fields\n" + "Teller name, OfficeId, Description, Start Date, Status\n" + @Operation(summary = "Create teller", description = "Mandatory Fields\n" + "Teller name, OfficeId, Description, Start Date, Status\n" + "Optional Fields\n" + "End Date") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersResponse.class) }) - public String createTeller(@ApiParam(hidden = true) final String tellerData) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersResponse.class))) }) + public String createTeller(@Parameter(hidden = true) final String tellerData) { final CommandWrapper request = new CommandWrapperBuilder().createTeller().withJson(tellerData).build(); final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request); @@ -129,12 +129,12 @@ public class TellerApiResource { @Path("{tellerId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update teller", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PutTellersRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PutTellersResponse.class) }) - public String updateTeller(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @ApiParam(hidden = true) final String tellerData) { + @Operation(summary = "Update teller", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PutTellersRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PutTellersResponse.class))) }) + public String updateTeller(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @Parameter(hidden = true) final String tellerData) { final CommandWrapper request = new CommandWrapperBuilder().updateTeller(tellerId).withJson(tellerData).build(); final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request); @@ -146,7 +146,7 @@ public class TellerApiResource { @Path("{tellerId}") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - public String deleteTeller(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId) { + public String deleteTeller(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId) { final CommandWrapper request = new CommandWrapperBuilder().deleteTeller(tellerId).build(); final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request); @@ -158,11 +158,12 @@ public class TellerApiResource { @Path("{tellerId}/cashiers") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "List Cashiers", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersResponse.class) }) - public String getCashierData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @QueryParam("fromdate") @ApiParam(value = "fromdate") final String fromDateStr, - @QueryParam("todate") @ApiParam(value = "todate") final String toDateStr) { + @Operation(summary = "List Cashiers", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersResponse.class))) }) + public String getCashierData(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @QueryParam("fromdate") @Parameter(description = "fromdate") final String fromDateStr, + @QueryParam("todate") @Parameter(description = "todate") final String toDateStr) { final DateTimeFormatter dateFormatter = ISODateTimeFormat.basicDate(); final Date fromDate = fromDateStr != null ? dateFormatter.parseDateTime(fromDateStr).toDate() : new Date(); @@ -185,11 +186,11 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Retrieve a cashier", notes = "") + @Operation(summary = "Retrieve a cashier", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashierIdResponse.class) }) - public String findCashierData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashierIdResponse.class))) }) + public String findCashierData(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId) { final CashierData cashier = this.readPlatformService.findCashier(cashierId); return this.jsonSerializer.serialize(cashier); @@ -199,10 +200,10 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/template") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Find Cashiers", notes = "") + @Operation(summary = "Find Cashiers", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersTemplateResponse.class) }) - public String getCashierTemplate(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersTemplateResponse.class))) }) + public String getCashierTemplate(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId) { final TellerData teller = this.readPlatformService.findTeller(tellerId); Long officeId = teller.getOfficeId(); @@ -216,14 +217,14 @@ public class TellerApiResource { @Path("{tellerId}/cashiers") @Consumes({ MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create Cashiers", notes = "Mandatory Fields: \n" + @Operation(summary = "Create Cashiers", description = "Mandatory Fields: \n" + "Cashier/staff, Fromm Date, To Date, Full Day or From time and To time\n" + "\n\n\n" + "Optional Fields: \n" + "Description/Notes") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersTellerIdCashiersRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersTellerIdCashiersResponse.class) }) - public String createCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @ApiParam(hidden = true) final String cashierData) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersTellerIdCashiersRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersTellerIdCashiersResponse.class))) }) + public String createCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @Parameter(hidden = true) final String cashierData) { final CommandWrapper request = new CommandWrapperBuilder().allocateTeller(tellerId).withJson(cashierData).build(); final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request); @@ -235,14 +236,13 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update Cashier", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PutTellersTellerIdCashiersCashierIdRequest.class) }) + @Operation(summary = "Update Cashier", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PutTellersTellerIdCashiersCashierIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PutTellersTellerIdCashiersCashierIdResponse.class) }) - public String updateCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId, - @ApiParam(hidden = true) final String cashierDate) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PutTellersTellerIdCashiersCashierIdResponse.class))) }) + public String updateCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId, + @Parameter(hidden = true) final String cashierDate) { final CommandWrapper request = new CommandWrapperBuilder().updateAllocationTeller(tellerId, cashierId).withJson(cashierDate) .build(); @@ -255,11 +255,11 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete Cashier", notes = "") + @Operation(summary = "Delete Cashier", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.DeleteTellersTellerIdCashiersCashierIdResponse.class) }) - public String deleteCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.DeleteTellersTellerIdCashiersCashierIdResponse.class))) }) + public String deleteCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId) { final CommandWrapper request = new CommandWrapperBuilder().deleteAllocationTeller(tellerId, cashierId).build(); final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request); @@ -271,14 +271,13 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}/allocate") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Allocate Cash To Cashier", notes = "Mandatory Fields: \n" + "Date, Amount, Currency, Notes/Comments") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdAllocateRequest.class) }) + @Operation(summary = "Allocate Cash To Cashier", description = "Mandatory Fields: \n" + "Date, Amount, Currency, Notes/Comments") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdAllocateRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdAllocateResponse.class) }) - public String allocateCashToCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId, - @ApiParam(hidden = true) final String cashierTxnData) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdAllocateResponse.class))) }) + public String allocateCashToCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId, + @Parameter(hidden = true) final String cashierTxnData) { final CommandWrapper request = new CommandWrapperBuilder().allocateCashToCashier(tellerId, cashierId).withJson(cashierTxnData) .build(); @@ -292,14 +291,13 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}/settle") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Settle Cash From Cashier", notes = "Mandatory Fields\n" + "Date, Amount, Currency, Notes/Comments") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdSettleRequest.class) }) + @Operation(summary = "Settle Cash From Cashier", description = "Mandatory Fields\n" + "Date, Amount, Currency, Notes/Comments") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdSettleRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdSettleResponse.class) }) - public String settleCashFromCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId, - @ApiParam(hidden = true) final String cashierTxnData) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdSettleResponse.class))) }) + public String settleCashFromCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId, + @Parameter(hidden = true) final String cashierTxnData) { final CommandWrapper request = new CommandWrapperBuilder().settleCashFromCashier(tellerId, cashierId).withJson(cashierTxnData) .build(); @@ -313,16 +311,16 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}/transactions") @Consumes({ MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Retrieve Cashier Transaction", notes = "") + @Operation(summary = "Retrieve Cashier Transaction", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsResponse.class, responseContainer = "List") }) - public String getTransactionsForCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId, - @QueryParam("currencyCode") @ApiParam(value = "currencyCode") final String currencyCode, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsResponse.class)))) }) + public String getTransactionsForCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId, + @QueryParam("currencyCode") @Parameter(description = "currencyCode") final String currencyCode, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { final TellerData teller = this.readPlatformService.findTeller(tellerId); final CashierData cashier = this.readPlatformService.findCashier(cashierId); @@ -339,16 +337,16 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}/summaryandtransactions") @Consumes({ MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Transactions Wtih Summary For Cashier", notes = "") + @Operation(summary = "Transactions Wtih Summary For Cashier", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse.class) }) - public String getTransactionsWtihSummaryForCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId, - @QueryParam("currencyCode") @ApiParam(value = "currencyCode") final String currencyCode, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse.class))) }) + public String getTransactionsWtihSummaryForCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId, + @QueryParam("currencyCode") @Parameter(description = "currencyCode") final String currencyCode, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { final TellerData teller = this.readPlatformService.findTeller(tellerId); final CashierData cashier = this.readPlatformService.findCashier(cashierId); @@ -367,11 +365,11 @@ public class TellerApiResource { @Path("{tellerId}/cashiers/{cashierId}/transactions/template") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Retrieve Cashier Transaction Template", notes = "") + @Operation(summary = "Retrieve Cashier Transaction Template", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse.class) }) - public String getCashierTxnTemplate(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse.class))) }) + public String getCashierTxnTemplate(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId) { final CashierTransactionData cashierTxnTemplate = this.readPlatformService.retrieveCashierTxnTemplate(cashierId); @@ -382,8 +380,8 @@ public class TellerApiResource { @Path("{tellerId}/transactions") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - public String getTransactionData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @QueryParam("dateRange") @ApiParam(value = "dateRange") final String dateRange) { + public String getTransactionData(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @QueryParam("dateRange") @Parameter(description = "dateRange") final String dateRange) { final DateRange dateRangeHolder = DateRange.fromString(dateRange); final Collection transactions = this.readPlatformService.fetchTellerTransactionsByTellerId(tellerId, @@ -396,8 +394,8 @@ public class TellerApiResource { @Path("{tellerId}/transactions/{transactionId}") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - public String findTransactionData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerid, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId) { + public String findTransactionData(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerid, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId) { final TellerTransactionData transaction = this.readPlatformService.findTellerTransaction(transactionId); return this.jsonSerializer.serialize(transaction); @@ -407,9 +405,9 @@ public class TellerApiResource { @Path("{tellerId}/journals") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - public String getJournalData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, - @QueryParam("cashierId") @ApiParam(value = "cashierId") final Long cashierDate, - @QueryParam("dateRange") @ApiParam(value = "dateRange") final String dateRange) { + public String getJournalData(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId, + @QueryParam("cashierId") @Parameter(description = "cashierId") final Long cashierDate, + @QueryParam("dateRange") @Parameter(description = "dateRange") final String dateRange) { final DateRange dateRangeHolder = DateRange.fromString(dateRange); final Collection journals = this.readPlatformService.fetchTellerJournals(tellerId, cashierDate, diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResourceSwagger.java index c4c2ee48b..7b0eeee24 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.teller.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.math.BigDecimal; import java.util.Collection; import java.util.Date; @@ -41,95 +40,95 @@ final class TellerApiResourceSwagger { } - @ApiModel(value = "GetTellersResponse") + @Schema(description = "GetTellersResponse") public static final class GetTellersResponse { private GetTellersResponse() { } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long debitAccountId; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long creditAccountId; - @ApiModelProperty(example = "Teller3") + @Schema(example = "Teller3") public String name; - @ApiModelProperty(example = "[2015,2,1]") + @Schema(example = "[2015,2,1]") public LocalDate startDate; - @ApiModelProperty(example = "ACTIVE") + @Schema(example = "ACTIVE") public TellerStatus status; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } - @ApiModel(value = "PostTellersRequest") + @Schema(description = "PostTellersRequest") public static final class PostTellersRequest { private PostTellersRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Teller3") + @Schema(example = "Teller3") public String name; - @ApiModelProperty(example = "cash handling") + @Schema(example = "cash handling") public String description; - @ApiModelProperty(example = "ACTIVE") + @Schema(example = "ACTIVE") public TellerStatus status; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; - @ApiModelProperty(example = "01 February 2015") + @Schema(example = "01 February 2015") public LocalDate startDate; } - @ApiModel(value = "PostTellersResponse") + @Schema(description = "PostTellersResponse") public static final class PostTellersResponse { private PostTellersResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Long resourceId; } - @ApiModel(value = "PutTellersRequest") + @Schema(description = "PutTellersRequest") public static final class PutTellersRequest { private PutTellersRequest() { } - @ApiModelProperty(example = "Teller3") + @Schema(example = "Teller3") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "teller cash handling") + @Schema(example = "teller cash handling") public String description; - @ApiModelProperty(example = "ACTIVE") + @Schema(example = "ACTIVE") public TellerStatus status; - @ApiModelProperty(example = "28 February 2015") + @Schema(example = "28 February 2015") public LocalDate endDate; - @ApiModelProperty(example = "01 February 2015") + @Schema(example = "01 February 2015") public LocalDate startDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; } - @ApiModel(value = "PutTellersResponse") + @Schema(description = "PutTellersResponse") public static final class PutTellersResponse { private PutTellersResponse() { @@ -140,140 +139,140 @@ final class TellerApiResourceSwagger { private PutTellersResponseChanges() {} - @ApiModelProperty(example = "teller cash handling") + @Schema(example = "teller cash handling") public String description; - @ApiModelProperty(example = "28 February 2015") + @Schema(example = "28 February 2015") public LocalDate endDate; - @ApiModelProperty(example = "01 February 2015") + @Schema(example = "01 February 2015") public LocalDate startDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Long resourceId; public PutTellersResponseChanges changes; } - @ApiModel(value = "GetTellersTellerIdCashiersResponse") + @Schema(description = "GetTellersTellerIdCashiersResponse") public static final class GetTellersTellerIdCashiersResponse { private GetTellersTellerIdCashiersResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long tellerId; - @ApiModelProperty(example = "Teller1") + @Schema(example = "Teller1") public String tellerName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public Collection cashiers; } - @ApiModel(value = "PostTellersTellerIdCashiersRequest") + @Schema(description = "PostTellersTellerIdCashiersRequest") public static final class PostTellersTellerIdCashiersRequest { private PostTellersTellerIdCashiersRequest() { } - @ApiModelProperty(example = "28 February 2015") + @Schema(example = "28 February 2015") public LocalDate endDate; - @ApiModelProperty(example = "teller cash handling") + @Schema(example = "teller cash handling") public String description; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isFullDay; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long staffId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; - @ApiModelProperty(example = "01 February 2015") + @Schema(example = "01 February 2015") public LocalDate startDate; } - @ApiModel(value = "PostTellersTellerIdCashiersResponse") + @Schema(description = "PostTellersTellerIdCashiersResponse") public static final class PostTellersTellerIdCashiersResponse { private PostTellersTellerIdCashiersResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long subResourceId; } - @ApiModel(value = "GetTellersTellerIdCashiersCashierIdResponse") + @Schema(description = "GetTellersTellerIdCashiersCashierIdResponse") public static final class GetTellersTellerIdCashiersCashierIdResponse { private GetTellersTellerIdCashiersCashierIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long tellerId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long staffId; - @ApiModelProperty(example = "") + @Schema(example = "") public String description; - @ApiModelProperty(example = "Feb 20, 2015 12:00:00 AM") + @Schema(example = "Feb 20, 2015 12:00:00 AM") public LocalDate startDate; - @ApiModelProperty(example = "Feb 27, 2015 12:00:00 AM") + @Schema(example = "Feb 27, 2015 12:00:00 AM") public LocalDate endDate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isFullDay; - @ApiModelProperty(example = "") + @Schema(example = "") public String startTime; - @ApiModelProperty(example = "") + @Schema(example = "") public String endTime; - @ApiModelProperty(example = "Teller1") + @Schema(example = "Teller1") public String tellerName; - @ApiModelProperty(example = "Staff1, Test") + @Schema(example = "Staff1, Test") public String staffName; } - @ApiModel(value = "PutTellersTellerIdCashiersCashierIdRequest") + @Schema(description = "PutTellersTellerIdCashiersCashierIdRequest") public static final class PutTellersTellerIdCashiersCashierIdRequest { private PutTellersTellerIdCashiersCashierIdRequest() { } - @ApiModelProperty(example = "25 February 2015") + @Schema(example = "25 February 2015") public LocalDate endDate; - @ApiModelProperty(example = "Cashier updated.") + @Schema(example = "Cashier updated.") public String description; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isFullDay; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long staffId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; - @ApiModelProperty(example = "01 February 2015") + @Schema(example = "01 February 2015") public LocalDate startDate; } - @ApiModel(value = "PutTellersTellerIdCashiersCashierIdResponse") + @Schema(description = "PutTellersTellerIdCashiersCashierIdResponse") public static final class PutTellersTellerIdCashiersCashierIdResponse { private PutTellersTellerIdCashiersCashierIdResponse() { @@ -284,207 +283,207 @@ final class TellerApiResourceSwagger { private PutTellersTellerIdCashiersCashierIdResponseChanges() {} - @ApiModelProperty(example = "25 February 2015") + @Schema(example = "25 February 2015") public LocalDate endDate; - @ApiModelProperty(example = "Cashier updated.") + @Schema(example = "Cashier updated.") public String description; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long subResourceId; public PutTellersTellerIdCashiersCashierIdResponseChanges changes; } - @ApiModel(value = "DeleteTellersTellerIdCashiersCashierIdResponse") + @Schema(description = "DeleteTellersTellerIdCashiersCashierIdResponse") public static final class DeleteTellersTellerIdCashiersCashierIdResponse { private DeleteTellersTellerIdCashiersCashierIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "GetTellersTellerIdCashiersTemplateResponse") + @Schema(description = "GetTellersTellerIdCashiersTemplateResponse") public static final class GetTellersTellerIdCashiersTemplateResponse { private GetTellersTellerIdCashiersTemplateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long tellerId; - @ApiModelProperty(example = "Teller1") + @Schema(example = "Teller1") public String tellerName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public Collection staffOptions; } - @ApiModel(value = "GetTellersTellerIdCashiersCashiersIdTransactionsResponse") + @Schema(description = "GetTellersTellerIdCashiersCashiersIdTransactionsResponse") public static final class GetTellersTellerIdCashiersCashiersIdTransactionsResponse { private GetTellersTellerIdCashiersCashiersIdTransactionsResponse() { } - @ApiModelProperty(example = "8") + @Schema(example = "8") public Long id; - @ApiModelProperty(example = "15") + @Schema(example = "15") public Long cashierId; public CashierTxnType txnType; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public BigDecimal txnAmount; - @ApiModelProperty(example = "Feb 25, 2015 12:00:00 AM") + @Schema(example = "Feb 25, 2015 12:00:00 AM") public Date txnDate; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long entityId; - @ApiModelProperty(example = "loans") + @Schema(example = "loans") public String entityType; - @ApiModelProperty(example = "Disbursement, Loan:2-000000002,Client:1-Test 1") + @Schema(example = "Disbursement, Loan:2-000000002,Client:1-Test 1") public String txnNote; - @ApiModelProperty(example = "Feb 25, 2015 12:00:00 AM") + @Schema(example = "Feb 25, 2015 12:00:00 AM") public Date createdDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long tellerId; - @ApiModelProperty(example = "B, Ramesh") + @Schema(example = "B, Ramesh") public String cashierName; } - @ApiModel(value = "PostTellersTellerIdCashiersCashierIdAllocateRequest") + @Schema(description = "PostTellersTellerIdCashiersCashierIdAllocateRequest") public static final class PostTellersTellerIdCashiersCashierIdAllocateRequest { private PostTellersTellerIdCashiersCashierIdAllocateRequest() { } - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public BigDecimal txnAmount; - @ApiModelProperty(example = "allocating cash") + @Schema(example = "allocating cash") public String txnNote; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; - @ApiModelProperty(example = "01 February 2015") + @Schema(example = "01 February 2015") public Date txnDate; } - @ApiModel(value = "PostTellersTellerIdCashiersCashierIdAllocateResponse") + @Schema(description = "PostTellersTellerIdCashiersCashierIdAllocateResponse") public static final class PostTellersTellerIdCashiersCashierIdAllocateResponse { private PostTellersTellerIdCashiersCashierIdAllocateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long subResourceId; } - @ApiModel(value = "PostTellersTellerIdCashiersCashierIdSettleRequest") + @Schema(description = "PostTellersTellerIdCashiersCashierIdSettleRequest") public static final class PostTellersTellerIdCashiersCashierIdSettleRequest { private PostTellersTellerIdCashiersCashierIdSettleRequest() { } - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "2000") + @Schema(example = "2000") public BigDecimal txnAmount; - @ApiModelProperty(example = "cash settlement") + @Schema(example = "cash settlement") public String txnNote; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd-MM-yyyy") + @Schema(example = "dd-MM-yyyy") public String dateFormat; - @ApiModelProperty(example = "20 February 2015") + @Schema(example = "20 February 2015") public Date txnDate; } - @ApiModel(value = "PostTellersTellerIdCashiersCashierIdSettleResponse") + @Schema(description = "PostTellersTellerIdCashiersCashierIdSettleResponse") public static final class PostTellersTellerIdCashiersCashierIdSettleResponse { private PostTellersTellerIdCashiersCashierIdSettleResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Long subResourceId; } - @ApiModel(value = "GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse") + @Schema(description = "GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse") public static final class GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse { private GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse() { } - @ApiModelProperty(example = "7000.000000") + @Schema(example = "7000.000000") public BigDecimal sumCashAllocation; - @ApiModelProperty(example = "0") + @Schema(example = "0") public BigDecimal sumInwardCash; - @ApiModelProperty(example = "0") + @Schema(example = "0") public BigDecimal sumOutwardCash; - @ApiModelProperty(example = "50.000000") + @Schema(example = "50.000000") public BigDecimal sumCashSettlement; - @ApiModelProperty(example = "6950.000000") + @Schema(example = "6950.000000") public BigDecimal netCash; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public long tellerId; - @ApiModelProperty(example = "Teller1") + @Schema(example = "Teller1") public String tellerName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public long cashierId; - @ApiModelProperty(example = "Staff1, Test") + @Schema(example = "Staff1, Test") public String cashierName; public Page cashierTransactions; } - @ApiModel(value = "GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse") + @Schema(description = "GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse") public static final class GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse { private GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long cashierId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long tellerId; - @ApiModelProperty(example = "Teller1") + @Schema(example = "Teller1") public String tellerName; - @ApiModelProperty(example = "Staff1, Test") + @Schema(example = "Staff1, Test") public String cashierName; public CashierData cashierData; - @ApiModelProperty(example = "Feb 20, 2015 12:00:00 AM") + @Schema(example = "Feb 20, 2015 12:00:00 AM") public LocalDate startDate; - @ApiModelProperty(example = "Feb 27, 2015 12:00:00 AM") + @Schema(example = "Feb 27, 2015 12:00:00 AM") public LocalDate endDate; public Collection currencyOptions; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java index ac0b01484..275b03f83 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.organisation.teller.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -41,8 +39,8 @@ import org.springframework.stereotype.Component; @Path("cashiersjournal") @Component @Scope("singleton") -@Api(tags = { "Cashier Journals" }) -@SwaggerDefinition(tags = { @Tag(name = "Cashier Journals", description = "") }) + +@Tag(name = "Cashier Journals", description = "") public class TellerJournalApiResource { private final PlatformSecurityContext securityContext; diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java index bfc0ec60d..99cf2f7eb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.organisation.workingdays.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; @@ -52,11 +52,11 @@ import org.springframework.stereotype.Component; @Path("/workingdays") @Component @Scope("singleton") -@Api(tags = { "Working days" }) -@SwaggerDefinition(tags = { @Tag(name = "Working days", description = "The days of the week that are workdays.\n" + "\n" + +@Tag(name = "Working days", description = "The days of the week that are workdays.\n" + "\n" + "Rescheduling of repayments when it falls on a non-working is turned on /off by enable/disable reschedule-future-repayments parameter in Global configurations\n" + "\n" - + "Allow transactions on non-working days is configurable by enabling/disbaling the allow-transactions-on-non_workingday parameter in Global configurations.") }) + + "Allow transactions on non-working days is configurable by enabling/disbaling the allow-transactions-on-non_workingday parameter in Global configurations.") public class WorkingDaysApiResource { private final DefaultToApiJsonSerializer toApiJsonSerializer; @@ -80,9 +80,9 @@ public class WorkingDaysApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Working days", notes = "Example Requests:\n" + "\n" + "workingdays") + @Operation(summary = "List Working days", description = "Example Requests:\n" + "\n" + "workingdays") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysResponse.class, responseContainer = "list") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = WorkingDaysApiResourceSwagger.GetWorkingDaysResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME); final WorkingDaysData workingDaysData = this.workingDaysReadPlatformService.retrieve(); @@ -94,12 +94,12 @@ public class WorkingDaysApiResource { @PUT @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Working Day", notes = "Mandatory Fields\n" + @Operation(summary = "Update a Working Day", description = "Mandatory Fields\n" + "recurrence,repaymentRescheduleType,extendTermForDailyRepayments,locale") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = WorkingDaysApiResourceSwagger.PutWorkingDaysRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.PutWorkingDaysResponse.class) }) - public String update(@ApiParam(hidden = true) final String jsonRequestBody) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = WorkingDaysApiResourceSwagger.PutWorkingDaysRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = WorkingDaysApiResourceSwagger.PutWorkingDaysResponse.class))) }) + public String update(@Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateWorkingDays().withJson(jsonRequestBody).build(); @@ -112,9 +112,10 @@ public class WorkingDaysApiResource { @Path("/template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Working Days Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for working days.\n" + @Operation(summary = "Working Days Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for working days.\n" + "\n" + "Example Request:\n" + "\n" + "workingdays/template") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysTemplateResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = WorkingDaysApiResourceSwagger.GetWorkingDaysTemplateResponse.class))) }) public String template(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResourceSwagger.java index 318a26143..1da807591 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.organisation.workingdays.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.apache.fineract.infrastructure.core.data.EnumOptionData; @@ -33,23 +32,23 @@ final class WorkingDaysApiResourceSwagger { } - @ApiModel(value = "GetWorkingDaysResponse") + @Schema(description = "GetWorkingDaysResponse") public static final class GetWorkingDaysResponse { private GetWorkingDaysResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + @Schema(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") public String recurrence; public EnumOptionData repaymentRescheduleType; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean extendTermForDailyRepayments; } - @ApiModel(value = "GetWorkingDaysTemplateResponse") + @Schema(description = "GetWorkingDaysTemplateResponse") public static final class GetWorkingDaysTemplateResponse { private GetWorkingDaysTemplateResponse() { @@ -59,31 +58,31 @@ final class WorkingDaysApiResourceSwagger { public Collection repaymentRescheduleOptions; } - @ApiModel(value = "PutWorkingDaysRequest") + @Schema(description = "PutWorkingDaysRequest") public static final class PutWorkingDaysRequest { private PutWorkingDaysRequest() { } - @ApiModelProperty(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") + @Schema(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR") public String recurrence; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "4") + @Schema(example = "4") public EnumOptionData repaymentRescheduleType; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean extendTermForDailyRepayments; } - @ApiModel(value = "PutWorkingDaysResponse") + @Schema(description = "PutWorkingDaysResponse") public static final class PutWorkingDaysResponse { private PutWorkingDaysResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java index c7b8441cf..70d89ce67 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.account.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -56,9 +55,7 @@ import org.springframework.stereotype.Component; @Path("/accounttransfers") @Component @Scope("singleton") -@Api(tags = { "Account Transfers" }) -@SwaggerDefinition(tags = { - @Tag(name = "Account Transfers", description = "Ability to be able to transfer monetary funds from one account to another.\n\nNote: At present only savings account to savings account transfers are supported.") }) +@Tag(name = "Account Transfers", description = "Ability to be able to transfer monetary funds from one account to another.\n\nNote: At present only savings account to savings account transfers are supported.") public class AccountTransfersApiResource { private final PlatformSecurityContext context; @@ -84,21 +81,22 @@ public class AccountTransfersApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Account Transfer Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n\n" + @Operation(summary = "Retrieve Account Transfer Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n\n" + "\n\n" + "Field Defaults\n\n" + "Allowed Value Lists\n\n" + "Example Requests:\n\n" + "\n\n" + "accounttransfers/template?fromAccountType=2&fromOfficeId=1\n\n" + "\n\n" + "accounttransfers/template?fromAccountType=2&fromOfficeId=1&fromClientId=1\n\n" + "\n\n" + "accounttransfers/template?fromClientId=1&fromAccountType=2&fromAccountId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersTemplateResponse.class) }) - public String template(@QueryParam("fromOfficeId") @ApiParam(value = "fromOfficeId") final Long fromOfficeId, - @QueryParam("fromClientId") @ApiParam(value = "fromClientId") final Long fromClientId, - @QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccountId, - @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType, - @QueryParam("toOfficeId") @ApiParam(value = "toOfficeId") final Long toOfficeId, - @QueryParam("toClientId") @ApiParam(value = "toClientId") final Long toClientId, - @QueryParam("toAccountId") @ApiParam(value = "toAccountId") final Long toAccountId, - @QueryParam("toAccountType") @ApiParam(value = "toAccountType") final Integer toAccountType, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.GetAccountTransfersTemplateResponse.class))) }) + public String template(@QueryParam("fromOfficeId") @Parameter(description = "fromOfficeId") final Long fromOfficeId, + @QueryParam("fromClientId") @Parameter(description = "fromClientId") final Long fromClientId, + @QueryParam("fromAccountId") @Parameter(description = "fromAccountId") final Long fromAccountId, + @QueryParam("fromAccountType") @Parameter(description = "fromAccountType") final Integer fromAccountType, + @QueryParam("toOfficeId") @Parameter(description = "toOfficeId") final Long toOfficeId, + @QueryParam("toClientId") @Parameter(description = "toClientId") final Long toClientId, + @QueryParam("toAccountId") @Parameter(description = "toAccountId") final Long toAccountId, + @QueryParam("toAccountType") @Parameter(description = "toAccountType") final Integer toAccountType, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME); @@ -112,12 +110,10 @@ public class AccountTransfersApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create new Transfer", httpMethod = "POST", notes = "Ability to create new transfer of monetary funds from one account to another.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountTransfersApiResourceSwagger.PostAccountTransfersRequest.class) }) - @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.PostAccountTransfersResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create new Transfer", description = "Ability to create new transfer of monetary funds from one account to another.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.PostAccountTransfersRequest.class))) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.PostAccountTransfersResponse.class))) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createAccountTransfer().withJson(apiRequestBodyAsJson).build(); @@ -129,18 +125,18 @@ public class AccountTransfersApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List account transfers", httpMethod = "GET", notes = "Lists account's transfers\n\n" + "Example Requests:\n\n" - + "\n\n" + "accounttransfers") + @Operation(summary = "List account transfers", description = "Lists account's transfers\n\n" + "Example Requests:\n\n" + "\n\n" + + "accounttransfers") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.GetAccountTransfersResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(example = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("accountDetailId") @ApiParam(value = "accountDetailId") final Long accountDetailId) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(example = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("accountDetailId") @Parameter(description = "accountDetailId") final Long accountDetailId) { this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME); @@ -157,11 +153,11 @@ public class AccountTransfersApiResource { @Path("{transferId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve account transfer", httpMethod = "GET", notes = "Retrieves account transfer\n\n" - + "Example Requests :\n\n" + "\n\n" + "accounttransfers/1") + @Operation(summary = "Retrieve account transfer", description = "Retrieves account transfer\n\n" + "Example Requests :\n\n" + "\n\n" + + "accounttransfers/1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersResponse.GetAccountTransfersPageItems.class) }) - public String retrieveOne(@PathParam("transferId") @ApiParam(value = "transferId") final Long transferId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.GetAccountTransfersResponse.GetAccountTransfersPageItems.class))) }) + public String retrieveOne(@PathParam("transferId") @Parameter(description = "transferId") final Long transferId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME); @@ -176,19 +172,20 @@ public class AccountTransfersApiResource { @Path("templateRefundByTransfer") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Refund of an Active Loan by Transfer Template", httpMethod = "GET", notes = "Retrieves Refund of an Active Loan by Transfer Template" + @Operation(summary = "Retrieve Refund of an Active Loan by Transfer Template", description = "Retrieves Refund of an Active Loan by Transfer Template" + "Example Requests :\n\n" + "\n\n" + "accounttransfers/templateRefundByTransfer?fromAccountId=2&fromAccountType=1& toAccountId=1&toAccountType=2&toClientId=1&toOfficeId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersTemplateRefundByTransferResponse.class) }) - public String templateRefundByTransfer(@QueryParam("fromOfficeId") @ApiParam(value = "fromOfficeId") final Long fromOfficeId, - @QueryParam("fromClientId") @ApiParam(value = "fromClientId") final Long fromClientId, - @QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccountId, - @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType, - @QueryParam("toOfficeId") @ApiParam(value = "toOfficeId") final Long toOfficeId, - @QueryParam("toClientId") @ApiParam(value = "toClientId") final Long toClientId, - @QueryParam("toAccountId") @ApiParam(value = "toAccountId") final Long toAccountId, - @QueryParam("toAccountType") @ApiParam(value = "toAccountType") final Integer toAccountType, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.GetAccountTransfersTemplateRefundByTransferResponse.class))) }) + public String templateRefundByTransfer(@QueryParam("fromOfficeId") @Parameter(description = "fromOfficeId") final Long fromOfficeId, + @QueryParam("fromClientId") @Parameter(description = "fromClientId") final Long fromClientId, + @QueryParam("fromAccountId") @Parameter(description = "fromAccountId") final Long fromAccountId, + @QueryParam("fromAccountType") @Parameter(description = "fromAccountType") final Integer fromAccountType, + @QueryParam("toOfficeId") @Parameter(description = "toOfficeId") final Long toOfficeId, + @QueryParam("toClientId") @Parameter(description = "toClientId") final Long toClientId, + @QueryParam("toAccountId") @Parameter(description = "toAccountId") final Long toAccountId, + @QueryParam("toAccountType") @Parameter(description = "toAccountType") final Integer toAccountType, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME); @@ -203,12 +200,11 @@ public class AccountTransfersApiResource { @Path("refundByTransfer") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Refund of an Active Loan by Transfer", httpMethod = "POST", notes = "Ability to refund an active loan by transferring to a savings account.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountTransfersApiResourceSwagger.PostAccountTransfersRefundByTransferRequest.class) }) + @Operation(summary = "Refund of an Active Loan by Transfer", description = "Ability to refund an active loan by transferring to a savings account.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.PostAccountTransfersRefundByTransferRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.PostAccountTransfersRefundByTransferResponse.class) }) - public String templateRefundByTransferPost(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountTransfersApiResourceSwagger.PostAccountTransfersRefundByTransferResponse.class))) }) + public String templateRefundByTransferPost(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().refundByTransfer().withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResourceSwagger.java index e90cd5e3a..8757da352 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.account.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class AccountTransfersApiResourceSwagger { private AccountTransfersApiResourceSwagger() {} - @ApiModel(value = "GetAccountTransfersTemplateResponse") + @Schema(description = "GetAccountTransfersTemplateResponse") public static final class GetAccountTransfersTemplateResponse { private GetAccountTransfersTemplateResponse() {} @@ -39,17 +38,17 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersFromOffice() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String name; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String nameDecorated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer externalId; - @ApiModelProperty(example = "[2009, 1, 1]") + @Schema(example = "[2009, 1, 1]") public LocalDate openingDate; - @ApiModelProperty(example = ".") + @Schema(example = ".") public String hierarchy; } @@ -57,23 +56,23 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersFromAccountType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } static final class GetAccountTransfersFromOfficeOptions { private GetAccountTransfersFromOfficeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String name; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String nameDecorated; } @@ -81,13 +80,13 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersFromClientOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Small shop") + @Schema(example = "Small shop") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String officeName; } @@ -95,23 +94,23 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersFromAccountTypeOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } static final class GetAccountTransfersToOfficeOptions { private GetAccountTransfersToOfficeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String name; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String nameDecorated; } @@ -119,17 +118,17 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersToAccountTypeOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long transferAmount; - @ApiModelProperty(example = "[2013, 8, 15]") + @Schema(example = "[2013, 8, 15]") public LocalDate transferDate; public GetAccountTransfersFromOffice fromOffice; public GetAccountTransfersFromAccountType fromAccountType; @@ -140,51 +139,51 @@ final class AccountTransfersApiResourceSwagger { public Set toAccountTypeOptions; } - @ApiModel(value = "PostAccountTransfersRequest") + @Schema(description = "PostAccountTransfersRequest") public static final class PostAccountTransfersRequest { private PostAccountTransfersRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer fromAccountType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromAccountId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toAccountType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toAccountId; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "01 August 2011") + @Schema(example = "01 August 2011") public String transferDate; - @ApiModelProperty(example = "112.45") + @Schema(example = "112.45") public Float transferAmount; - @ApiModelProperty(example = "A description of the transfer") + @Schema(example = "A description of the transfer") public String transferDescription; } - @ApiModel(value = "PostAccountTransfersResponse") + @Schema(description = "PostAccountTransfersResponse") public static final class PostAccountTransfersResponse { private PostAccountTransfersResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetAccountTransfersResponse") + @Schema(description = "GetAccountTransfersResponse") public static final class GetAccountTransfersResponse { private GetAccountTransfersResponse() {} @@ -197,17 +196,17 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersPageItemsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -215,9 +214,9 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersPageItemsFromOffice() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "HO") + @Schema(example = "HO") public String name; } @@ -225,9 +224,9 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersPageItemsFromAccount() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; } @@ -235,24 +234,24 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersPageItemsToAccountType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountType.loan") + @Schema(example = "accountType.loan") public String code; - @ApiModelProperty(example = "Loan Account") - public String value; + @Schema(example = "Loan Account") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean reversed; public GetAccountTransfersPageItemsCurrency currency; - @ApiModelProperty(example = "200") + @Schema(example = "200") public Float transferAmount; - @ApiModelProperty(example = "[2013, 4, 1]") + @Schema(example = "[2013, 4, 1]") public LocalDate transferDate; - @ApiModelProperty(example = "pay off loan from savings.") + @Schema(example = "pay off loan from savings.") public String transferDescription; public GetAccountTransfersPageItemsFromOffice fromOffice; public GetAccountTransfersTemplateResponse.GetAccountTransfersFromClientOptions fromClient; @@ -264,12 +263,12 @@ final class AccountTransfersApiResourceSwagger { public GetAccountTransfersPageItemsFromAccount toAccount; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetAccountTransfersTemplateRefundByTransferResponse") + @Schema(description = "GetAccountTransfersTemplateRefundByTransferResponse") public static final class GetAccountTransfersTemplateRefundByTransferResponse { private GetAccountTransfersTemplateRefundByTransferResponse() {} @@ -278,19 +277,19 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer decimalPlaces; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -298,17 +297,17 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferFromOffice() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer externalId; - @ApiModelProperty(example = "[2009, 1, 1]") + @Schema(example = "[2009, 1, 1]") public LocalDate openingDate; - @ApiModelProperty(example = ".") + @Schema(example = ".") public String hierarchy; } @@ -320,12 +319,12 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "clientStatusType.active") + @Schema(example = "clientStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; + @Schema(example = "Active") + public String description; } static final class GetAccountTransfersGender { @@ -347,21 +346,21 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTimeline() {} - @ApiModelProperty(example = "[2012, 2, 1]") + @Schema(example = "[2012, 2, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; - @ApiModelProperty(example = "[2012, 2, 1]") + @Schema(example = "[2012, 2, 1]") public LocalDate activatedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String activatedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String activatedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String activatedByLastname; } @@ -370,27 +369,27 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersGroups() {} } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; public GetAccountTransfersStatus status; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "[2012, 2, 1]") + @Schema(example = "[2012, 2, 1]") public LocalDate activationDate; - @ApiModelProperty(example = "Daniel") + @Schema(example = "Daniel") public String firstname; - @ApiModelProperty(example = "Owusu") + @Schema(example = "Owusu") public String lastname; - @ApiModelProperty(example = "Daniel Owusu") + @Schema(example = "Daniel Owusu") public String displayName; public GetAccountTransfersGender gender; public GetAccountTransfersClientType clientType; public GetAccountTransfersClientClassification clientClassification; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetAccountTransfersTimeline timeline; public GetAccountTransfersGroups groups; @@ -400,22 +399,22 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferFromAccount() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Daniel Owusu") + @Schema(example = "Daniel Owusu") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "CTRL") + @Schema(example = "CTRL") public String productName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetAccountTransfersTemplateRefundByTransferCurrency currency; - @ApiModelProperty(example = "130") + @Schema(example = "130") public Float amtForTransfer; } @@ -423,13 +422,13 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferToClient() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Daniel Owusu") + @Schema(example = "Daniel Owusu") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -437,19 +436,19 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferToAccount() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Daniel Owusu") + @Schema(example = "Daniel Owusu") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "TEST") + @Schema(example = "TEST") public String productName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetAccountTransfersTemplateRefundByTransferCurrency currency; } @@ -458,11 +457,11 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferFromOfficeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; } @@ -470,13 +469,13 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferFromClientOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Daniel Owusu") + @Schema(example = "Daniel Owusu") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -484,27 +483,27 @@ final class AccountTransfersApiResourceSwagger { private GetAccountTransfersTemplateRefundByTransferFromAccountOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Daniel Owusu") + @Schema(example = "Daniel Owusu") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "CTRL") + @Schema(example = "CTRL") public String productName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetAccountTransfersTemplateRefundByTransferCurrency currency; } public GetAccountTransfersTemplateRefundByTransferCurrency currency; - @ApiModelProperty(example = "130") + @Schema(example = "130") public Float transferAmount; - @ApiModelProperty(example = "[2014, 11, 1]") + @Schema(example = "[2014, 11, 1]") public LocalDate transferDate; public GetAccountTransfersTemplateRefundByTransferFromOffice fromOffice; public GetAccountTransfersTemplateRefundByTransferFromClient fromClient; @@ -524,47 +523,47 @@ final class AccountTransfersApiResourceSwagger { public Set toAccountOptions; } - @ApiModel(value = "PostAccountTransfersRefundByTransferRequest") + @Schema(description = "PostAccountTransfersRefundByTransferRequest") public static final class PostAccountTransfersRefundByTransferRequest { private PostAccountTransfersRefundByTransferRequest() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer fromAccountId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromAccountType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toAccountType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toAccountId; - @ApiModelProperty(example = "130") + @Schema(example = "130") public Float transferAmount; - @ApiModelProperty(example = "31 October 2014") + @Schema(example = "31 October 2014") public String transferDate; - @ApiModelProperty(example = "Transfer refund to my savings account") + @Schema(example = "Transfer refund to my savings account") public String transferDescription; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromClientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromOfficeId; } - @ApiModel(value = "PostAccountTransfersRefundByTransferResponse") + @Schema(description = "PostAccountTransfersRefundByTransferResponse") public static final class PostAccountTransfersRefundByTransferResponse { private PostAccountTransfersRefundByTransferResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java index 64a4ea9b4..b55972a1d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.account.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Date; import java.util.Set; @@ -66,11 +65,8 @@ import org.springframework.stereotype.Component; @Path("/standinginstructions") @Component @Scope("singleton") -@Api(tags = { "Standing Instructions" }) -@SwaggerDefinition(tags = { - @Tag(name = "Standing Instructions", description = "Standing instructions (or standing orders) refer to instructions a bank account holder (\"the payer\") gives to his or her bank to pay a set amount at regular intervals to another's (\"the payee's\") account.\n" - + "\n" - + "Note: At present only savings account to savings account and savings account to Loan account transfers are permitted.") }) +@Tag(name = "Standing Instructions", description = "Standing instructions (or standing orders) refer to instructions a bank account holder (\"the payer\") gives to his or her bank to pay a set amount at regular intervals to another's (\"the payee's\") account.\n" + + "\n" + "Note: At present only savings account to savings account and savings account to Loan account transfers are permitted.") public class StandingInstructionApiResource { private final PlatformSecurityContext context; @@ -99,22 +95,23 @@ public class StandingInstructionApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Standing Instruction Template", httpMethod = "GET", notes = "This is a convenience resource. " + @Operation(summary = "Retrieve Standing Instruction Template", description = "This is a convenience resource. " + "It can be useful when building maintenance user interface screens for client applications. " + "The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Requests:\n" + "\n" + "standinginstructions/template?fromAccountType=2&fromOfficeId=1\n" + "\n" + "standinginstructions/template?fromAccountType=2&fromOfficeId=1&fromClientId=1&transferType=1\n" + "\n" + "standinginstructions/template?fromClientId=1&fromAccountType=2&fromAccountId=1&transferType=1") - @ApiResponses(@ApiResponse(code = 200, message = "OK", response = StandingInstructionApiResourceSwagger.GetStandingInstructionsTemplateResponse.class)) - public String template(@QueryParam("fromOfficeId") @ApiParam(value = "fromOfficeId") final Long fromOfficeId, - @QueryParam("fromClientId") @ApiParam(value = "fromClientId") final Long fromClientId, - @QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccountId, - @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType, - @QueryParam("toOfficeId") @ApiParam(value = "toOfficeId") final Long toOfficeId, - @QueryParam("toClientId") @ApiParam(value = "toClientId") final Long toClientId, - @QueryParam("toAccountId") @ApiParam(value = "toAccountId") final Long toAccountId, - @QueryParam("toAccountType") @ApiParam(value = "toAccountType") final Integer toAccountType, - @QueryParam("transferType") @ApiParam(value = "transferType") final Integer transferType, @Context final UriInfo uriInfo) { + @ApiResponses(@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.GetStandingInstructionsTemplateResponse.class)))) + public String template(@QueryParam("fromOfficeId") @Parameter(description = "fromOfficeId") final Long fromOfficeId, + @QueryParam("fromClientId") @Parameter(description = "fromClientId") final Long fromClientId, + @QueryParam("fromAccountId") @Parameter(description = "fromAccountId") final Long fromAccountId, + @QueryParam("fromAccountType") @Parameter(description = "fromAccountType") final Integer fromAccountType, + @QueryParam("toOfficeId") @Parameter(description = "toOfficeId") final Long toOfficeId, + @QueryParam("toClientId") @Parameter(description = "toClientId") final Long toClientId, + @QueryParam("toAccountId") @Parameter(description = "toAccountId") final Long toAccountId, + @QueryParam("toAccountType") @Parameter(description = "toAccountType") final Integer toAccountType, + @QueryParam("transferType") @Parameter(description = "transferType") final Integer transferType, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME); @@ -129,12 +126,11 @@ public class StandingInstructionApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create new Standing Instruction", httpMethod = "POST", notes = "Ability to create new instruction for transfer of monetary funds from one account to another") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = StandingInstructionApiResourceSwagger.PostStandingInstructionsRequest.class) }) + @Operation(summary = "Create new Standing Instruction", description = "Ability to create new instruction for transfer of monetary funds from one account to another") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.PostStandingInstructionsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = StandingInstructionApiResourceSwagger.PostStandingInstructionsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.PostStandingInstructionsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createStandingInstruction().withJson(apiRequestBodyAsJson) .build(); @@ -148,17 +144,17 @@ public class StandingInstructionApiResource { @Path("{standingInstructionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Standing Instruction | Delete Standing Instruction", httpMethod = "PUT", notes = "Ability to modify existing instruction for transfer of monetary funds from one account to another.\n" + @Operation(summary = "Update Standing Instruction | Delete Standing Instruction", description = "Ability to modify existing instruction for transfer of monetary funds from one account to another.\n" + "\n" + "PUT https://DomainName/api/v1/standinginstructions/1?command=update\n" + "\n\n" + "Ability to modify existing instruction for transfer of monetary funds from one account to another.\n" + "\n" + "PUT https://DomainName/api/v1/standinginstructions/1?command=delete") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = false, paramType = "body", dataType = "body", format = "body", dataTypeClass = StandingInstructionApiResourceSwagger.PutStandingInstructionsStandingInstructionIdRequest.class) }) + @RequestBody(required = false, content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.PutStandingInstructionsStandingInstructionIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = StandingInstructionApiResourceSwagger.PutStandingInstructionsStandingInstructionIdResponse.class) }) - public String update(@PathParam("standingInstructionId") @ApiParam(value = "standingInstructionId") final Long standingInstructionId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson, - @QueryParam("command") @ApiParam(value = "command") final String commandParam) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.PutStandingInstructionsStandingInstructionIdResponse.class))) }) + public String update( + @PathParam("standingInstructionId") @Parameter(description = "standingInstructionId") final Long standingInstructionId, + @Parameter(hidden = true) final String apiRequestBodyAsJson, + @QueryParam("command") @Parameter(description = "command") final String commandParam) { CommandWrapper commandRequest = null; if (is(commandParam, "update")) { @@ -185,21 +181,21 @@ public class StandingInstructionApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Standing Instructions", httpMethod = "GET", notes = "Example Requests:\n" + "\n" + "standinginstructions") + @Operation(summary = "List Standing Instructions", description = "Example Requests:\n" + "\n" + "standinginstructions") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = StandingInstructionApiResourceSwagger.GetStandingInstructionsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.GetStandingInstructionsResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("transferType") @ApiParam(value = "transferType") final Integer transferType, - @QueryParam("clientName") @ApiParam(value = "clientName") final String clientName, - @QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccount, - @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("transferType") @Parameter(description = "transferType") final Integer transferType, + @QueryParam("clientName") @Parameter(description = "clientName") final String clientName, + @QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("fromAccountId") @Parameter(description = "fromAccountId") final Long fromAccount, + @QueryParam("fromAccountType") @Parameter(description = "fromAccountType") final Integer fromAccountType) { this.context.authenticatedUser().validateHasReadPermission(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME); @@ -221,18 +217,17 @@ public class StandingInstructionApiResource { @Path("{standingInstructionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Standing Instruction", httpMethod = "GET", notes = "Example Requests :\n" + "\n" - + "standinginstructions/1") + @Operation(summary = "Retrieve Standing Instruction", description = "Example Requests :\n" + "\n" + "standinginstructions/1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = StandingInstructionApiResourceSwagger.GetStandingInstructionsStandingInstructionIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionApiResourceSwagger.GetStandingInstructionsStandingInstructionIdResponse.class))) }) public String retrieveOne( - @PathParam("standingInstructionId") @ApiParam(value = "standingInstructionId") final Long standingInstructionId, - @Context final UriInfo uriInfo, @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @PathParam("standingInstructionId") @Parameter(description = "standingInstructionId") final Long standingInstructionId, + @Context final UriInfo uriInfo, @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResourceSwagger.java index a797dccac..207d94531 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.account.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -32,7 +31,7 @@ final class StandingInstructionApiResourceSwagger { // this class is only for Swagger Live Documentation } - @ApiModel(value = "GetStandingInstructionsTemplateResponse") + @Schema(description = "GetStandingInstructionsTemplateResponse") public static final class GetStandingInstructionsTemplateResponse { private GetStandingInstructionsTemplateResponse() {} @@ -41,17 +40,17 @@ final class StandingInstructionApiResourceSwagger { private GetFromOfficeResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String decoratedName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer externalId; - @ApiModelProperty(example = "[2009, 1, 1]") + @Schema(example = "[2009, 1, 1]") public LocalDate openingDate; - @ApiModelProperty(example = ".") + @Schema(example = ".") public String hierarchy; } @@ -59,23 +58,23 @@ final class StandingInstructionApiResourceSwagger { private GetFromAccountTypeResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } static final class GetFromOfficeOptionsResponseStandingInstructionSwagger { private GetFromOfficeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; } @@ -83,13 +82,13 @@ final class StandingInstructionApiResourceSwagger { private GetFromClientOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Client_FirstName_2VRAG Client_LastName_9QCY") + @Schema(example = "Client_FirstName_2VRAG Client_LastName_9QCY") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -97,23 +96,23 @@ final class StandingInstructionApiResourceSwagger { private GetFromAccountTypeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } static final class GetToOfficeOptionsResponseStandingInstructionSwagger { private GetToOfficeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; } @@ -121,84 +120,84 @@ final class StandingInstructionApiResourceSwagger { private GetToAccountTypeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountType.loan") + @Schema(example = "accountType.loan") public String code; - @ApiModelProperty(example = "Loan Account") - public String value; + @Schema(example = "Loan Account") + public String description; } static final class GetTransferTypeOptionsResponseStandingInstructionSwagger { private GetTransferTypeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountTransferType.account.transfer") + @Schema(example = "accountTransferType.account.transfer") public String code; - @ApiModelProperty(example = "Account Transfer") - public String value; + @Schema(example = "Account Transfer") + public String description; } static final class GetStatusOptionsResponseStandingInstructionSwagger { private GetStatusOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "standingInstructionStatus.active") + @Schema(example = "standingInstructionStatus.active") public String code; - @ApiModelProperty(example = "Active") - public String value; + @Schema(example = "Active") + public String description; } static final class GetInstructionTypeOptionsResponseStandingInstructionSwagger { private GetInstructionTypeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "standingInstructionType.fixed") + @Schema(example = "standingInstructionType.fixed") public String code; - @ApiModelProperty(example = "Fixed") - public String value; + @Schema(example = "Fixed") + public String description; } static final class GetPriorityOptionsResponseStandingInstructionSwagger { private GetPriorityOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "standingInstructionPriority.urgent") + @Schema(example = "standingInstructionPriority.urgent") public String code; - @ApiModelProperty(example = "Urgent Priority") - public String value; + @Schema(example = "Urgent Priority") + public String description; } static final class GetRecurrenceTypeOptionsResponseStandingInstructionSwagger { private GetRecurrenceTypeOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountTransferRecurrenceType.periodic") + @Schema(example = "accountTransferRecurrenceType.periodic") public String code; - @ApiModelProperty(example = "Periodic Recurrence") - public String value; + @Schema(example = "Periodic Recurrence") + public String description; } static final class GetRecurrenceFrequencyOptionsResponseStandingInstructionSwagger { private GetRecurrenceFrequencyOptionsResponseStandingInstructionSwagger() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "frequencyperiodFrequencyType.days") + @Schema(example = "frequencyperiodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } public GetFromOfficeResponseStandingInstructionSwagger fromOffice; @@ -216,18 +215,18 @@ final class StandingInstructionApiResourceSwagger { public Set recurrenceFrequencyOptions; } - @ApiModel(value = "PostStandingInstructionsResponse") + @Schema(description = "PostStandingInstructionsResponse") public static final class PostStandingInstructionsResponse { private PostStandingInstructionsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long clientId; - @ApiModelProperty(example = "65") + @Schema(example = "65") public Integer resourceId; } - @ApiModel(value = "GetStandingInstructionsResponse") + @Schema(description = "GetStandingInstructionsResponse") public static final class GetStandingInstructionsResponse { private GetStandingInstructionsResponse() {} @@ -238,9 +237,9 @@ final class StandingInstructionApiResourceSwagger { private GetFromOfficeStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; } @@ -248,13 +247,13 @@ final class StandingInstructionApiResourceSwagger { private GetFromClientStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Test test") + @Schema(example = "Test test") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -262,25 +261,25 @@ final class StandingInstructionApiResourceSwagger { private GetFromAccountTypeStandingInstructionSwagger() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } static final class GetFromAccountStandingInstructionSwagger { private GetFromAccountStandingInstructionSwagger() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Long id; - @ApiModelProperty(example = "000000014") + @Schema(example = "000000014") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long productId; - @ApiModelProperty(example = "savings old") + @Schema(example = "savings old") public String productName; } @@ -288,9 +287,9 @@ final class StandingInstructionApiResourceSwagger { private GetToOfficeStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; } @@ -298,13 +297,13 @@ final class StandingInstructionApiResourceSwagger { private GetToClientStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Test test") + @Schema(example = "Test test") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -312,25 +311,25 @@ final class StandingInstructionApiResourceSwagger { private GetToAccountTypeStandingInstructionSwagger() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } static final class GetToAccountStandingInstructionSwagger { private GetToAccountStandingInstructionSwagger() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long id; - @ApiModelProperty(example = "000000003") + @Schema(example = "000000003") public Long accountNo; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Long productId; - @ApiModelProperty(example = "account overdraft") + @Schema(example = "account overdraft") public String productName; } @@ -338,79 +337,79 @@ final class StandingInstructionApiResourceSwagger { private GetTransferTypeStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountTransferType.account.transfer") + @Schema(example = "accountTransferType.account.transfer") public String code; - @ApiModelProperty(example = "Account Transfer") - public String value; + @Schema(example = "Account Transfer") + public String description; } static final class GetPriorityStandingInstructionSwagger { private GetPriorityStandingInstructionSwagger() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "standingInstructionPriority.medium") + @Schema(example = "standingInstructionPriority.medium") public String code; - @ApiModelProperty(example = "Medium Priority") - public String value; + @Schema(example = "Medium Priority") + public String description; } static final class GetInstructionTypeStandingInstructionSwagger { private GetInstructionTypeStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "standingInstructionType.fixed") + @Schema(example = "standingInstructionType.fixed") public String code; - @ApiModelProperty(example = "Fixed") - public String value; + @Schema(example = "Fixed") + public String description; } static final class GetStatusStandingInstructionSwagger { private GetStatusStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "standingInstructionStatus.deleted") + @Schema(example = "standingInstructionStatus.deleted") public String code; - @ApiModelProperty(example = "Deleted") - public String value; + @Schema(example = "Deleted") + public String description; } static final class GetRecurrenceTypeStandingInstructionSwagger { private GetRecurrenceTypeStandingInstructionSwagger() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountTransferRecurrenceType.periodic") + @Schema(example = "accountTransferRecurrenceType.periodic") public String code; - @ApiModelProperty(example = "Periodic Recurrence") - public String value; + @Schema(example = "Periodic Recurrence") + public String description; } static final class GetRecurrenceFrequencyStandingInstructionSwagger { private GetRecurrenceFrequencyStandingInstructionSwagger() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "frequencyperiodFrequencyType.months") + @Schema(example = "frequencyperiodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Long accountDetailId; - @ApiModelProperty(example = "test standing") + @Schema(example = "test standing") public String name; public GetFromOfficeStandingInstructionSwagger fromOffice; public GetFromClientStandingInstructionSwagger fromClient; @@ -424,84 +423,84 @@ final class StandingInstructionApiResourceSwagger { public GetPriorityStandingInstructionSwagger priority; public GetInstructionTypeStandingInstructionSwagger instructionType; public GetStatusStandingInstructionSwagger status; - @ApiModelProperty(example = "150.000000") + @Schema(example = "150.000000") public float amount; - @ApiModelProperty(example = "[2014, 4, 3]") + @Schema(example = "[2014, 4, 3]") public LocalDate validFrom; public GetRecurrenceTypeStandingInstructionSwagger recurrenceType; public GetRecurrenceFrequencyStandingInstructionSwagger recurrenceFrequency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurrenceInterval; - @ApiModelProperty(example = "[4, 3]") + @Schema(example = "[4, 3]") public LocalDate recurrenceOnMonthDay; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "PostStandingInstructionsRequest") + @Schema(description = "PostStandingInstructionsRequest") public static final class PostStandingInstructionsRequest { private PostStandingInstructionsRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long fromOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long fromClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer fromAccountType; - @ApiModelProperty(example = "standing instruction") + @Schema(example = "standing instruction") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transferType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer priority; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer status; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long fromAccountId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long toOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long toClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toAccountType; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Long toAccountId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer instructionType; - @ApiModelProperty(example = "221") + @Schema(example = "221") public Integer amount; - @ApiModelProperty(example = "08 April 2014") + @Schema(example = "08 April 2014") public String validFrom; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurrenceType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurrenceInterval; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer recurrenceFrequency; - @ApiModelProperty(value = "en") + @Schema(description = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "02 April") + @Schema(example = "02 April") public String recurrenceOnMonthDay; - @ApiModelProperty(example = "dd MMMM") + @Schema(example = "dd MMMM") public String monthDayFormat; } - @ApiModel(value = "GetStandingInstructionsStandingInstructionIdResponse") + @Schema(description = "GetStandingInstructionsStandingInstructionIdResponse") public static final class GetStandingInstructionsStandingInstructionIdResponse { private GetStandingInstructionsStandingInstructionIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Long accountDetailId; - @ApiModelProperty(example = "test standing") + @Schema(example = "test standing") public String name; public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetFromOfficeStandingInstructionSwagger fromOffice; public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetFromClientStandingInstructionSwagger fromClient; @@ -515,40 +514,40 @@ final class StandingInstructionApiResourceSwagger { public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetPriorityStandingInstructionSwagger priority; public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetInstructionTypeStandingInstructionSwagger instructionType; public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetStatusStandingInstructionSwagger status; - @ApiModelProperty(example = "150.000000") + @Schema(example = "150.000000") public float amount; - @ApiModelProperty(example = "[2014, 4, 3]") + @Schema(example = "[2014, 4, 3]") public LocalDate validFrom; public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetRecurrenceTypeStandingInstructionSwagger recurrenceType; public GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetRecurrenceFrequencyStandingInstructionSwagger recurrenceFrequency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurrenceInterval; - @ApiModelProperty(example = "[4, 3]") + @Schema(example = "[4, 3]") public LocalDate recurrenceOnMonthDay; } - @ApiModel(value = "PutStandingInstructionsStandingInstructionIdResponse") + @Schema(description = "PutStandingInstructionsStandingInstructionIdResponse") public static final class PutStandingInstructionsStandingInstructionIdResponse { private PutStandingInstructionsStandingInstructionIdResponse() {} static final class PutUpdateStandingInstructionChanges { - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer recurrenceInterval; } - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer resourceId; public PutUpdateStandingInstructionChanges changes; } - @ApiModel(value = "PutStandingInstructionsStandingInstructionIdRequest") + @Schema(description = "PutStandingInstructionsStandingInstructionIdRequest") public static final class PutStandingInstructionsStandingInstructionIdRequest { private PutStandingInstructionsStandingInstructionIdRequest() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer recurrenceInterval; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java index 40bab77fb..a2ee50e19 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.portfolio.account.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 java.util.Date; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -51,9 +51,7 @@ import org.springframework.stereotype.Component; @Path("/standinginstructionrunhistory") @Component @Scope("singleton") -@Api(tags = { "Standing Instructions History" }) -@SwaggerDefinition(tags = { - @Tag(name = "Standing Instructions History", description = "The list capability of history can support pagination and sorting.") }) +@Tag(name = "Standing Instructions History", description = "The list capability of history can support pagination and sorting.") public class StandingInstructionHistoryApiResource { private final PlatformSecurityContext context; @@ -75,27 +73,27 @@ public class StandingInstructionHistoryApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Standing Instructions Logged History", httpMethod = "GET", notes = "The list capability of history can support pagination and sorting \n\n" + @Operation(summary = "Standing Instructions Logged History", description = "The list capability of history can support pagination and sorting \n\n" + "Example Requests :\n" + "\n" + "standinginstructionrunhistory\n" + "\n" + "standinginstructionrunhistory?orderBy=name&sortOrder=DESC\n" + "\n" + "standinginstructionrunhistory?offset=10&limit=50") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = StandingInstructionHistoryApiResourceSwagger.GetStandingInstructionRunHistoryResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StandingInstructionHistoryApiResourceSwagger.GetStandingInstructionRunHistoryResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("transferType") @ApiParam(value = "transferType") final Integer transferType, - @QueryParam("clientName") @ApiParam(value = "clientName") final String clientName, - @QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccount, - @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType, - @QueryParam("locale") @ApiParam(value = "locale") final String locale, - @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat, - @QueryParam("fromDate") @ApiParam(value = "fromDate") final DateParam fromDateParam, - @QueryParam("toDate") @ApiParam(value = "toDate") final DateParam toDateParam) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("transferType") @Parameter(description = "transferType") final Integer transferType, + @QueryParam("clientName") @Parameter(description = "clientName") final String clientName, + @QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("fromAccountId") @Parameter(description = "fromAccountId") final Long fromAccount, + @QueryParam("fromAccountType") @Parameter(description = "fromAccountType") final Integer fromAccountType, + @QueryParam("locale") @Parameter(description = "locale") final String locale, + @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat, + @QueryParam("fromDate") @Parameter(description = "fromDate") final DateParam fromDateParam, + @QueryParam("toDate") @Parameter(description = "toDate") final DateParam toDateParam) { this.context.authenticatedUser().validateHasReadPermission(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResourceSwagger.java index 7a97bfcca..1aa405689 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.account.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class StandingInstructionHistoryApiResourceSwagger { private StandingInstructionHistoryApiResourceSwagger() {} - @ApiModel(value = "GetStandingInstructionRunHistoryResponse") + @Schema(description = "GetStandingInstructionRunHistoryResponse") public static final class GetStandingInstructionRunHistoryResponse { private GetStandingInstructionRunHistoryResponse() {} @@ -41,13 +40,13 @@ final class StandingInstructionHistoryApiResourceSwagger { private GetStandingInstructionHistoryPageItemsFromClient() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Test client") + @Schema(example = "Test client") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -55,13 +54,13 @@ final class StandingInstructionHistoryApiResourceSwagger { private GetStandingInstructionHistoryFromAccount() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Long id; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long productId; - @ApiModelProperty(example = "General Savings") + @Schema(example = "General Savings") public String productName; } @@ -69,13 +68,13 @@ final class StandingInstructionHistoryApiResourceSwagger { private GetStandingInstructionHistoryToAccount() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long productId; - @ApiModelProperty(example = "General Savings") + @Schema(example = "General Savings") public String productName; } @@ -83,19 +82,19 @@ final class StandingInstructionHistoryApiResourceSwagger { private GetStandingInstructionHistoryToClient() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Test client") + @Schema(example = "Test client") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long standingInstructionId; - @ApiModelProperty(example = "ACC Transfer") + @Schema(example = "ACC Transfer") public String name; public StandingInstructionApiResourceSwagger.GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetFromOfficeStandingInstructionSwagger fromOffice; public GetStandingInstructionHistoryPageItemsFromClient fromClient; @@ -105,17 +104,17 @@ final class StandingInstructionHistoryApiResourceSwagger { public GetStandingInstructionHistoryToAccount toAccount; public StandingInstructionApiResourceSwagger.GetStandingInstructionsResponse.GetPageItemsStandingInstructionSwagger.GetToOfficeStandingInstructionSwagger toOffice; public GetStandingInstructionHistoryToClient toClient; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Float amount; - @ApiModelProperty(example = "success") + @Schema(example = "success") public String status; - @ApiModelProperty(example = "[2014, 6, 30]") + @Schema(example = "[2014, 6, 30]") public LocalDate executionTime; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String errorLog; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer totalFilteredRecords; public Set pageItems; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java index fbc68f55d..46b0077ac 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java @@ -20,15 +20,14 @@ package org.apache.fineract.portfolio.accounts.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -67,9 +66,7 @@ import org.springframework.stereotype.Component; @Path("/accounts/{type}") @Component @Scope("singleton") -@Api(tags = { "Share Account" }) -@SwaggerDefinition(tags = { - @Tag(name = "Share Account", description = "Share accounts are instances of a praticular share product created for an individual. An application process around the creation of accounts is also supported.") }) +@Tag(name = "Share Account", description = "Share accounts are instances of a praticular share product created for an individual. An application process around the creation of accounts is also supported.") public class AccountsApiResource { private final ApplicationContext applicationContext; @@ -99,13 +96,14 @@ public class AccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Share Account Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Share Account Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n\n" + "Example Requests:\n" + "\n" + "accounts/share/template?clientId=1\n" + "\n" + "\n" + "accounts/share/template?clientId=1&productId=1") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = AccountsApiResourceSwagger.GetAccountsTypeTemplateResponse.class) }) - public String template(@PathParam("type") @ApiParam(value = "type") final String accountType, - @QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.GetAccountsTypeTemplateResponse.class))) }) + public String template(@PathParam("type") @Parameter(description = "type") final String accountType, + @QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, @Context final UriInfo uriInfo) { try { this.platformSecurityContext.authenticatedUser(); String serviceName = accountType + AccountsApiConstants.READPLATFORM_NAME; @@ -122,12 +120,12 @@ public class AccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a share application/account", httpMethod = "GET", notes = "Retrieves a share application/account\n\n" + @Operation(summary = "Retrieve a share application/account", description = "Retrieves a share application/account\n\n" + "Example Requests :\n" + "\n" + "shareaccount/1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountsApiResourceSwagger.GetAccountsTypeAccountIdResponse.class) }) - public String retrieveAccount(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @PathParam("type") @ApiParam(value = "type") final String accountType, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.GetAccountsTypeAccountIdResponse.class))) }) + public String retrieveAccount(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @PathParam("type") @Parameter(description = "type") final String accountType, @Context final UriInfo uriInfo) { try { String serviceName = accountType + AccountsApiConstants.READPLATFORM_NAME; final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -142,12 +140,13 @@ public class AccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List share applications/accounts", httpMethod = "GET", notes = "Lists share applications/accounts\n\n" - + "Example Requests:\n" + "\n" + "shareaccount") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = AccountsApiResourceSwagger.GetAccountsTypeResponse.class) }) - public String retrieveAllAccounts(@PathParam("type") @ApiParam(value = "type") final String accountType, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, @Context final UriInfo uriInfo) { + @Operation(summary = "List share applications/accounts", description = "Lists share applications/accounts\n\n" + "Example Requests:\n" + + "\n" + "shareaccount") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.GetAccountsTypeResponse.class))) }) + public String retrieveAllAccounts(@PathParam("type") @Parameter(description = "type") final String accountType, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, @Context final UriInfo uriInfo) { try { String serviceName = accountType + AccountsApiConstants.READPLATFORM_NAME; AccountReadPlatformService service = (AccountReadPlatformService) this.applicationContext.getBean(serviceName); @@ -162,15 +161,15 @@ public class AccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Submit new share application", httpMethod = "POST", notes = "Submits new share application\n\n" + @Operation(summary = "Submit new share application", description = "Submits new share application\n\n" + "Mandatory Fields: clientId, productId, submittedDate, savingsAccountId, requestedShares, applicationDate\n\n" + "Optional Fields: accountNo, externalId\n\n" + "Inherited from Product (if not provided): minimumActivePeriod, minimumActivePeriodFrequencyType, lockinPeriodFrequency, lockinPeriodFrequencyType") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountsApiResourceSwagger.PostAccountsTypeRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = AccountsApiResourceSwagger.PostAccountsTypeResponse.class) }) - public String createAccount(@PathParam("type") @ApiParam(value = "type") final String accountType, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PostAccountsTypeRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PostAccountsTypeResponse.class))) }) + public String createAccount(@PathParam("type") @Parameter(description = "type") final String accountType, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = null; this.platformSecurityContext.authenticatedUser(); commandWrapper = new CommandWrapperBuilder().createAccount(accountType).withJson(apiRequestBodyAsJson).build(); @@ -182,7 +181,7 @@ public class AccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve share application | Undo approval share application | Reject share application | Activate a share account | Close a share account | Apply additional shares on a share account | Approve additional shares request on a share account | Reject additional shares request on a share account | Redeem shares on a share account", httpMethod = "POST", notes = "Approve share application:\n\n" + @Operation(summary = "Approve share application | Undo approval share application | Reject share application | Activate a share account | Close a share account | Apply additional shares on a share account | Approve additional shares request on a share account | Reject additional shares request on a share account | Redeem shares on a share account", description = "Approve share application:\n\n" + "Approves share application so long as its in 'Submitted and pending approval' state.\n\n" + "Undo approval share application:\n\n" + "Will move 'approved' share application back to 'Submitted and pending approval' state.\n\n" + "Reject share application:\n\n" @@ -201,14 +200,13 @@ public class AccountsApiResource { + "Mandatory Fields: dateFormat,locale,requestedDate,requestedShares\n\n" + "Showing request/response for 'Reject additional shares request on a share account'\n\n" + "For more info visit this link - https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm#shareaccounts") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountsApiResourceSwagger.PostAccountsTypeAccountIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PostAccountsTypeAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountsApiResourceSwagger.PostAccountsTypeAccountIdResponse.class) }) - public String handleCommands(@PathParam("type") @ApiParam(value = "type") final String accountType, - @PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PostAccountsTypeAccountIdResponse.class))) }) + public String handleCommands(@PathParam("type") @Parameter(description = "type") final String accountType, + @PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = null; this.platformSecurityContext.authenticatedUser(); commandWrapper = new CommandWrapperBuilder().createAccountCommand(accountType, accountId, commandParam) @@ -221,14 +219,13 @@ public class AccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Modify a share application", httpMethod = "PUT", notes = "Share application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountsApiResourceSwagger.PutAccountsTypeAccountIdRequest.class) }) + @Operation(summary = "Modify a share application", description = "Share application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PutAccountsTypeAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = AccountsApiResourceSwagger.PutAccountsTypeAccountIdResponse.class) }) - public String updateAccount(@PathParam("type") @ApiParam(value = "type") final String accountType, - @PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PutAccountsTypeAccountIdResponse.class))) }) + public String updateAccount(@PathParam("type") @Parameter(description = "type") final String accountType, + @PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { this.platformSecurityContext.authenticatedUser(); final CommandWrapper commandRequest = new CommandWrapperBuilder().updateAccount(accountType, accountId) .withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResourceSwagger.java index b680846de..8be974be8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.accounts.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.List; import java.util.Set; @@ -31,7 +30,7 @@ final class AccountsApiResourceSwagger { private AccountsApiResourceSwagger() {} - @ApiModel(value = "GetAccountsTypeTemplateResponse") + @Schema(description = "GetAccountsTypeTemplateResponse") public static final class GetAccountsTypeTemplateResponse { private GetAccountsTypeTemplateResponse() {} @@ -40,24 +39,24 @@ final class AccountsApiResourceSwagger { private GetAccountsTypeProductOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Share Product") + @Schema(example = "Share Product") public String name; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String shortName; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Long totalShares; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer clientId; - @ApiModelProperty(example = "Client Name") + @Schema(example = "Client Name") public String clientName; public Set productOptions; } - @ApiModel(value = "GetAccountsTypeAccountIdResponse") + @Schema(description = "GetAccountsTypeAccountIdResponse") public static final class GetAccountsTypeAccountIdResponse { private GetAccountsTypeAccountIdResponse() {} @@ -66,21 +65,21 @@ final class AccountsApiResourceSwagger { private GetAccountsStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "shareAccountStatusType.active") + @Schema(example = "shareAccountStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Active") + public String description; + @Schema(example = "false") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } @@ -88,23 +87,23 @@ final class AccountsApiResourceSwagger { private GetAccountsTimeline() {} - @ApiModelProperty(example = "[2016, 4, 1]") + @Schema(example = "[2016, 4, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; - @ApiModelProperty(example = "[2016, 4, 1]") + @Schema(example = "[2016, 4, 1]") public LocalDate approvedDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String approvedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String approvedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String approvedByLastname; - @ApiModelProperty(example = "[2016, 4, 1]") + @Schema(example = "[2016, 4, 1]") public LocalDate activatedDate; } @@ -112,19 +111,19 @@ final class AccountsApiResourceSwagger { private GetAccountsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -132,17 +131,17 @@ final class AccountsApiResourceSwagger { private GetAccountsSummary() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer totalApprovedShares; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer totalPendingForApprovalShares; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "Conflux Share Product") + @Schema(example = "Conflux Share Product") public String productName; public GetAccountsStatus status; public GetAccountsTimeline timeline; @@ -157,43 +156,43 @@ final class AccountsApiResourceSwagger { private GetAccountsPurchasedSharesStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "purchasedSharesStatusType.approved") + @Schema(example = "purchasedSharesStatusType.approved") public String code; - @ApiModelProperty(example = "Approved") - public String value; + @Schema(example = "Approved") + public String description; } static final class GetAccountsPurchasedSharesType { private GetAccountsPurchasedSharesType() {} - @ApiModelProperty(example = "500") + @Schema(example = "500") public Integer id; - @ApiModelProperty(example = "purchasedSharesType.purchased") + @Schema(example = "purchasedSharesType.purchased") public String code; - @ApiModelProperty(example = "Purchase") - public String value; + @Schema(example = "Purchase") + public String description; } - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer id; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer accountId; - @ApiModelProperty(example = "[2016, 4, 1]") + @Schema(example = "[2016, 4, 1]") public LocalDate purchasedDate; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer numberOfShares; - @ApiModelProperty(example = "0.5") + @Schema(example = "0.5") public Double purchasedPrice; public GetAccountsPurchasedSharesStatus status; public GetAccountsPurchasedSharesType type; - @ApiModelProperty(example = "5.05") + @Schema(example = "5.05") public Double amount; - @ApiModelProperty(example = "0.05") + @Schema(example = "0.05") public Double chargeAmount; - @ApiModelProperty(example = "5.05") + @Schema(example = "5.05") public Double amountPaid; } @@ -201,12 +200,12 @@ final class AccountsApiResourceSwagger { private GetAccountsLockPeriodTypeEnum() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "savings.lockin.sharePeriodFrequencyType.days") + @Schema(example = "savings.lockin.sharePeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetAccountsCharges { @@ -217,112 +216,112 @@ final class AccountsApiResourceSwagger { private GetAccountsChargeTimeType() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; - @ApiModelProperty(example = "chargeTimeType.activation") + @Schema(example = "chargeTimeType.activation") public String code; - @ApiModelProperty(example = "Share Account Activate") - public String value; + @Schema(example = "Share Account Activate") + public String description; } static final class GetAccountsChargeCalculationType { private GetAccountsChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetAccountsChargesCurrency { private GetAccountsChargesCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer id; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer chargeId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer accountId; - @ApiModelProperty(example = "Share Account Activation Flat") + @Schema(example = "Share Account Activation Flat") public String name; public GetAccountsChargeTimeType chargeTimeType; public GetAccountsChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetAccountsChargesCurrency currency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Float amount; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountOutstanding; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Float amountOrPercentage; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Long accountNo; - @ApiModelProperty(example = "000000013") + @Schema(example = "000000013") public Long savingsAccountNumber; - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer clientId; - @ApiModelProperty(example = "Client_FirstName_2KX8C Client_LastName_NWNG") + @Schema(example = "Client_FirstName_2KX8C Client_LastName_NWNG") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "Share Product") + @Schema(example = "Share Product") public String productName; public GetAccountsStatus status; public GetAccountsTimeline timeline; public GetAccountsCurrency currency; public GetAccountsSummary summary; public Set purchasedShares; - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer savingsAccountId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer currentMarketPrice; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer lockinPeriod; public GetAccountsLockPeriodTypeEnum lockPeriodTypeEnum; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minimumActivePeriod; public GetAccountsLockPeriodTypeEnum minimumActivePeriodTypeEnum; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean allowDividendCalculationForInactiveClients; public Set charges; - @ApiModelProperty(example = "") + @Schema(example = "") public List dividends; } - @ApiModel(value = "GetAccountsTypeResponse") + @Schema(description = "GetAccountsTypeResponse") public static final class GetAccountsTypeResponse { private GetAccountsTypeResponse() {} @@ -335,21 +334,21 @@ final class AccountsApiResourceSwagger { private GetAccountsTypeStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "shareAccountStatusType.submitted.and.pending.approval") + @Schema(example = "shareAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } @@ -357,7 +356,7 @@ final class AccountsApiResourceSwagger { private GetAccountsTypeTimeline() {} - @ApiModelProperty(example = "[2013, 3, 1]") + @Schema(example = "[2013, 3, 1]") public LocalDate submittedOnDate; } @@ -365,13 +364,13 @@ final class AccountsApiResourceSwagger { private GetAccountsTypePurchasedShares() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "01 May 2013") + @Schema(example = "01 May 2013") public String purchasedDate; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer numberOfShares; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer purchasedPrice; } @@ -382,17 +381,17 @@ final class AccountsApiResourceSwagger { public GetAccountsTypeAccountIdResponse.GetAccountsCharges.GetAccountsChargesCurrency currency; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Client Name") + @Schema(example = "Client Name") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "Share Product Name") + @Schema(example = "Share Product Name") public String productName; public GetAccountsTypeStatus status; public GetAccountsTypeTimeline timeline; @@ -401,12 +400,12 @@ final class AccountsApiResourceSwagger { public GetAccountsTypeSummary summary; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "PostAccountsTypeRequest") + @Schema(description = "PostAccountsTypeRequest") public static final class PostAccountsTypeRequest { private PostAccountsTypeRequest() {} @@ -415,53 +414,53 @@ final class AccountsApiResourceSwagger { private PostAccountsCharges() {} - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer chargeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amount; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer requestedShares; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer externalId; - @ApiModelProperty(example = "01 May 2016") + @Schema(example = "01 May 2016") public String submittedDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minimumActivePeriod; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer minimumActivePeriodFrequencyType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer lockinPeriodFrequency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer lockinPeriodFrequencyType; - @ApiModelProperty(example = "01 May 2016") + @Schema(example = "01 May 2016") public String applicationDate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean allowDividendCalculationForInactiveClients; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; public Set charges; - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer savingsAccountId; } - @ApiModel(value = "PostAccountsTypeResponse") + @Schema(description = "PostAccountsTypeResponse") public static final class PostAccountsTypeResponse { private PostAccountsTypeResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PostAccountsTypeAccountIdRequest") + @Schema(description = "PostAccountsTypeAccountIdRequest") public static final class PostAccountsTypeAccountIdRequest { private PostAccountsTypeAccountIdRequest() {} @@ -470,38 +469,38 @@ final class AccountsApiResourceSwagger { private PostAccountsRequestedShares() {} - @ApiModelProperty(example = "35") + @Schema(example = "35") public Integer id; } public Set requestedShares; } - @ApiModel(value = "PostAccountsTypeAccountIdResponse") + @Schema(description = "PostAccountsTypeAccountIdResponse") public static final class PostAccountsTypeAccountIdResponse { private PostAccountsTypeAccountIdResponse() {} - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer resourceId; } - @ApiModel(value = "PutAccountsTypeAccountIdRequest") + @Schema(description = "PutAccountsTypeAccountIdRequest") public static final class PutAccountsTypeAccountIdRequest { private PutAccountsTypeAccountIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 April 2016") + @Schema(example = "01 April 2016") public String applicationDate; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer requestedShares; } - @ApiModel(value = "PutAccountsTypeAccountIdResponse") + @Schema(description = "PutAccountsTypeAccountIdResponse") public static final class PutAccountsTypeAccountIdResponse { private PutAccountsTypeAccountIdResponse() {} @@ -510,17 +509,17 @@ final class AccountsApiResourceSwagger { private PutAccountsChanges() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 April 2016") + @Schema(example = "01 April 2016") public String applicationDate; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer requestedShares; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutAccountsChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java index 42f9f9393..f8a08f1d8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.portfolio.address.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -52,11 +53,9 @@ import org.springframework.stereotype.Component; @Path("/fieldconfiguration/{entity}") @Component @Scope("singleton") -@Api(tags = { "Entity Field Configuration" }) -@SwaggerDefinition(tags = { - @Tag(name = "Entity Field Configuration", description = "Entity Field configuration API is a generic and extensible \n" - + "wherein various entities and subentities can be related.\n" - + "Also it gives the user an ability to enable/disable fields,\n" + "add regular expression for validation") }) +@Tag(name = "Entity Field Configuration", description = "Entity Field configuration API is a generic and extensible \n" + + "wherein various entities and subentities can be related.\n" + "Also it gives the user an ability to enable/disable fields,\n" + + "add regular expression for validation") public class EntityFieldConfigurationApiResources { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -88,10 +87,11 @@ public class EntityFieldConfigurationApiResources { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(httpMethod = "GET", value = "Retrieves the Entity Field Configuration", notes = "It retrieves all the Entity Field Configuration") + @Operation(summary = "Retrieves the Entity Field Configuration", description = "It retrieves all the Entity Field Configuration") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = EntityFieldConfigurationApiResourcesSwagger.GetFieldConfigurationEntityResponse.class, responseContainer = "List") }) - public String getAddresses(@PathParam("entity") @ApiParam(value = "entity") final String entityname, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EntityFieldConfigurationApiResourcesSwagger.GetFieldConfigurationEntityResponse.class)))) }) + public String getAddresses(@PathParam("entity") @Parameter(description = "entity") final String entityname, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); final Collection fldconfig = this.readPlatformServicefld.retrieveFieldConfiguration(entityname); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResourcesSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResourcesSwagger.java index 9a1e3bd7c..5eaa1a89a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResourcesSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResourcesSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.address.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by Chirag Gupta on 12/01/17. @@ -28,24 +27,24 @@ final class EntityFieldConfigurationApiResourcesSwagger { private EntityFieldConfigurationApiResourcesSwagger() {} - @ApiModel(value = "GetFieldConfigurationEntityResponse") + @Schema(description = "GetFieldConfigurationEntityResponse") public static final class GetFieldConfigurationEntityResponse { private GetFieldConfigurationEntityResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fieldConfigurationId; - @ApiModelProperty(example = "ADDRESS") + @Schema(example = "ADDRESS") public String entity; - @ApiModelProperty(example = "CLIENT") + @Schema(example = "CLIENT") public String subentity; - @ApiModelProperty(example = "addressType") + @Schema(example = "addressType") public String field; - @ApiModelProperty(example = "true") + @Schema(example = "true") public String is_enabled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public String is_mandatory; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String validation_regex; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java index ee33f9313..db0e23216 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.charge.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -59,11 +59,9 @@ import org.springframework.stereotype.Component; @Path("/charges") @Component @Scope("singleton") -@Api(tags = { "Charges" }) -@SwaggerDefinition(tags = { - @Tag(name = "Charges", description = "Its typical for MFIs to add extra costs for their financial products. These are typically Fees or Penalties.\n" - + "\n" + "A Charge on fineract platform is what we use to model both Fees and Penalties.\n" + "\n" - + "At present we support defining charges for use with Client accounts and both loan and saving products.") }) +@Tag(name = "Charges", description = "Its typical for MFIs to add extra costs for their financial products. These are typically Fees or Penalties.\n" + + "\n" + "A Charge on fineract platform is what we use to model both Fees and Penalties.\n" + "\n" + + "At present we support defining charges for use with Client accounts and both loan and saving products.") public class ChargesApiResource { private final Set CHARGES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "amount", "currency", "penalty", "active", @@ -94,10 +92,10 @@ public class ChargesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Charges", httpMethod = "GET", notes = "Returns the list of defined charges.\n" + "\n" - + "Example Requests:\n" + "\n" + "charges") + @Operation(summary = "Retrieve Charges", description = "Returns the list of defined charges.\n" + "\n" + "Example Requests:\n" + "\n" + + "charges") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ChargesApiResourceSwagger.GetChargesResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ChargesApiResourceSwagger.GetChargesResponse.class)))) }) public String retrieveAllCharges(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -112,10 +110,12 @@ public class ChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Charge", httpMethod = "GET", notes = "Returns the details of a defined Charge.\n" + "\n" - + "Example Requests:\n" + "\n" + "charges/1") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ChargesApiResourceSwagger.GetChargesResponse.class) }) - public String retrieveCharge(@PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId, @Context final UriInfo uriInfo) { + @Operation(summary = "Retrieve a Charge", description = "Returns the details of a defined Charge.\n" + "\n" + "Example Requests:\n" + + "\n" + "charges/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.GetChargesResponse.class))) }) + public String retrieveCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -134,9 +134,10 @@ public class ChargesApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Charge Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "charges/template\n") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ChargesApiResourceSwagger.GetChargesTemplateResponse.class) }) + @Operation(summary = "Retrieve Charge Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "charges/template\n") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.GetChargesTemplateResponse.class))) }) public String retrieveNewChargeDetails(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -150,11 +151,11 @@ public class ChargesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create/Define a Charge", httpMethod = "POST", notes = "Define a new charge that can later be associated with loans and savings through their respective product definitions or directly on each account instance.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ChargesApiResourceSwagger.PostChargesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ChargesApiResourceSwagger.PostChargesResponse.class) }) - public String createCharge(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create/Define a Charge", description = "Define a new charge that can later be associated with loans and savings through their respective product definitions or directly on each account instance.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PostChargesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PostChargesResponse.class))) }) + public String createCharge(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createCharge().withJson(apiRequestBodyAsJson).build(); @@ -167,12 +168,12 @@ public class ChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Charge", httpMethod = "PUT", notes = "Updates the details of a Charge.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ChargesApiResourceSwagger.PutChargesChargeIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ChargesApiResourceSwagger.PutChargesChargeIdResponse.class) }) - public String updateCharge(@PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Charge", description = "Updates the details of a Charge.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PutChargesChargeIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.PutChargesChargeIdResponse.class))) }) + public String updateCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCharge(chargeId).withJson(apiRequestBodyAsJson).build(); @@ -185,9 +186,10 @@ public class ChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Charge", httpMethod = "DELETE", notes = "Deletes a Charge.") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ChargesApiResourceSwagger.DeleteChargesChargeIdResponse.class) }) - public String deleteCharge(@PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId) { + @Operation(summary = "Delete a Charge", description = "Deletes a Charge.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ChargesApiResourceSwagger.DeleteChargesChargeIdResponse.class))) }) + public String deleteCharge(@PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCharge(chargeId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResourceSwagger.java index fa567151f..c832dc0b1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.charge.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -27,24 +26,24 @@ import java.util.Set; */ final class ChargesApiResourceSwagger { - @ApiModel(value = "GetChargesResponse") + @Schema(description = "GetChargesResponse") public static final class GetChargesResponse { private GetChargesResponse() {} static final class GetChargesCurrencyResponse { - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -52,60 +51,60 @@ final class ChargesApiResourceSwagger { private GetChargesTimeTypeResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeTimeType.disbursement") + @Schema(example = "chargeTimeType.disbursement") public String code; - @ApiModelProperty(example = "Disbursement") - public String value; + @Schema(example = "Disbursement") + public String description; } static final class GetChargesAppliesToResponse { private GetChargesAppliesToResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.loan") + @Schema(example = "chargeAppliesTo.loan") public String code; - @ApiModelProperty(example = "Loan") - public String value; + @Schema(example = "Loan") + public String description; } static final class GetChargesCalculationTypeResponse { private GetChargesCalculationTypeResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetChargesPaymentModeResponse { private GetChargesPaymentModeResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.accounttransfer") + @Schema(example = "chargepaymentmode.accounttransfer") public String code; - @ApiModelProperty(example = "Account Transfer") - public String value; + @Schema(example = "Account Transfer") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Loan Service fee") + @Schema(example = "Loan Service fee") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public String active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public String penalty; public GetChargesCurrencyResponse currency; - @ApiModelProperty(example = "230.56") + @Schema(example = "230.56") public Float amount; public GetChargesTimeTypeResponse chargeTimeType; public GetChargesAppliesToResponse chargeAppliesTo; @@ -113,69 +112,69 @@ final class ChargesApiResourceSwagger { public GetChargesPaymentModeResponse chargePaymentMode; } - @ApiModel(value = "PostChargesRequest") + @Schema(description = "PostChargesRequest") public static final class PostChargesRequest { private PostChargesRequest() {} - @ApiModelProperty(example = "Loan Service fee") + @Schema(example = "Loan Service fee") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeAppliesTo; - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "230.56") + @Schema(example = "230.56") public Float amount; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeTimeType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeCalculationType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargePaymentMode; - @ApiModelProperty(example = "true") + @Schema(example = "true") public String active; } - @ApiModel(value = "PostChargesResponse") + @Schema(description = "PostChargesResponse") public static final class PostChargesResponse { private PostChargesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutChargesChargeIdRequest") + @Schema(description = "PutChargesChargeIdRequest") public static final class PutChargesChargeIdRequest { private PutChargesChargeIdRequest() {} - @ApiModelProperty(example = "Loan service fee(changed)") + @Schema(example = "Loan service fee(changed)") public String name; } - @ApiModel(value = "PutChargesChargeIdResponse") + @Schema(description = "PutChargesChargeIdResponse") public static final class PutChargesChargeIdResponse { private PutChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutChargesChargeIdRequest changes; } - @ApiModel(value = "DeleteChargesChargeIdResponse") + @Schema(description = "DeleteChargesChargeIdResponse") public static final class DeleteChargesChargeIdResponse { private DeleteChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetChargesTemplateResponse") + @Schema(description = "GetChargesTemplateResponse") public static final class GetChargesTemplateResponse { private GetChargesTemplateResponse() {} @@ -184,41 +183,41 @@ final class ChargesApiResourceSwagger { private GetChargesTemplateLoanChargeCalculationTypeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetChargesTemplateLoanChargeTimeTypeOptions { private GetChargesTemplateLoanChargeTimeTypeOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetChargesTemplateFeeFrequencyOptions { private GetChargesTemplateFeeFrequencyOptions() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "loanTermFrequency.periodFrequencyType.days") + @Schema(example = "loanTermFrequency.periodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } - @ApiModelProperty(example = "false") + @Schema(example = "false") public String active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public String penalty; public Set currencyOptions; public Set chargeCalculationTypeOptions; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java index a88655064..14fd5b9a3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -59,9 +59,7 @@ import org.springframework.stereotype.Component; @Path("/client") @Component @Scope("singleton") -@Api(tags = { "Clients Address" }) -@SwaggerDefinition(tags = { - @Tag(name = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.") }) +@Tag(name = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.") public class ClientAddressApiResources { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("addressId", "street", "addressLine1", "addressLine2", @@ -104,14 +102,13 @@ public class ClientAddressApiResources { @Path("/{clientid}/addresses") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create an address for a Client", notes = "Mandatory Fields : \n" + "type and clientId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientAddressApiResourcesSwagger.PostClientClientIdAddressesRequest.class) }) + @Operation(summary = "Create an address for a Client", description = "Mandatory Fields : \n" + "type and clientId") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientAddressApiResourcesSwagger.PostClientClientIdAddressesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientAddressApiResourcesSwagger.PostClientClientIdAddressesResponse.class) }) - public String addClientAddress(@QueryParam("type") @ApiParam(value = "type") final long addressTypeId, - @PathParam("clientid") @ApiParam(value = "clientId") final long clientid, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientAddressApiResourcesSwagger.PostClientClientIdAddressesResponse.class))) }) + public String addClientAddress(@QueryParam("type") @Parameter(description = "type") final long addressTypeId, + @PathParam("clientid") @Parameter(description = "clientId") final long clientid, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().addClientAddress(clientid, addressTypeId) .withJson(apiRequestBodyAsJson).build(); @@ -125,13 +122,13 @@ public class ClientAddressApiResources { @Path("/{clientid}/addresses") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List all addresses for a Client", notes = "Example Requests:\n" + "\n" + "client/1/addresses\n" + "\n" + "\n" - + "clients/1/addresses?status=false,true&&type=1,2,3") + @Operation(summary = "List all addresses for a Client", description = "Example Requests:\n" + "\n" + "client/1/addresses\n" + "\n" + + "\n" + "clients/1/addresses?status=false,true&&type=1,2,3") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = ClientAddressApiResourcesSwagger.GetClientClientIdAddressesResponse.class) }) - public String getAddresses(@QueryParam("status") @ApiParam(value = "status") final String status, - @QueryParam("type") @ApiParam(value = "type") final long addressTypeId, - @PathParam("clientid") @ApiParam(value = "clientId") final long clientid, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ClientAddressApiResourcesSwagger.GetClientClientIdAddressesResponse.class)))) }) + public String getAddresses(@QueryParam("status") @Parameter(description = "status") final String status, + @QueryParam("type") @Parameter(description = "type") final long addressTypeId, + @PathParam("clientid") @Parameter(description = "clientId") final long clientid, @Context final UriInfo uriInfo) { Collection address; this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -155,14 +152,13 @@ public class ClientAddressApiResources { @Path("/{clientid}/addresses") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update an address for a Client", notes = "All the address fields can be updated by using update client address API\n" + @Operation(summary = "Update an address for a Client", description = "All the address fields can be updated by using update client address API\n" + "\n" + "Mandatory Fields\n" + "type and addressId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientAddressApiResourcesSwagger.PutClientClientIdAddressesRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientAddressApiResourcesSwagger.PutClientClientIdAddressesRequest.class))) @ApiResponses(value = { - @ApiResponse(code = 200, message = "OK", response = ClientAddressApiResourcesSwagger.PutClientClientIdAddressesResponse.class) }) - public String updateClientAddress(@PathParam("clientid") @ApiParam(value = "clientId") final long clientid, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientAddressApiResourcesSwagger.PutClientClientIdAddressesResponse.class))) }) + public String updateClientAddress(@PathParam("clientid") @Parameter(description = "clientId") final long clientid, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateClientAddress(clientid).withJson(apiRequestBodyAsJson) .build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResourcesSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResourcesSwagger.java index d2c97a964..81bcbc941 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResourcesSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResourcesSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by Chirag Gupta on 01/12/18. @@ -28,100 +27,100 @@ final class ClientAddressApiResourcesSwagger { private ClientAddressApiResourcesSwagger() {} - @ApiModel(value = "PostClientClientIdAddressesRequest") + @Schema(description = "PostClientClientIdAddressesRequest") public static final class PostClientClientIdAddressesRequest { private PostClientClientIdAddressesRequest() {} - @ApiModelProperty(example = "Ipca") + @Schema(example = "Ipca") public String street; - @ApiModelProperty(example = "Kandivali") + @Schema(example = "Kandivali") public String addressLine1; - @ApiModelProperty(example = "plot47") + @Schema(example = "plot47") public String addressLine2; - @ApiModelProperty(example = "charkop") + @Schema(example = "charkop") public String addressLine3; - @ApiModelProperty(example = "Mumbai") + @Schema(example = "Mumbai") public String city; - @ApiModelProperty(example = "800") + @Schema(example = "800") public Integer stateProvinceId; - @ApiModelProperty(example = "802") + @Schema(example = "802") public Integer countryId; - @ApiModelProperty(example = "400064") + @Schema(example = "400064") public Long postalCode; } - @ApiModel(value = "PostClientClientIdAddressesResponse") + @Schema(description = "PostClientClientIdAddressesResponse") public static final class PostClientClientIdAddressesResponse { private PostClientClientIdAddressesResponse() {} - @ApiModelProperty(example = "15") + @Schema(example = "15") public Integer resourceId; } - @ApiModel(value = "GetClientClientIdAddressesResponse") + @Schema(description = "GetClientClientIdAddressesResponse") public static final class GetClientClientIdAddressesResponse { private GetClientClientIdAddressesResponse() {} - @ApiModelProperty(example = "111755") + @Schema(example = "111755") public Long client_id; - @ApiModelProperty(example = "PERMANENT ADDRESS") + @Schema(example = "PERMANENT ADDRESS") public String addressType; - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer addressId; - @ApiModelProperty(example = "804") + @Schema(example = "804") public Integer addressTypeId; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isActive; - @ApiModelProperty(example = "anki's home") + @Schema(example = "anki's home") public String street; - @ApiModelProperty(example = "test123") + @Schema(example = "test123") public String addressLine1; - @ApiModelProperty(example = "iuyt") + @Schema(example = "iuyt") public String addressLine2; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String addressLine3; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String townVillage; - @ApiModelProperty(example = "mumbai") + @Schema(example = "mumbai") public String city; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String countyDistrict; - @ApiModelProperty(example = "801") + @Schema(example = "801") public Integer stateProvinceId; - @ApiModelProperty(example = "UNITED STATES") + @Schema(example = "UNITED STATES") public String countryName; - @ApiModelProperty(example = "GUJRAT") + @Schema(example = "GUJRAT") public String stateName; - @ApiModelProperty(example = "807") + @Schema(example = "807") public Integer countryId; - @ApiModelProperty(example = "400095") + @Schema(example = "400095") public Long postalCode; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String createdBy; - @ApiModelProperty(example = " ") + @Schema(example = " ") public String updatedBy; } - @ApiModel(value = "PutClientClientIdAddressesRequest") + @Schema(description = "PutClientClientIdAddressesRequest") public static final class PutClientClientIdAddressesRequest { private PutClientClientIdAddressesRequest() {} - @ApiModelProperty(example = "67") + @Schema(example = "67") public Integer addressId; - @ApiModelProperty(example = "goldensource") + @Schema(example = "goldensource") public String street; } - @ApiModel(value = "PutClientClientIdAddressesResponse") + @Schema(description = "PutClientClientIdAddressesResponse") public static final class PutClientClientIdAddressesResponse { private PutClientClientIdAddressesResponse() {} - @ApiModelProperty(example = "67") + @Schema(example = "67") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java index 495f947ea..03b6a03ff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.Set; @@ -67,11 +66,9 @@ import org.springframework.util.CollectionUtils; @Path("/clients/{clientId}/charges") @Component -@Api(tags = { "Client Charges" }) -@SwaggerDefinition(tags = { - @Tag(name = "Client Charges", description = "It is typical for MFI's to directly associate charges with an implicit Client account. These can be either fees or penalties\n" - + "\n" - + "Client Charges are client specific instances of Charges. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Client account) are described here") }) +@Tag(name = "Client Charges", description = "It is typical for MFI's to directly associate charges with an implicit Client account. These can be either fees or penalties\n" + + "\n" + + "Client Charges are client specific instances of Charges. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Client account) are described here") public class ClientChargesApiResource { private final PlatformSecurityContext context; @@ -101,15 +98,15 @@ public class ClientChargesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Client Charges", notes = "The list capability of client charges supports pagination." + @Operation(summary = "List Client Charges", description = "The list capability of client charges supports pagination." + "Example Requests:\n" + "clients/1/charges\n" + "\nclients/1/charges?offset=0&limit=5") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientChargesApiResourceSwagger.GetClientsClientIdChargesResponse.class) }) - public String retrieveAllClientCharges(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @DefaultValue(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS_VALUE_ALL) @QueryParam(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS) @ApiParam(value = "chargeStatus") final String chargeStatus, - @QueryParam("pendingPayment") @ApiParam(value = "pendingPayment") final Boolean pendingPayment, @Context final UriInfo uriInfo, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.GetClientsClientIdChargesResponse.class))) }) + public String retrieveAllClientCharges(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @DefaultValue(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS_VALUE_ALL) @QueryParam(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS) @Parameter(description = "chargeStatus") final String chargeStatus, + @QueryParam("pendingPayment") @Parameter(description = "pendingPayment") final Boolean pendingPayment, + @Context final UriInfo uriInfo, @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); if (!(is(chargeStatus, ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS_VALUE_ALL) @@ -151,12 +148,12 @@ public class ClientChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client Charge", notes = "Example Requests:\n" + "clients/1/charges/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Client Charge", description = "Example Requests:\n" + "clients/1/charges/1\n" + "\n" + "\n" + "clients/1/charges/1?fields=name,id") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ClientChargesApiResourceSwagger.GetClientsClientIdChargesResponse.GetClientsChargesPageItems.class) }) - public String retrieveClientCharge(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.GetClientsClientIdChargesResponse.GetClientsChargesPageItems.class))) }) + public String retrieveClientCharge(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME); ClientChargeData clientCharge = this.clientChargeReadPlatformService.retrieveClientCharge(clientId, chargeId); @@ -182,14 +179,13 @@ public class ClientChargesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Add Client Charge", notes = " This API associates a Client charge with an implicit Client account\n" + @Operation(summary = "Add Client Charge", description = " This API associates a Client charge with an implicit Client account\n" + "Mandatory Fields : \n" + "chargeId and dueDate \n" + "Optional Fields : \n" + "amount") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientChargesApiResourceSwagger.PostClientsClientIdChargesRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.PostClientsClientIdChargesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = ClientChargesApiResourceSwagger.PostClientsClientIdChargesResponse.class) }) - public String applyClientCharge(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.PostClientsClientIdChargesResponse.class))) }) + public String applyClientCharge(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createClientCharge(clientId).withJson(apiRequestBodyAsJson) .build(); @@ -203,19 +199,18 @@ public class ClientChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Pay a Client Charge | Waive a Client Charge", notes = "Pay a Client Charge:\n\n" + "Mandatory Fields:" + @Operation(summary = "Pay a Client Charge | Waive a Client Charge", description = "Pay a Client Charge:\n\n" + "Mandatory Fields:" + "transactionDate and amount " + "" + "\"Pay either a part of or the entire due amount for a charge.(command=paycharge)\n" + "\n" + "Waive a Client Charge:\n" + "\n" + "\n" + "This API provides the facility of waiving off the remaining amount on a client charge (command=waive)\n\n" + "Showing request/response for 'Pay a Client Charge'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientChargesApiResourceSwagger.PostClientsClientIdChargesChargeIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.PostClientsClientIdChargesChargeIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientChargesApiResourceSwagger.PostClientsClientIdChargesChargeIdResponse.class) }) - public String payOrWaiveClientCharge(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.PostClientsClientIdChargesChargeIdResponse.class))) }) + public String payOrWaiveClientCharge(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String json = ""; if (is(commandParam, ClientApiConstants.CLIENT_CHARGE_COMMAND_WAIVE_CHARGE)) { @@ -250,11 +245,11 @@ public class ClientChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Client Charge", notes = "Deletes a Client Charge on which no transactions have taken place (either payments or waivers). ") + @Operation(summary = "Delete a Client Charge", description = "Deletes a Client Charge on which no transactions have taken place (either payments or waivers). ") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientChargesApiResourceSwagger.DeleteClientsClientIdChargesChargeIdResponse.class) }) - public String deleteClientCharge(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientChargesApiResourceSwagger.DeleteClientsClientIdChargesChargeIdResponse.class))) }) + public String deleteClientCharge(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteClientCharge(clientId, chargeId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResourceSwagger.java index 8d77a24b9..cf9da1fb5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.math.BigDecimal; import java.time.LocalDate; import java.util.Set; @@ -31,7 +30,7 @@ final class ClientChargesApiResourceSwagger { private ClientChargesApiResourceSwagger() {} - @ApiModel(value = "GetClientsClientIdChargesResponse") + @Schema(description = "GetClientsClientIdChargesResponse") public static final class GetClientsClientIdChargesResponse { private GetClientsClientIdChargesResponse() {} @@ -44,152 +43,152 @@ final class ClientChargesApiResourceSwagger { private GetClientChargeTimeType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetClientChargeCalculationType { private GetClientChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetClientChargeCurrency { private GetClientChargeCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer chargeId; - @ApiModelProperty(example = "Client Fee 1") + @Schema(example = "Client Fee 1") public String name; public GetClientChargeTimeType chargeTimeType; - @ApiModelProperty(example = "[2015, 8, 17]") + @Schema(example = "[2015, 8, 17]") public LocalDate dueDate; public GetClientChargeCalculationType chargeCalculationType; public GetClientChargeCurrency currency; - @ApiModelProperty(example = "100.000000") + @Schema(example = "100.000000") public BigDecimal amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public BigDecimal amountPaid; - @ApiModelProperty(example = "100.000000") + @Schema(example = "100.000000") public BigDecimal amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public BigDecimal amountWrittenOff; - @ApiModelProperty(example = "0.000000") + @Schema(example = "0.000000") public BigDecimal amountOutstanding; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isPaid; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isWaived; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "PostClientsClientIdChargesRequest") + @Schema(description = "PostClientsClientIdChargesRequest") public static final class PostClientsClientIdChargesRequest { private PostClientsClientIdChargesRequest() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amount; - @ApiModelProperty(example = "226") + @Schema(example = "226") public Integer chargeId; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 September 2015") + @Schema(example = "01 September 2015") public String dueDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModel(value = "PostClientsClientIdChargesResponse") + @Schema(description = "PostClientsClientIdChargesResponse") public static final class PostClientsClientIdChargesResponse { private PostClientsClientIdChargesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "189") + @Schema(example = "189") public Integer chargeId; - @ApiModelProperty(example = "164") + @Schema(example = "164") public Integer resourceId; } - @ApiModel(value = "PostClientsClientIdChargesChargeIdRequest") + @Schema(description = "PostClientsClientIdChargesChargeIdRequest") public static final class PostClientsClientIdChargesChargeIdRequest { private PostClientsClientIdChargesChargeIdRequest() {} - @ApiModelProperty(example = "200") + @Schema(example = "200") public Integer amount; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 September 2015") + @Schema(example = "01 September 2015") public String transactionDate; } - @ApiModel(value = "PostClientsClientIdChargesChargeIdResponse") + @Schema(description = "PostClientsClientIdChargesChargeIdResponse") public static final class PostClientsClientIdChargesChargeIdResponse { private PostClientsClientIdChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "189") + @Schema(example = "189") public Integer clientId; - @ApiModelProperty(example = "157") + @Schema(example = "157") public Integer resourceId; - @ApiModelProperty(example = "221") + @Schema(example = "221") public Integer transactionId; } - @ApiModel(value = "DeleteClientsClientIdChargesChargeIdResponse") + @Schema(description = "DeleteClientsClientIdChargesChargeIdResponse") public static final class DeleteClientsClientIdChargesChargeIdResponse { private DeleteClientsClientIdChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "189") + @Schema(example = "189") public Integer clientId; - @ApiModelProperty(example = "164") + @Schema(example = "164") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java index 72d7fb3a0..6babb0c09 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -64,10 +64,8 @@ import org.springframework.stereotype.Component; @Path("/clients/{clientId}/identifiers") @Component @Scope("singleton") -@Api(tags = { "Client Identifier" }) -@SwaggerDefinition(tags = { - @Tag(name = "Client Identifier", description = "Client Identifiers refer to documents that are used to uniquely identify a customer\n" - + "Ex: Drivers License, Passport, Ration card etc ") }) +@Tag(name = "Client Identifier", description = "Client Identifiers refer to documents that are used to uniquely identify a customer\n" + + "Ex: Drivers License, Passport, Ration card etc ") public class ClientIdentifiersApiResource { private static final Set CLIENT_IDENTIFIER_DATA_PARAMETERS = new HashSet<>( @@ -102,12 +100,12 @@ public class ClientIdentifiersApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List all Identifiers for a Client", notes = "Example Requests:\n" + "clients/1/identifiers\n" + "\n" + "\n" + @Operation(summary = "List all Identifiers for a Client", description = "Example Requests:\n" + "clients/1/identifiers\n" + "\n" + "\n" + "clients/1/identifiers?fields=documentKey,documentType,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = ClientIdentifiersApiResourceSwagger.GetClientsClientIdIdentifiersResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.GetClientsClientIdIdentifiersResponse.class)))) }) public String retrieveAllClientIdentifiers(@Context final UriInfo uriInfo, - @PathParam("clientId") @ApiParam(value = "clientId") final Long clientId) { + @PathParam("clientId") @Parameter(description = "clientId") final Long clientId) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -122,10 +120,10 @@ public class ClientIdentifiersApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Client Identifier Details Template", notes = "This is a convenience resource useful for building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + " Field Defaults\n" + " Allowed Value Lists\n" + "\n\nExample Request:\n" + "clients/1/identifiers/template") + @Operation(summary = "Retrieve Client Identifier Details Template", description = "This is a convenience resource useful for building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + " Field Defaults\n" + " Allowed description Lists\n" + "\n\nExample Request:\n" + "clients/1/identifiers/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientIdentifiersApiResourceSwagger.GetClientsClientIdIdentifiersTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.GetClientsClientIdIdentifiersTemplateResponse.class))) }) public String newClientIdentifierDetails(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -140,13 +138,12 @@ public class ClientIdentifiersApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create an Identifier for a Client", notes = "Mandatory Fields\n" + "documentKey, documentTypeId ") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientIdentifiersApiResourceSwagger.PostClientsClientIdIdentifiersRequest.class) }) + @Operation(summary = "Create an Identifier for a Client", description = "Mandatory Fields\n" + "documentKey, documentTypeId ") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.PostClientsClientIdIdentifiersRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientIdentifiersApiResourceSwagger.PostClientsClientIdIdentifiersResponse.class) }) - public String createClientIdentifier(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.PostClientsClientIdIdentifiersResponse.class))) }) + public String createClientIdentifier(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { try { final CommandWrapper commandRequest = new CommandWrapperBuilder().createClientIdentifier(clientId) @@ -172,12 +169,13 @@ public class ClientIdentifiersApiResource { @Path("{identifierId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client Identifier", notes = "Example Requests:\n" + "clients/1/identifier/2\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Client Identifier", description = "Example Requests:\n" + "clients/1/identifier/2\n" + "\n" + "\n" + "clients/1/identifier/2?template=true\n" + "\n" + "clients/1/identifiers/2?fields=documentKey,documentType,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientIdentifiersApiResourceSwagger.GetClientsClientIdIdentifiersResponse.class) }) - public String retrieveClientIdentifiers(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("identifierId") @ApiParam(value = "identifierId") final Long clientIdentifierId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.GetClientsClientIdIdentifiersResponse.class))) }) + public String retrieveClientIdentifiers(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("identifierId") @Parameter(description = "identifierId") final Long clientIdentifierId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -197,14 +195,13 @@ public class ClientIdentifiersApiResource { @Path("{identifierId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Client Identifier", notes = "Updates a Client Identifier") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientIdentifiersApiResourceSwagger.PutClientsClientIdIdentifiersIdentifierIdRequest.class) }) + @Operation(summary = "Update a Client Identifier", description = "Updates a Client Identifier") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.PutClientsClientIdIdentifiersIdentifierIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientIdentifiersApiResourceSwagger.PutClientsClientIdIdentifiersIdentifierIdResponse.class) }) - public String updateClientIdentifer(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("identifierId") @ApiParam(value = "identifierId") final Long clientIdentifierId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.PutClientsClientIdIdentifiersIdentifierIdResponse.class))) }) + public String updateClientIdentifer(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("identifierId") @Parameter(description = "identifierId") final Long clientIdentifierId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { try { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateClientIdentifier(clientId, clientIdentifierId) @@ -229,11 +226,11 @@ public class ClientIdentifiersApiResource { @Path("{identifierId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Client Identifier", notes = "Deletes a Client Identifier") + @Operation(summary = "Delete a Client Identifier", description = "Deletes a Client Identifier") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientIdentifiersApiResourceSwagger.DeleteClientsClientIdIdentifiersIdentifierIdResponse.class) }) - public String deleteClientIdentifier(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("identifierId") @ApiParam(value = "identifierId") final Long clientIdentifierId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientIdentifiersApiResourceSwagger.DeleteClientsClientIdIdentifiersIdentifierIdResponse.class))) }) + public String deleteClientIdentifier(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("identifierId") @Parameter(description = "identifierId") final Long clientIdentifierId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteClientIdentifier(clientId, clientIdentifierId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResourceSwagger.java index 3f4f896f5..7db6ed6c0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class ClientIdentifiersApiResourceSwagger { private ClientIdentifiersApiResourceSwagger() {} - @ApiModel(value = "GetClientsClientIdIdentifiersResponse") + @Schema(description = "GetClientsClientIdIdentifiersResponse") public static final class GetClientsClientIdIdentifiersResponse { private GetClientsClientIdIdentifiersResponse() {} @@ -38,24 +37,24 @@ final class ClientIdentifiersApiResourceSwagger { private GetClientsDocumentType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "Drivers License") + @Schema(example = "Drivers License") public String name; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; public GetClientsDocumentType documentType; - @ApiModelProperty(example = "12345") + @Schema(example = "12345") public String documentKey; - @ApiModelProperty(example = "Issued in the year 2--7") + @Schema(example = "Issued in the year 2--7") public String description; } - @ApiModel(value = "GetClientsClientIdIdentifiersTemplateResponse") + @Schema(description = "GetClientsClientIdIdentifiersTemplateResponse") public static final class GetClientsClientIdIdentifiersTemplateResponse { private GetClientsClientIdIdentifiersTemplateResponse() {} @@ -64,80 +63,80 @@ final class ClientIdentifiersApiResourceSwagger { private GetClientsAllowedDocumentTypes() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Passport") + @Schema(example = "Passport") public String name; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } public Set allowedDocumentTypes; } - @ApiModel(value = "PostClientsClientIdIdentifiersRequest") + @Schema(description = "PostClientsClientIdIdentifiersRequest") public static final class PostClientsClientIdIdentifiersRequest { private PostClientsClientIdIdentifiersRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer documentTypeId; - @ApiModelProperty(example = "KA-54677") + @Schema(example = "KA-54677") public String documentKey; - @ApiModelProperty(example = "Document has been verified") + @Schema(example = "Document has been verified") public String description; } - @ApiModel(value = "PutClientsClientIdIdentifiersIdentifierIdRequest") + @Schema(description = "PutClientsClientIdIdentifiersIdentifierIdRequest") public static final class PutClientsClientIdIdentifiersIdentifierIdRequest { private PutClientsClientIdIdentifiersIdentifierIdRequest() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer documentTypeId; - @ApiModelProperty(example = "KA-94667") + @Schema(example = "KA-94667") public String documentKey; - @ApiModelProperty(example = "Document has been updated") + @Schema(example = "Document has been updated") public String description; } - @ApiModel(value = "PutClientsClientIdIdentifiersIdentifierIdResponse") + @Schema(description = "PutClientsClientIdIdentifiersIdentifierIdResponse") public static final class PutClientsClientIdIdentifiersIdentifierIdResponse { private PutClientsClientIdIdentifiersIdentifierIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer resourceId; public PutClientsClientIdIdentifiersIdentifierIdRequest changes; } - @ApiModel(value = "PostClientsClientIdIdentifiersResponse") + @Schema(description = "PostClientsClientIdIdentifiersResponse") public static final class PostClientsClientIdIdentifiersResponse { private PostClientsClientIdIdentifiersResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer resourceId; } - @ApiModel(value = "DeleteClientsClientIdIdentifiersIdentifierIdResponse") + @Schema(description = "DeleteClientsClientIdIdentifiersIdentifierIdResponse") public static final class DeleteClientsClientIdIdentifiersIdentifierIdResponse { private DeleteClientsClientIdIdentifiersIdentifierIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java index eb9c1e175..8532fd630 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -54,9 +54,7 @@ import org.springframework.stereotype.Component; @Path("/clients/{clientId}/transactions") @Component -@Api(tags = { "Client Transaction" }) -@SwaggerDefinition(tags = { - @Tag(name = "Client Transaction", description = "Client Transactions refer to transactions made directly againt a Client's internal account. Currently, these transactions are only created as a result of charge payments/waivers. You are allowed to undo a transaction, however you cannot explicitly create one. ") }) +@Tag(name = "Client Transaction", description = "Client Transactions refer to transactions made directly againt a Client's internal account. Currently, these transactions are only created as a result of charge payments/waivers. You are allowed to undo a transaction, however you cannot explicitly create one. ") public class ClientTransactionsApiResource { private final PlatformSecurityContext context; @@ -81,13 +79,13 @@ public class ClientTransactionsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Client Transactions", notes = "The list capability of client transaction can support pagination." + "\n\n" - + "Example Requests:\n\n" + "clients/189/transactions\n\n" + "clients/189/transactions?offset=10&limit=50") + @Operation(summary = "List Client Transactions", description = "The list capability of client transaction can support pagination." + + "\n\n" + "Example Requests:\n\n" + "clients/189/transactions\n\n" + "clients/189/transactions?offset=10&limit=50") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientTransactionsApiResourceSwagger.GetClientsClientIdTransactionsResponse.class) }) - public String retrieveAllClientTransactions(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @Context final UriInfo uriInfo, @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientTransactionsApiResourceSwagger.GetClientsClientIdTransactionsResponse.class))) }) + public String retrieveAllClientTransactions(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @Context final UriInfo uriInfo, @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME); SearchParameters searchParameters = SearchParameters.forPagination(offset, limit); @@ -103,12 +101,13 @@ public class ClientTransactionsApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client Transaction", notes = "Example Requests:\n" + "clients/1/transactions/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Client Transaction", description = "Example Requests:\n" + "clients/1/transactions/1\n" + "\n" + "\n" + "clients/1/transactions/1?fields=id,officeName") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientTransactionsApiResourceSwagger.GetClientsClientIdTransactionsTransactionIdResponse.class) }) - public String retrieveClientTransaction(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientTransactionsApiResourceSwagger.GetClientsClientIdTransactionsTransactionIdResponse.class))) }) + public String retrieveClientTransaction(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME); @@ -124,13 +123,13 @@ public class ClientTransactionsApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Undo a Client Transaction", notes = "Undoes a Client Transaction") + @Operation(summary = "Undo a Client Transaction", description = "Undoes a Client Transaction") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ClientTransactionsApiResourceSwagger.PostClientsClientIdTransactionsTransactionIdResponse.class) }) - public String undoClientTransaction(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientTransactionsApiResourceSwagger.PostClientsClientIdTransactionsTransactionIdResponse.class))) }) + public String undoClientTransaction(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String json = ""; if (is(commandParam, ClientApiConstants.CLIENT_TRANSACTION_COMMAND_UNDO)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResourceSwagger.java index 6b8415f63..6c8c74a3c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.math.BigDecimal; import java.time.LocalDate; import java.util.Set; @@ -31,7 +30,7 @@ final class ClientTransactionsApiResourceSwagger { private ClientTransactionsApiResourceSwagger() {} - @ApiModel(value = "GetClientsClientIdTransactionsResponse") + @Schema(description = "GetClientsClientIdTransactionsResponse") public static final class GetClientsClientIdTransactionsResponse { private GetClientsClientIdTransactionsResponse() {} @@ -44,88 +43,88 @@ final class ClientTransactionsApiResourceSwagger { private GetClientsClientIdTransactionsType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "clientTransactionType.payCharge") + @Schema(example = "clientTransactionType.payCharge") public String code; - @ApiModelProperty(example = "PAY_CHARGE") - public String value; + @Schema(example = "PAY_CHARGE") + public String description; } static final class GetClientTransactionsCurrency { private GetClientTransactionsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "226") + @Schema(example = "226") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetClientsClientIdTransactionsType type; - @ApiModelProperty(example = "[2015, 9, 2]") + @Schema(example = "[2015, 9, 2]") public LocalDate date; public GetClientTransactionsCurrency currency; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Double amount; - @ApiModelProperty(example = "[2015, 9, 2]") + @Schema(example = "[2015, 9, 2]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean reversed; } - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetClientsClientIdTransactionsTransactionIdResponse") + @Schema(description = "GetClientsClientIdTransactionsTransactionIdResponse") public static final class GetClientsClientIdTransactionsTransactionIdResponse { private GetClientsClientIdTransactionsTransactionIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetClientsClientIdTransactionsResponse.GetClientsPageItems.GetClientsClientIdTransactionsType type; - @ApiModelProperty(example = "[2015, 8, 17]") + @Schema(example = "[2015, 8, 17]") public LocalDate date; public GetClientsClientIdTransactionsResponse.GetClientsPageItems.GetClientTransactionsCurrency currency; - @ApiModelProperty(example = "60.000000") + @Schema(example = "60.000000") public BigDecimal amount; - @ApiModelProperty(example = "[2015, 8, 17]") + @Schema(example = "[2015, 8, 17]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean reversed; } - @ApiModel(value = "PostClientsClientIdTransactionsTransactionIdResponse") + @Schema(description = "PostClientsClientIdTransactionsTransactionIdResponse") public static final class PostClientsClientIdTransactionsTransactionIdResponse { private PostClientsClientIdTransactionsTransactionIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "189") + @Schema(example = "189") public Integer clientId; - @ApiModelProperty(example = "222") + @Schema(example = "222") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java index 2cd79067a..fc3f163ea 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java @@ -20,15 +20,14 @@ package org.apache.fineract.portfolio.client.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -80,10 +79,8 @@ import org.springframework.stereotype.Component; @Path("/clients") @Component @Scope("singleton") -@Api(tags = { "Client" }) -@SwaggerDefinition(tags = { - @Tag(name = "Client", description = "Clients are people and businesses that have applied (or may apply) to an MFI for loans.\n" - + "\n" + "Clients can be created in Pending or straight into Active state.") }) +@Tag(name = "Client", description = "Clients are people and businesses that have applied (or may apply) to an MFI for loans.\n" + "\n" + + "Clients can be created in Pending or straight into Active state.") public class ClientsApiResource { private final PlatformSecurityContext context; @@ -125,13 +122,14 @@ public class ClientsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Client Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Client Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n\n" + "Example Request:\n" + "\n" + "clients/template") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.GetClientsTemplateResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.GetClientsTemplateResponse.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo, - @ApiParam(value = "officeId") @QueryParam("officeId") final Long officeId, - @QueryParam("commandParam") @ApiParam(value = "commandParam") final String commandParam, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { + @Parameter(description = "officeId") @QueryParam("officeId") final Long officeId, + @QueryParam("commandParam") @Parameter(description = "commandParam") final String commandParam, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -156,23 +154,24 @@ public class ClientsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Clients", notes = "The list capability of clients can support pagination and sorting.\n\n" + @Operation(summary = "List Clients", description = "The list capability of clients can support pagination and sorting.\n\n" + "Example Requests:\n" + "\n" + "clients\n" + "\n" + "clients?fields=displayName,officeName,timeline\n" + "\n" + "clients?offset=10&limit=50\n" + "\n" + "clients?orderBy=displayName&sortOrder=DESC") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.GetClientsResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.GetClientsResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("displayName") @ApiParam(value = "displayName") final String displayName, - @QueryParam("firstName") @ApiParam(value = "firstName") final String firstname, - @QueryParam("lastName") @ApiParam(value = "lastName") final String lastname, - @QueryParam("underHierarchy") @ApiParam(value = "underHierarchy") final String hierarchy, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("orphansOnly") @ApiParam(value = "orphansOnly") final Boolean orphansOnly) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("displayName") @Parameter(description = "displayName") final String displayName, + @QueryParam("firstName") @Parameter(description = "firstName") final String firstname, + @QueryParam("lastName") @Parameter(description = "lastName") final String lastname, + @QueryParam("underHierarchy") @Parameter(description = "underHierarchy") final String hierarchy, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("orphansOnly") @Parameter(description = "orphansOnly") final Boolean orphansOnly) { return this.retrieveAll(uriInfo, sqlSearch, officeId, externalId, displayName, firstname, lastname, hierarchy, offset, limit, orderBy, sortOrder, orphansOnly, false); @@ -197,11 +196,13 @@ public class ClientsApiResource { @Path("{clientId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client", notes = "Example Requests:\n" + "\n" + "clients/1\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Client", description = "Example Requests:\n" + "\n" + "clients/1\n" + "\n" + "\n" + "clients/1?template=true\n" + "\n" + "\n" + "clients/1?fields=id,displayName,officeName") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.GetClientsClientIdResponse.class) }) - public String retrieveOne(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, @Context final UriInfo uriInfo, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.GetClientsClientIdResponse.class))) }) + public String retrieveOne(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @Context final UriInfo uriInfo, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -224,15 +225,15 @@ public class ClientsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Client", httpMethod = "POST", notes = "Note:\n\n" + @Operation(summary = "Create a Client", description = "Note:\n\n" + "1. You can enter either:firstname/middlename/lastname - for a person (middlename is optional) OR fullname - for a business or organisation (or person known by one name).\n" + "\n" + "2.If address is enable(enable-address=true), then additional field called address has to be passed.\n\n" + "Mandatory Fields: firstname and lastname OR fullname, officeId, active=true and activationDate OR active=false, if(address enabled) address\n\n" + "Optional Fields: groupId, externalId, accountNo, staffId, mobileNo, savingsProductId, genderId, clientTypeId, clientClassificationId") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", dataType = "ClientData", required = true, type = "body", dataTypeClass = ClientsApiResourceSwagger.PostClientsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.PostClientsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.PostClientsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.PostClientsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createClient() // @@ -248,15 +249,15 @@ public class ClientsApiResource { @Path("{clientId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Client", notes = "Note: You can update any of the basic attributes of a client (but not its associations) using this API.\n" + @Operation(summary = "Update a Client", description = "Note: You can update any of the basic attributes of a client (but not its associations) using this API.\n" + "\n" + "Changing the relationship between a client and its office is not supported through this API. An API specific to handling transfers of clients between offices is available for the same.\n" + "\n" + "The relationship between a client and a group must be removed through the Groups API.") - @ApiImplicitParams({ - @ApiImplicitParam(paramType = "body", dataType = "ClientData", required = true, type = "body", dataTypeClass = ClientsApiResourceSwagger.PutClientsClientIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.PutClientsClientIdResponse.class) }) - public String update(@ApiParam(value = "clientId") @PathParam("clientId") final Long clientId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.PutClientsClientIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.PutClientsClientIdResponse.class))) }) + public String update(@Parameter(description = "clientId") @PathParam("clientId") final Long clientId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateClient(clientId) // @@ -272,12 +273,11 @@ public class ClientsApiResource { @Path("{clientId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Client", notes = "If a client is in Pending state, you are allowed to Delete it. The delete is a 'hard delete' and cannot be recovered from. Once clients become active or have loans or savings associated with them, you cannot delete the client but you may Close the client if they have left the program.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientsApiResourceSwagger.DeleteClientsClientIdRequest.class) }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.DeleteClientsClientIdResponse.class) }) - public String delete(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId) { + @Operation(summary = "Delete a Client", description = "If a client is in Pending state, you are allowed to Delete it. The delete is a 'hard delete' and cannot be recovered from. Once clients become active or have loans or savings associated with them, you cannot delete the client but you may Close the client if they have left the program.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.DeleteClientsClientIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.DeleteClientsClientIdResponse.class))) }) + public String delete(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteClient(clientId) // @@ -292,7 +292,7 @@ public class ClientsApiResource { @Path("{clientId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Activate a Client | Close a Client | Reject a Client | Withdraw a Client | Reactivate a Client | UndoReject a Client | UndoWithdraw a Client | Assign a Staff | Unassign a Staff | Update Default Savings Account | Propose a Client Transfer | Withdraw a Client Transfer | Reject a Client Transfer | Accept a Client Transfer | Propose and Accept a Client Transfer", notes = "Activate a Client:\n\n" + @Operation(summary = "Activate a Client | Close a Client | Reject a Client | Withdraw a Client | Reactivate a Client | UndoReject a Client | UndoWithdraw a Client | Assign a Staff | Unassign a Staff | Update Default Savings Account | Propose a Client Transfer | Withdraw a Client Transfer | Reject a Client Transfer | Accept a Client Transfer | Propose and Accept a Client Transfer", description = "Activate a Client:\n\n" + "Clients can be created in a Pending state. This API exists to enable client activation (for when a client becomes an approved member of the financial Institution).\n" + "\n" + "If the client happens to be already active this API will result in an error.\n\n" + "Close a Client:\n\n" + "Clients can be closed if they do not have any non-closed loans/savingsAccount. This API exists to close a client .\n" + "\n" @@ -322,12 +322,12 @@ public class ClientsApiResource { + "Propose and Accept a Client Transfer:\n\n" + "Abstraction over the Propose and Accept Client Transfer API's which enable a user with Data Scope over both the Target and Destination Branches to directly transfer a Client to the destination Office.\n\n" + "Showing request/response for 'Reject a Client Transfer'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ClientsApiResourceSwagger.PostClientsClientIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.PostClientsClientIdResponse.class) }) - public String activate(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.PostClientsClientIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.PostClientsClientIdResponse.class))) }) + public String activate(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -399,12 +399,13 @@ public class ClientsApiResource { @Path("{clientId}/accounts") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve client accounts overview", notes = "An example of how a loan portfolio summary can be provided. This is requested in a specific use case of the community application.\n" + @Operation(summary = "Retrieve client accounts overview", description = "An example of how a loan portfolio summary can be provided. This is requested in a specific use case of the community application.\n" + "It is quite reasonable to add resources like this to simplify User Interface development.\n" + "\n" + "Example Requests:\n " + "\n" + "clients/1/accounts\n" + "\n" + "clients/1/accounts?fields=loanAccounts,savingsAccounts") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ClientsApiResourceSwagger.GetClientsClientIdAccountsResponse.class), - @ApiResponse(code = 400, message = "Bad Request") }) - public String retrieveAssociatedAccounts(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ClientsApiResourceSwagger.GetClientsClientIdAccountsResponse.class))), + @ApiResponse(responseCode = "400", description = "Bad Request") }) + public String retrieveAssociatedAccounts(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java index 548eb76e0..e45b2f06e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.client.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.List; import java.util.Set; @@ -31,7 +30,7 @@ final class ClientsApiResourceSwagger { private ClientsApiResourceSwagger() {} - @ApiModel(value = "GetClientsTemplateResponse") + @Schema(description = "GetClientsTemplateResponse") public static final class GetClientsTemplateResponse { private GetClientsTemplateResponse() {} @@ -40,11 +39,11 @@ final class ClientsApiResourceSwagger { private GetClientsOfficeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; } @@ -52,21 +51,21 @@ final class ClientsApiResourceSwagger { private GetClientsStaffOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "xyz") + @Schema(example = "xyz") public String firstname; - @ApiModelProperty(example = "sjs") + @Schema(example = "sjs") public String lastname; - @ApiModelProperty(example = "sjs, xyz") + @Schema(example = "sjs, xyz") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isLoanOfficer; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; } @@ -74,13 +73,13 @@ final class ClientsApiResourceSwagger { private GetClientsSavingProductOptions() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "account overdraft") + @Schema(example = "account overdraft") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawalFeeForTransfers; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean allowOverdraft; } @@ -92,32 +91,32 @@ final class ClientsApiResourceSwagger { private GetClientsColumnHeaderData() {} - @ApiModelProperty(example = "client_id") + @Schema(example = "client_id") public String columnName; - @ApiModelProperty(example = "bigint") + @Schema(example = "bigint") public String columnType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer columnLength; - @ApiModelProperty(example = "INTEGER") + @Schema(example = "INTEGER") public String columnDisplayType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isColumnNullable; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isColumnPrimaryKey; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List columnValues; } - @ApiModelProperty(example = "m_client") + @Schema(example = "m_client") public String applicationTableName; - @ApiModelProperty(example = "Address Details") + @Schema(example = "Address Details") public String registeredTableName; public Set columnHeaderData; } - @ApiModelProperty(example = "[2014, 3, 4]") + @Schema(example = "[2014, 3, 4]") public LocalDate activationDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; public Set officeOptions; public Set staffOptions; @@ -125,7 +124,7 @@ final class ClientsApiResourceSwagger { public Set datatables; } - @ApiModel(value = "GetClientsResponse") + @Schema(description = "GetClientsResponse") public static final class GetClientsResponse { private GetClientsResponse() {} @@ -138,37 +137,37 @@ final class ClientsApiResourceSwagger { private GetClientStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "clientStatusType.pending") + @Schema(example = "clientStatusType.pending") public String code; - @ApiModelProperty(example = "Pending") - public String value; + @Schema(example = "Pending") + public String description; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public String accountNo; public GetClientStatus status; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "Home Farm Produce") + @Schema(example = "Home Farm Produce") public String fullname; - @ApiModelProperty(example = "Home Farm Produce") + @Schema(example = "Home Farm Produce") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetClientsClientIdResponse") + @Schema(description = "GetClientsClientIdResponse") public static final class GetClientsClientIdResponse { private GetClientsClientIdResponse() {} @@ -177,164 +176,164 @@ final class ClientsApiResourceSwagger { private GetClientsClientIdStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "clientStatusType.active") + @Schema(example = "clientStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; + @Schema(example = "Active") + public String description; } static final class GetClientsTimeline { private GetClientsTimeline() {} - @ApiModelProperty(example = "[2013, 1, 1]") + @Schema(example = "[2013, 1, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; - @ApiModelProperty(example = "[2013, 1, 1]") + @Schema(example = "[2013, 1, 1]") public LocalDate activatedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String activatedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String activatedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String activatedByLastname; } - @ApiModelProperty(example = "27") + @Schema(example = "27") public Integer id; - @ApiModelProperty(example = "000000027") + @Schema(example = "000000027") public Long accountNo; public GetClientsClientIdStatus status; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "[2013, 1, 1]") + @Schema(example = "[2013, 1, 1]") public LocalDate activationDate; - @ApiModelProperty(example = "savings") + @Schema(example = "savings") public String firstname; - @ApiModelProperty(example = "test") + @Schema(example = "test") public String lastname; - @ApiModelProperty(example = "savings test") + @Schema(example = "savings test") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetClientsTimeline timeline; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer savingsProductId; - @ApiModelProperty(example = "account overdraft") + @Schema(example = "account overdraft") public String savingsProductName; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List groups; } - @ApiModel(value = "PostClientsRequest") + @Schema(description = "PostClientsRequest") public static final class PostClientsRequest { private PostClientsRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Client of group") + @Schema(example = "Client of group") public String fullname; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer groupId; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "04 March 2009") + @Schema(example = "04 March 2009") public String activationDate; } - @ApiModel(value = "PostClientsResponse") + @Schema(description = "PostClientsResponse") public static final class PostClientsResponse { private PostClientsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer groupId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } - @ApiModel(value = "PutClientsClientIdRequest") + @Schema(description = "PutClientsClientIdRequest") public static final class PutClientsClientIdRequest { private PutClientsClientIdRequest() {} - @ApiModelProperty(example = "786444UUUYYH7") + @Schema(example = "786444UUUYYH7") public String externalId; } - @ApiModel(value = "PutClientsClientIdResponse") + @Schema(description = "PutClientsClientIdResponse") public static final class PutClientsClientIdResponse { private PutClientsClientIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutClientsClientIdRequest changes; } - @ApiModel(value = "DeleteClientsClientIdRequest") + @Schema(description = "DeleteClientsClientIdRequest") public static final class DeleteClientsClientIdRequest { private DeleteClientsClientIdRequest() {} } - @ApiModel(value = "DeleteClientsClientIdResponse") + @Schema(description = "DeleteClientsClientIdResponse") public static final class DeleteClientsClientIdResponse { private DeleteClientsClientIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer clientId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer resourceId; } - @ApiModel(value = "PostClientsClientIdRequest") + @Schema(description = "PostClientsClientIdRequest") public static final class PostClientsClientIdRequest { private PostClientsClientIdRequest() {} - @ApiModelProperty(example = "We cannot accept transfers of clients having loans with less than 1 repayment left") + @Schema(example = "We cannot accept transfers of clients having loans with less than 1 repayment left") public String note; } - @ApiModel(value = "PostClientsClientIdResponse") + @Schema(description = "PostClientsClientIdResponse") public static final class PostClientsClientIdResponse { private PostClientsClientIdResponse() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } - @ApiModel(value = "GetClientsClientIdAccountsResponse") + @Schema(description = "GetClientsClientIdAccountsResponse") public static final class GetClientsClientIdAccountsResponse { private GetClientsClientIdAccountsResponse() {} @@ -347,27 +346,27 @@ final class ClientsApiResourceSwagger { private GetClientsLoanAccountsStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "loanStatusType.active") + @Schema(example = "loanStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Active") + public String description; + @Schema(example = "false") public Boolean pendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } @@ -375,27 +374,27 @@ final class ClientsApiResourceSwagger { private GetClientsLoanAccountsType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "loanType.individual") + @Schema(example = "loanType.individual") public String code; - @ApiModelProperty(example = "Individual") - public String value; + @Schema(example = "Individual") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "456") + @Schema(example = "456") public Integer externalId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "TestOne") + @Schema(example = "TestOne") public String productName; public GetClientsLoanAccountsStatus status; public GetClientsLoanAccountsType loanType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanCycle; } @@ -407,17 +406,17 @@ final class ClientsApiResourceSwagger { private GetClientsSavingsAccountsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -425,33 +424,33 @@ final class ClientsApiResourceSwagger { private GetClientsSavingsAccountsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer id; - @ApiModelProperty(example = "000000007") + @Schema(example = "000000007") public Long accountNo; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer productId; - @ApiModelProperty(example = "Other product") + @Schema(example = "Other product") public String productName; public GetClientsSavingsAccountsStatus status; public GetClientsSavingsAccountsCurrency currency; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java index b7cd47787..c612dffc2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.collateral.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -62,9 +62,7 @@ import org.springframework.stereotype.Component; @Path("/loans/{loanId}/collaterals") @Component @Scope("singleton") -@Api(tags = { "Loan Collateral" }) -@SwaggerDefinition(tags = { - @Tag(name = "Loan Collateral", description = "In lending agreements, collateral is a borrower's pledge of specific property to a lender, to secure repayment of a loan. The collateral serves as protection for a lender against a borrower's default - that is, any borrower failing to pay the principal and interest under the terms of a loan obligation. If a borrower does default on a loan (due to insolvency or other event), that borrower forfeits (gives up) the property pledged as collateral - and the lender then becomes the owner of the collateral") }) +@Tag(name = "Loan Collateral", description = "In lending agreements, collateral is a borrower's pledge of specific property to a lender, to secure repayment of a loan. The collateral serves as protection for a lender against a borrower's default - that is, any borrower failing to pay the principal and interest under the terms of a loan obligation. If a borrower does default on a loan (due to insolvency or other event), that borrower forfeits (gives up) the property pledged as collateral - and the lender then becomes the owner of the collateral") public class CollateralsApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -96,10 +94,10 @@ public class CollateralsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Collateral Details Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Collateral Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "loans/1/collaterals/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollateralsApiResourceSwagger.GetLoansLoanIdCollateralsTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.GetLoansLoanIdCollateralsTemplateResponse.class))) }) public String newCollateralTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); @@ -115,12 +113,12 @@ public class CollateralsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Loan Collaterals", httpMethod = "GET", notes = "Example Requests:\n" + "\n" + "loans/1/collaterals\n" + "\n" - + "\n" + "loans/1/collaterals?fields=value,description") + @Operation(summary = "List Loan Collaterals", description = "Example Requests:\n" + "\n" + "loans/1/collaterals\n" + "\n" + "\n" + + "loans/1/collaterals?fields=value,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollateralsApiResourceSwagger.GetLoansLoanIdCollateralsResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = CollateralsApiResourceSwagger.GetLoansLoanIdCollateralsResponse.class)))) }) public String retrieveCollateralDetails(@Context final UriInfo uriInfo, - @PathParam("loanId") @ApiParam(value = "loanId") final Long loanId) { + @PathParam("loanId") @Parameter(description = "loanId") final Long loanId) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); final List CollateralDatas = this.collateralReadPlatformService.retrieveCollateralsForValidLoan(loanId); @@ -134,13 +132,13 @@ public class CollateralsApiResource { @Path("{collateralId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Collateral", httpMethod = "GET", notes = "Example Requests:\n" + "\n" + "/loans/1/collaterals/1\n" - + "\n" + "\n" + "/loans/1/collaterals/1?fields=value,description") + @Operation(summary = "Retrieve a Collateral", description = "Example Requests:\n" + "\n" + "/loans/1/collaterals/1\n" + "\n" + "\n" + + "/loans/1/collaterals/1?fields=description,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollateralsApiResourceSwagger.GetLoansLoanIdCollateralsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.GetLoansLoanIdCollateralsResponse.class))) }) public String retrieveCollateralDetails(@Context final UriInfo uriInfo, - @PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("collateralId") @ApiParam(value = "collateralId") final Long CollateralId) { + @PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("collateralId") @Parameter(description = "collateralId") final Long CollateralId) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission); CollateralData collateralData = this.collateralReadPlatformService.retrieveCollateral(loanId, CollateralId); @@ -158,13 +156,12 @@ public class CollateralsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Collateral", httpMethod = "POST", notes = "Note: Currently, Collaterals may be added only before a Loan is approved") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CollateralsApiResourceSwagger.PostLoansLoanIdCollateralsRequest.class) }) + @Operation(summary = "Create a Collateral", description = "Note: Currently, Collaterals may be added only before a Loan is approved") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.PostLoansLoanIdCollateralsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollateralsApiResourceSwagger.PostLoansLoanIdCollateralsResponse.class) }) - public String createCollateral(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.PostLoansLoanIdCollateralsResponse.class))) }) + public String createCollateral(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createCollateral(loanId).withJson(apiRequestBodyAsJson).build(); @@ -177,14 +174,13 @@ public class CollateralsApiResource { @Path("{collateralId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Collateral", httpMethod = "PUT") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CollateralsApiResourceSwagger.PutLoansLoandIdCollateralsCollateralIdRequest.class) }) + @Operation(summary = "Update a Collateral") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.PutLoansLoandIdCollateralsCollateralIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollateralsApiResourceSwagger.PutLoansLoanIdCollateralsCollateralIdResponse.class) }) - public String updateCollateral(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("collateralId") @ApiParam(value = "collateralId") final Long collateralId, - @ApiParam(hidden = true) final String jsonRequestBody) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.PutLoansLoanIdCollateralsCollateralIdResponse.class))) }) + public String updateCollateral(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("collateralId") @Parameter(description = "collateralId") final Long collateralId, + @Parameter(hidden = true) final String jsonRequestBody) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCollateral(loanId, collateralId).withJson(jsonRequestBody) .build(); @@ -197,11 +193,11 @@ public class CollateralsApiResource { @Path("{collateralId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Remove a Collateral", httpMethod = "DELETE", notes = "Note: A collateral can only be removed from Loans that are not yet approved.") + @Operation(summary = "Remove a Collateral", description = "Note: A collateral can only be removed from Loans that are not yet approved.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollateralsApiResourceSwagger.DeleteLoansLoanIdCollateralsCollateralIdResponse.class) }) - public String deleteCollateral(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("collateralId") @ApiParam(value = "collateralId") final Long collateralId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CollateralsApiResourceSwagger.DeleteLoansLoanIdCollateralsCollateralIdResponse.class))) }) + public String deleteCollateral(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("collateralId") @Parameter(description = "collateralId") final Long collateralId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCollateral(loanId, collateralId).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResourceSwagger.java index dc3d679f6..e966aa6ff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.collateral.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class CollateralsApiResourceSwagger { private CollateralsApiResourceSwagger() {} - @ApiModel(value = "GetLoansLoanIdCollateralsResponse") + @Schema(description = "GetLoansLoanIdCollateralsResponse") public static final class GetLoansLoanIdCollateralsResponse { private GetLoansLoanIdCollateralsResponse() {} @@ -38,9 +37,9 @@ final class CollateralsApiResourceSwagger { private GetCollateralTypeResponse() {} - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer id; - @ApiModelProperty(example = "Gold") + @Schema(example = "Gold") public String name; } @@ -48,72 +47,72 @@ final class CollateralsApiResourceSwagger { private GetCollateralCurrencyResponse() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; public GetCollateralTypeResponse type; - @ApiModelProperty(example = "50000") + @Schema(example = "50000") public Long value; - @ApiModelProperty(example = "24 Carat Gold chain weighing 12 grams") + @Schema(example = "24 Carat Gold chain weighing 12 grams") public String description; public GetCollateralCurrencyResponse currency; } - @ApiModel(value = "PostLoansLoanIdCollateralsRequest") + @Schema(description = "PostLoansLoanIdCollateralsRequest") public static final class PostLoansLoanIdCollateralsRequest { private PostLoansLoanIdCollateralsRequest() {} - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer collateralTypeId; } - @ApiModel(value = "PostLoansLoanIdCollateralsResponse") + @Schema(description = "PostLoansLoanIdCollateralsResponse") public static final class PostLoansLoanIdCollateralsResponse { private PostLoansLoanIdCollateralsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer resourceId; } - @ApiModel(value = "PutLoansLoandIdCollateralsCollateralIdRequest") + @Schema(description = "PutLoansLoandIdCollateralsCollateralIdRequest") public static final class PutLoansLoandIdCollateralsCollateralIdRequest { private PutLoansLoandIdCollateralsCollateralIdRequest() {} - @ApiModelProperty(example = "22 Carat Gold chain weighing 12 grams") + @Schema(example = "22 Carat Gold chain weighing 12 grams") public String description; } - @ApiModel(value = "PutLoansLoanIdCollateralsCollateralIdResponse") + @Schema(description = "PutLoansLoanIdCollateralsCollateralIdResponse") public static final class PutLoansLoanIdCollateralsCollateralIdResponse { private PutLoansLoanIdCollateralsCollateralIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer resourceId; public PutLoansLoandIdCollateralsCollateralIdRequest changes; } - @ApiModel(value = "GetLoansLoanIdCollateralsTemplateResponse") + @Schema(description = "GetLoansLoanIdCollateralsTemplateResponse") public static final class GetLoansLoanIdCollateralsTemplateResponse { private GetLoansLoanIdCollateralsTemplateResponse() {} @@ -122,25 +121,25 @@ final class CollateralsApiResourceSwagger { private GetCollateralsTemplateAllowedTypes() {} - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer id; - @ApiModelProperty(example = "Silver") + @Schema(example = "Silver") public String name; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } public Set allowedCollateralTypes; } - @ApiModel(value = "DeleteLoansLoanIdCollateralsCollateralIdResponse") + @Schema(description = "DeleteLoansLoanIdCollateralsCollateralIdResponse") public static final class DeleteLoansLoanIdCollateralsCollateralIdResponse { private DeleteLoansLoanIdCollateralsCollateralIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourceSwagger.java index 07be5c9f5..63fc6b8f5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.collectionsheet.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; /** @@ -29,7 +28,7 @@ final class CollectionSheetApiResourceSwagger { private CollectionSheetApiResourceSwagger() {} - @ApiModel(value = "PostCollectionSheetRequest") + @Schema(description = "PostCollectionSheetRequest") public static final class PostCollectionSheetRequest { private PostCollectionSheetRequest() {} @@ -38,30 +37,30 @@ final class CollectionSheetApiResourceSwagger { private PostCollectionSheetBulkRepaymentTransactions() {} - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer loanId; - @ApiModelProperty(example = "1221.36") + @Schema(example = "1221.36") public Double transactionAmount; - @ApiModelProperty(example = "19") + @Schema(example = "19") public Integer paymentTypeId; - @ApiModelProperty(example = "1245356") + @Schema(example = "1245356") public Long receiptNumber; } - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "04 May 2014") + @Schema(example = "04 May 2014") public String transactionDate; - @ApiModelProperty(example = "04 May 2014") + @Schema(example = "04 May 2014") public String actualDisbursementDate; public List bulkDisbursementTransactions; public PostCollectionSheetBulkRepaymentTransactions bulkRepaymentTransactions; public List bulkSavingsDueTransactions; } - @ApiModel(value = "PostCollectionSheetResponse") + @Schema(description = "PostCollectionSheetResponse") public static final class PostCollectionSheetResponse { private PostCollectionSheetResponse() {} @@ -70,19 +69,19 @@ final class CollectionSheetApiResourceSwagger { private PostCollectionSheetChanges() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "[15]") + @Schema(example = "[15]") public List loanTransactions; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List SavingsTransactions; } - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer groupId; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer resourceId; public PostCollectionSheetChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java index bbf052fdc..02c3366eb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java @@ -19,13 +19,13 @@ package org.apache.fineract.portfolio.collectionsheet.api; import com.google.gson.JsonElement; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -55,7 +55,7 @@ import org.springframework.stereotype.Component; @Path("/collectionsheet") @Component @Scope("singleton") -@Api(value = "Collection Sheet", description = "") + public class CollectionSheetApiResourse { private final CollectionSheetReadPlatformService collectionSheetReadPlatformService; @@ -81,16 +81,15 @@ public class CollectionSheetApiResourse { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Generate Individual Collection Sheet | Save Collection Sheet", httpMethod = "POST", notes = "Generate Individual Collection Sheet:\n\n" + @Operation(summary = "Generate Individual Collection Sheet | Save Collection Sheet", description = "Generate Individual Collection Sheet:\n\n" + "This Api retrieves repayment details of all individual loans under a office as on a specified meeting date.\n\n" + "Save Collection Sheet:\n\n" + "This Api allows the loan officer to perform bulk repayments of individual loans and deposit of mandatory savings on a given meeting date.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CollectionSheetApiResourceSwagger.PostCollectionSheetRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CollectionSheetApiResourceSwagger.PostCollectionSheetRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CollectionSheetApiResourceSwagger.PostCollectionSheetResponse.class) }) - public String generateCollectionSheet(@QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CollectionSheetApiResourceSwagger.PostCollectionSheetResponse.class))) }) + public String generateCollectionSheet(@QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); CommandProcessingResult result = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java index 0005dab47..0c0af43ca 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.floatingrates.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -58,9 +58,7 @@ import org.springframework.stereotype.Component; @Path("/floatingrates") @Component @Scope("singleton") -@Api(tags = { "Floating Rates" }) -@SwaggerDefinition(tags = { - @Tag(name = "Floating Rates", description = "It lets you create, list, retrieve and upload the floating rates") }) +@Tag(name = "Floating Rates", description = "It lets you create, list, retrieve and upload the floating rates") public class FloatingRatesApiResource { private static final String RESOURCE_NAME = "FLOATINGRATE"; @@ -90,12 +88,12 @@ public class FloatingRatesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a new Floating Rate", httpMethod = "POST", notes = "Creates a new Floating Rate\n" - + "Mandatory Fields: name\n" + "Optional Fields: isBaseLendingRate, isActive, ratePeriods") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FloatingRatesApiResourceSwagger.PostFloatingRatesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = FloatingRatesApiResourceSwagger.PostFloatingRatesResponse.class) }) - public String createFloatingRate(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a new Floating Rate", description = "Creates a new Floating Rate\n" + "Mandatory Fields: name\n" + + "Optional Fields: isBaseLendingRate, isActive, ratePeriods") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FloatingRatesApiResourceSwagger.PostFloatingRatesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FloatingRatesApiResourceSwagger.PostFloatingRatesResponse.class))) }) + public String createFloatingRate(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createFloatingRate().withJson(apiRequestBodyAsJson).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); @@ -105,9 +103,9 @@ public class FloatingRatesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Floating Rates", httpMethod = "GET", notes = "Lists Floating Rates") + @Operation(summary = "List Floating Rates", description = "Lists Floating Rates") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FloatingRatesApiResourceSwagger.GetFloatingRatesResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FloatingRatesApiResourceSwagger.GetFloatingRatesResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME); final List floatingRates = this.floatingRatesReadPlatformService.retrieveAll(); @@ -119,10 +117,10 @@ public class FloatingRatesApiResource { @Path("{floatingRateId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Floating Rate", httpMethod = "GET", notes = "Retrieves Floating Rate") + @Operation(summary = "Retrieve Floating Rate", description = "Retrieves Floating Rate") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FloatingRatesApiResourceSwagger.GetFloatingRatesFloatingRateIdResponse.class) }) - public String retrieveOne(@PathParam("floatingRateId") @ApiParam(value = "floatingRateId") final Long floatingRateId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FloatingRatesApiResourceSwagger.GetFloatingRatesFloatingRateIdResponse.class))) }) + public String retrieveOne(@PathParam("floatingRateId") @Parameter(description = "floatingRateId") final Long floatingRateId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME); final FloatingRateData floatingRates = this.floatingRatesReadPlatformService.retrieveOne(floatingRateId); @@ -134,13 +132,12 @@ public class FloatingRatesApiResource { @Path("{floatingRateId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Floating Rate", httpMethod = "PUT", notes = "Updates new Floating Rate. Rate Periods in the past cannot be modified. All the future rateperiods would be replaced with the new ratePeriods data sent.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FloatingRatesApiResourceSwagger.PutFloatingRatesFloatingRateIdRequest.class) }) + @Operation(summary = "Update Floating Rate", description = "Updates new Floating Rate. Rate Periods in the past cannot be modified. All the future rateperiods would be replaced with the new ratePeriods data sent.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FloatingRatesApiResourceSwagger.PutFloatingRatesFloatingRateIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FloatingRatesApiResourceSwagger.PutFloatingRatesFloatingRateIdResponse.class) }) - public String updateFloatingRate(@PathParam("floatingRateId") @ApiParam(value = "floatingRateId") final Long floatingRateId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FloatingRatesApiResourceSwagger.PutFloatingRatesFloatingRateIdResponse.class))) }) + public String updateFloatingRate(@PathParam("floatingRateId") @Parameter(description = "floatingRateId") final Long floatingRateId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateFloatingRate(floatingRateId).withJson(apiRequestBodyAsJson) .build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResourceSwagger.java index 9a37e31f3..81d5a88df 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.floatingrates.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class FloatingRatesApiResourceSwagger { private FloatingRatesApiResourceSwagger() {} - @ApiModel(value = "PostFloatingRatesRequest") + @Schema(description = "PostFloatingRatesRequest") public static final class PostFloatingRatesRequest { private PostFloatingRatesRequest() {} @@ -38,58 +37,58 @@ final class FloatingRatesApiResourceSwagger { private PostFloatingRatesRatePeriods() {} - @ApiModelProperty(example = "19 November 2015") + @Schema(example = "19 November 2015") public String fromDate; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Double interestRate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; } - @ApiModelProperty(example = "Floating Rate 1") + @Schema(example = "Floating Rate 1") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isBaseLendingRate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; public Set ratePeriods; } - @ApiModel(value = "PostFloatingRatesResponse") + @Schema(description = "PostFloatingRatesResponse") public static final class PostFloatingRatesResponse { private PostFloatingRatesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetFloatingRatesResponse") + @Schema(description = "GetFloatingRatesResponse") public static final class GetFloatingRatesResponse { private GetFloatingRatesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Floating Rate 1") + @Schema(example = "Floating Rate 1") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isBaseLendingRate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdBy; - @ApiModelProperty(example = "Nov 18, 2015") + @Schema(example = "Nov 18, 2015") public String createdOn; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String modifiedBy; - @ApiModelProperty(example = "Nov 18, 2015") + @Schema(example = "Nov 18, 2015") public String modifiedOn; } - @ApiModel(value = "GetFloatingRatesFloatingRateIdResponse") + @Schema(description = "GetFloatingRatesFloatingRateIdResponse") public static final class GetFloatingRatesFloatingRateIdResponse { private GetFloatingRatesFloatingRateIdResponse() {} @@ -98,60 +97,60 @@ final class FloatingRatesApiResourceSwagger { private GetFloatingRatesRatePeriods() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Dec 15, 2015") + @Schema(example = "Dec 15, 2015") public String fromDate; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Double interestRate; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isDifferentialToBaseLendingRate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdBy; - @ApiModelProperty(example = "Nov 18, 2015") + @Schema(example = "Nov 18, 2015") public String createdOn; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String modifiedBy; - @ApiModelProperty(example = "Nov 18, 2015") + @Schema(example = "Nov 18, 2015") public String modifiedOn; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Floating Rate 1") + @Schema(example = "Floating Rate 1") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isBaseLendingRate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdBy; - @ApiModelProperty(example = "Nov 18, 2015") + @Schema(example = "Nov 18, 2015") public String createdOn; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String modifiedBy; - @ApiModelProperty(example = "Nov 18, 2015") + @Schema(example = "Nov 18, 2015") public String modifiedOn; public Set ratePeriods; } - @ApiModel(value = "PutFloatingRatesFloatingRateIdRequest") + @Schema(description = "PutFloatingRatesFloatingRateIdRequest") public static final class PutFloatingRatesFloatingRateIdRequest { private PutFloatingRatesFloatingRateIdRequest() {} - @ApiModelProperty(example = "Floating Rate 1") + @Schema(example = "Floating Rate 1") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isBaseLendingRate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; public Set ratePeriods; } - @ApiModel(value = "PutFloatingRatesFloatingRateIdResponse") + @Schema(description = "PutFloatingRatesFloatingRateIdResponse") public static final class PutFloatingRatesFloatingRateIdResponse { private PutFloatingRatesFloatingRateIdResponse() {} @@ -163,7 +162,7 @@ final class FloatingRatesApiResourceSwagger { public Set ratePeriods; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutFloatingRatesChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java index b3b4ceb19..b54f14615 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.portfolio.fund.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -57,7 +58,7 @@ import org.springframework.stereotype.Component; @Path("/funds") @Component @Scope("singleton") -@Api(value = "Funds", description = "") + public class FundsApiResource { /** @@ -87,10 +88,9 @@ public class FundsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Funds", httpMethod = "GET", notes = "Returns the list of funds.\n" + "\n" + "Example Requests:\n" + "\n" - + "funds") + @Operation(summary = "Retrieve Funds", description = "Returns the list of funds.\n" + "\n" + "Example Requests:\n" + "\n" + "funds") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FundsApiResourceSwagger.GetFundsResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FundsApiResourceSwagger.GetFundsResponse.class)))) }) public String retrieveFunds(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -104,11 +104,11 @@ public class FundsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Fund", httpMethod = "POST", notes = "Creates a Fund") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FundsApiResourceSwagger.PostFundsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = FundsApiResourceSwagger.PostFundsResponse.class) }) - public String createFund(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a Fund", description = "Creates a Fund") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PostFundsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PostFundsResponse.class))) }) + public String createFund(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createFund().withJson(apiRequestBodyAsJson).build(); @@ -121,10 +121,11 @@ public class FundsApiResource { @Path("{fundId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Fund", httpMethod = "GET", notes = "Returns the details of a Fund.\n" + "\n" + "Example Requests:\n" - + "\n" + "funds/1") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = FundsApiResourceSwagger.GetFundsResponse.class) }) - public String retreiveFund(@PathParam("fundId") @ApiParam(value = "fundId") final Long fundId, @Context final UriInfo uriInfo) { + @Operation(summary = "Retrieve a Fund", description = "Returns the details of a Fund.\n" + "\n" + "Example Requests:\n" + "\n" + + "funds/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.GetFundsResponse.class))) }) + public String retreiveFund(@PathParam("fundId") @Parameter(description = "fundId") final Long fundId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -138,12 +139,12 @@ public class FundsApiResource { @Path("{fundId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Fund", httpMethod = "PUT", notes = "Updates the details of a fund.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FundsApiResourceSwagger.PutFundsFundIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = FundsApiResourceSwagger.PutFundsFundIdResponse.class) }) - public String updateFund(@PathParam("fundId") @ApiParam(value = "fundId") final Long fundId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Fund", description = "Updates the details of a fund.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PutFundsFundIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PutFundsFundIdResponse.class))) }) + public String updateFund(@PathParam("fundId") @Parameter(description = "fundId") final Long fundId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateFund(fundId).withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResourceSwagger.java index f8dc0e691..2dd3c8b7b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.fund.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by Chirag Gupta on 12/08/17. @@ -28,50 +27,50 @@ final class FundsApiResourceSwagger { private FundsApiResourceSwagger() {} - @ApiModel(value = "GetFundsResponse") + @Schema(description = "GetFundsResponse") public static final class GetFundsResponse { private GetFundsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "EU Agri Fund") + @Schema(example = "EU Agri Fund") public String name; } - @ApiModel(value = "PostFundsRequest") + @Schema(description = "PostFundsRequest") public static final class PostFundsRequest { private PostFundsRequest() {} - @ApiModelProperty(example = "EU Agri Fund") + @Schema(example = "EU Agri Fund") public String name; } - @ApiModel(value = "PostFundsResponse") + @Schema(description = "PostFundsResponse") public static final class PostFundsResponse { private PostFundsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutFundsFundIdRequest") + @Schema(description = "PutFundsFundIdRequest") public static final class PutFundsFundIdRequest { private PutFundsFundIdRequest() {} - @ApiModelProperty(example = "EU Agri Fund (2010-2020)") + @Schema(example = "EU Agri Fund (2010-2020)") public String name; } - @ApiModel(value = "PutFundsFundIdResponse") + @Schema(description = "PutFundsFundIdResponse") public static final class PutFundsFundIdResponse { private PutFundsFundIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutFundsFundIdRequest changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java index 7e444843c..2456c0489 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java @@ -21,15 +21,14 @@ package org.apache.fineract.portfolio.group.api; import com.google.gson.JsonElement; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -96,9 +95,7 @@ import org.springframework.stereotype.Component; @Path("/centers") @Component @Scope("singleton") -@Api(tags = { "Centers" }) -@SwaggerDefinition(tags = { - @Tag(name = "Centers", description = "Centers along with Groups are used to provided a distinctive banking distribution channel used in microfinance. Its common in areas such as Southern Asia to use Centers and Group as administrative units in grameen style lending. Typically groups will contain one to five people and centers themselves will be made of anywhere between 2-10 groups.") }) +@Tag(name = "Centers", description = "Centers along with Groups are used to provided a distinctive banking distribution channel used in microfinance. Its common in areas such as Southern Asia to use Centers and Group as administrative units in grameen style lending. Typically groups will contain one to five people and centers themselves will be made of anywhere between 2-10 groups.") public class CentersApiResource { private final PlatformSecurityContext context; @@ -150,13 +147,14 @@ public class CentersApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Center Template", httpMethod = "GET", notes = "Retrieves a Center Template\n\n" - + "Example Requests:\n\n" + "\n\n" + "centers/template\n\n" + "\n\n" + "centers/template?officeId=2") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.GetCentersTemplateResponse.class) }) + @Operation(summary = "Retrieve a Center Template", description = "Retrieves a Center Template\n\n" + "Example Requests:\n\n" + "\n\n" + + "centers/template\n\n" + "\n\n" + "centers/template?officeId=2") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.GetCentersTemplateResponse.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); @@ -179,25 +177,26 @@ public class CentersApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Centers", httpMethod = "GET", notes = "The default implementation supports pagination and sorting with the default pagination size set to 200 records. The parameter limit with value -1 will return all entries.\n\n" + @Operation(summary = "List Centers", description = "The default implementation supports pagination and sorting with the default pagination size set to 200 records. The parameter limit with description -1 will return all entries.\n\n" + "Example Requests:\n\n" + "\n\n" + "centers\n\n" + "\n\n" + "centers?fields=name,officeName,joinedDate\n\n" + "\n\n" + "centers?offset=10&limit=50\n\n" + "\n\n" + "centers?orderBy=name&sortOrder=DESC") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.GetCentersResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.GetCentersResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @QueryParam("staffId") @ApiParam(value = "staffId") final Long staffId, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("name") @ApiParam(value = "name") final String name, - @QueryParam("underHierarchy") @ApiParam(value = "underHierarchy") final String hierarchy, - @QueryParam("paged") @ApiParam(value = "paged") final Boolean paged, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("meetingDate") @ApiParam(value = "meetingDate") final DateParam meetingDateParam, - @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat, - @QueryParam("locale") @ApiParam(value = "locale") final String locale) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @QueryParam("staffId") @Parameter(description = "staffId") final Long staffId, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("name") @Parameter(description = "name") final String name, + @QueryParam("underHierarchy") @Parameter(description = "underHierarchy") final String hierarchy, + @QueryParam("paged") @Parameter(description = "paged") final Boolean paged, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("meetingDate") @Parameter(description = "meetingDate") final DateParam meetingDateParam, + @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat, + @QueryParam("locale") @Parameter(description = "locale") final String locale) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -225,11 +224,13 @@ public class CentersApiResource { @Path("{centerId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Center", httpMethod = "GET", notes = "Retrieves a Center\n\n" + "Example Requests:\n\n" + "\n\n" - + "centers/1\n\n" + "\n\n" + "centers/1?associations=groupMembers") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.GetCentersCenterIdResponse.class) }) - public String retrieveOne(@Context final UriInfo uriInfo, @PathParam("centerId") @ApiParam(value = "centerId") final Long centerId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { + @Operation(summary = "Retrieve a Center", description = "Retrieves a Center\n\n" + "Example Requests:\n\n" + "\n\n" + "centers/1\n\n" + + "\n\n" + "centers/1?associations=groupMembers") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.GetCentersCenterIdResponse.class))) }) + public String retrieveOne(@Context final UriInfo uriInfo, + @PathParam("centerId") @Parameter(description = "centerId") final Long centerId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); final Set associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters()); @@ -277,13 +278,13 @@ public class CentersApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Center", httpMethod = "POST", notes = "Creates a Center\n\n" + @Operation(summary = "Create a Center", description = "Creates a Center\n\n" + "Mandatory Fields: name, officeId, active, activationDate (if active=true)\n\n" + "Optional Fields: externalId, staffId, groupMembers") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CentersApiResourceSwagger.PostCentersRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.PostCentersResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.PostCentersRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.PostCentersResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createCenter() // @@ -298,12 +299,12 @@ public class CentersApiResource { @Path("{centerId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Center", httpMethod = "PUT", notes = "Updates a Center") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CentersApiResourceSwagger.PutCentersCenterIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.PutCentersCenterIdResponse.class) }) - public String update(@PathParam("centerId") @ApiParam(value = "centerId") final Long centerId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Center", description = "Updates a Center") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.PutCentersCenterIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.PutCentersCenterIdResponse.class))) }) + public String update(@PathParam("centerId") @Parameter(description = "centerId") final Long centerId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateCenter(centerId) // @@ -317,9 +318,10 @@ public class CentersApiResource { @Path("{centerId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Center", httpMethod = "DELETE", notes = "A Center can be deleted if it is in pending state and has no association - groups, loans or savings") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.DeleteCentersCenterIdResponse.class) }) - public String delete(@PathParam("centerId") @ApiParam(value = "centerId") final Long centerId) { + @Operation(summary = "Delete a Center", description = "A Center can be deleted if it is in pending state and has no association - groups, loans or savings") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.DeleteCentersCenterIdResponse.class))) }) + public String delete(@PathParam("centerId") @Parameter(description = "centerId") final Long centerId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteCenter(centerId) // @@ -332,7 +334,7 @@ public class CentersApiResource { @Path("{centerId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Activate a Center | Generate Collection Sheet | Save Collection Sheet | Close a Center | Associate Groups | Disassociate Groups", httpMethod = "POST", notes = "Activate a Center:\n\n" + @Operation(summary = "Activate a Center | Generate Collection Sheet | Save Collection Sheet | Close a Center | Associate Groups | Disassociate Groups", description = "Activate a Center:\n\n" + "Centers can be created in a Pending state. This API exists to enable center activation. If the center happens to be already active, this API will result in an error.\n\n" + "Close a Center:\n\n" + "Centers can be closed if they don't have any non-closed groups or saving accounts. If the Center has any active groups or savings accounts, this API will result in an error.\n\n" @@ -343,12 +345,12 @@ public class CentersApiResource { + "Save Collection Sheet:\n\n" + "This Api allows the loan officer to perform bulk repayments of JLG loans for a center on a given meeting date.\n\n" + "Showing Request/Response for Close a Center") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CentersApiResourceSwagger.PostCentersCenterIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.PostCentersCenterIdResponse.class) }) - public String activate(@PathParam("centerId") @ApiParam(value = "centerId") final Long centerId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.PostCentersCenterIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.PostCentersCenterIdResponse.class))) }) + public String activate(@PathParam("centerId") @Parameter(description = "centerId") final Long centerId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -395,12 +397,12 @@ public class CentersApiResource { @Path("{centerId}/accounts") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Center accounts overview", httpMethod = "GET", notes = "An example of how a savings summary for a Center can be provided. This is requested in a specific use case of the reference application.\n\n" + @Operation(summary = "Retrieve Center accounts overview", description = "An example of how a savings summary for a Center can be provided. This is requested in a specific use case of the reference application.\n\n" + "It is quite reasonable to add resources like this to simplify User Interface development.\n\n" + "\n\n" + "Example Requests:\n\n" + "\n\n" + "centers/9/accounts") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = CentersApiResourceSwagger.GetCentersCenterIdAccountsResponse.class) }) - public String retrieveGroupAccount(@PathParam("centerId") @ApiParam(value = "centerId") final Long centerId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CentersApiResourceSwagger.GetCentersCenterIdAccountsResponse.class))) }) + public String retrieveGroupAccount(@PathParam("centerId") @Parameter(description = "centerId") final Long centerId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResourceSwagger.java index c260f649c..b72c92229 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.group.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class CentersApiResourceSwagger { private CentersApiResourceSwagger() {} - @ApiModel(value = "GetCentersTemplateResponse") + @Schema(description = "GetCentersTemplateResponse") public static final class GetCentersTemplateResponse { private GetCentersTemplateResponse() {} @@ -39,11 +38,11 @@ final class CentersApiResourceSwagger { private GetCentersOfficeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; } @@ -51,23 +50,23 @@ final class CentersApiResourceSwagger { private GetCentersStaffOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "D, Mary") + @Schema(example = "D, Mary") public String displayName; } - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "[2013, 4, 18]") + @Schema(example = "[2013, 4, 18]") public LocalDate activationDate; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; public Set officeOptions; public Set staffOptions; } - @ApiModel(value = "GetCentersResponse") + @Schema(description = "GetCentersResponse") public static final class GetCentersResponse { private GetCentersResponse() {} @@ -80,90 +79,90 @@ final class CentersApiResourceSwagger { private GetCentersStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "groupingStatusType.pending") + @Schema(example = "groupingStatusType.pending") public String code; - @ApiModelProperty(example = "Pending") - public String value; + @Schema(example = "Pending") + public String description; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; public GetCentersStatus status; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "Center 1") + @Schema(example = "Center 1") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = ".2.") + @Schema(example = ".2.") public String hierarchy; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetCentersCenterIdResponse") + @Schema(description = "GetCentersCenterIdResponse") public static final class GetCentersCenterIdResponse { private GetCentersCenterIdResponse() {} - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer id; public GetCentersResponse.GetCentersPageItems.GetCentersStatus status; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "First Center (No groups)") + @Schema(example = "First Center (No groups)") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = ".8.") + @Schema(example = ".8.") public String hierarchy; } - @ApiModel(value = "PostCentersRequest") + @Schema(description = "PostCentersRequest") public static final class PostCentersRequest { private PostCentersRequest() {} - @ApiModelProperty(example = "First Center (No groups)") + @Schema(example = "First Center (No groups)") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; } - @ApiModel(value = "PostCentersResponse") + @Schema(description = "PostCentersResponse") public static final class PostCentersResponse { private PostCentersResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer groupId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer resourceId; } - @ApiModel(value = "PutCentersCenterIdRequest") + @Schema(description = "PutCentersCenterIdRequest") public static final class PutCentersCenterIdRequest { private PutCentersCenterIdRequest() {} - @ApiModelProperty(example = "First Center (No groups)") + @Schema(example = "First Center (No groups)") public String name; } - @ApiModel(value = "PutCentersCenterIdResponse") + @Schema(description = "PutCentersCenterIdResponse") public static final class PutCentersCenterIdResponse { private PutCentersCenterIdResponse() {} @@ -172,20 +171,20 @@ final class CentersApiResourceSwagger { private PutCentersChanges() {} - @ApiModelProperty(example = "First Center (No groups) - modified") + @Schema(example = "First Center (No groups) - modified") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer groupId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer resourceId; public PutCentersChanges changes; } - @ApiModel(value = "DeleteCentersCenterIdResponse") + @Schema(description = "DeleteCentersCenterIdResponse") public static final class DeleteCentersCenterIdResponse { private DeleteCentersCenterIdResponse() {} @@ -195,36 +194,36 @@ final class CentersApiResourceSwagger { private DeleteCentersChanges() {} } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public DeleteCentersChanges changes; } - @ApiModel(value = "PostCentersCenterIdRequest") + @Schema(description = "PostCentersCenterIdRequest") public static final class PostCentersCenterIdRequest { private PostCentersCenterIdRequest() {} - @ApiModelProperty(example = "32") + @Schema(example = "32") public Integer closureReasonId; - @ApiModelProperty(example = "05 May 2014") + @Schema(example = "05 May 2014") public String closureDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; } - @ApiModel(value = "PostCentersCenterIdResponse") + @Schema(description = "PostCentersCenterIdResponse") public static final class PostCentersCenterIdResponse { private PostCentersCenterIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetCentersCenterIdAccountsResponse") + @Schema(description = "GetCentersCenterIdAccountsResponse") public static final class GetCentersCenterIdAccountsResponse { private GetCentersCenterIdAccountsResponse() {} @@ -237,29 +236,29 @@ final class CentersApiResourceSwagger { private GetCentersCenterIdStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean prematureClosed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean transferInProgress; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean transferOnHold; } @@ -267,19 +266,19 @@ final class CentersApiResourceSwagger { private GetCentersCenterIdCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -287,25 +286,25 @@ final class CentersApiResourceSwagger { private GetCentersAccountType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.group") + @Schema(example = "accountType.group") public String code; - @ApiModelProperty(example = "Group") - public String value; + @Schema(example = "Group") + public String description; } static final class GetCentersTimeline { private GetCentersTimeline() {} - @ApiModelProperty(example = "[2014, 5, 1]") + @Schema(example = "[2014, 5, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; } @@ -313,21 +312,21 @@ final class CentersApiResourceSwagger { private GetCentersDepositType() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "depositAccountType.savingsDeposit") + @Schema(example = "depositAccountType.savingsDeposit") public String code; - @ApiModelProperty(example = "Savings") - public String value; + @Schema(example = "Savings") + public String description; } - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "000000016") + @Schema(example = "000000016") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "Voluntary savings") + @Schema(example = "Voluntary savings") public String productName; public GetCentersCenterIdStatus status; public GetCentersCenterIdCurrency currency; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java index f54a2cc04..3ac463f52 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java @@ -21,15 +21,14 @@ package org.apache.fineract.portfolio.group.api; import com.google.gson.JsonElement; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -104,11 +103,9 @@ import org.springframework.util.CollectionUtils; @Path("/groups") @Component @Scope("singleton") -@Api(tags = { "Groups" }) -@SwaggerDefinition(tags = { - @Tag(name = "Groups", description = "Groups are used to provide a distinctive banking distribution channel used in microfinances throughout the world. The Group is an administrative unit. It can contain as few as 5 people or as many as 40 depending on how its used.\n" - + "\n" - + "Different styles of group lending - Joint-Liability Group, Grameen Model (Center-Group), Self-Help Groups, Village/Communal Banks)") }) +@Tag(name = "Groups", description = "Groups are used to provide a distinctive banking distribution channel used in microfinances throughout the world. The Group is an administrative unit. It can contain as few as 5 people or as many as 40 depending on how its used.\n" + + "\n" + + "Different styles of group lending - Joint-Liability Group, Grameen Model (Center-Group), Self-Help Groups, Village/Communal Banks)") public class GroupsApiResource { private final PlatformSecurityContext context; @@ -182,17 +179,18 @@ public class GroupsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Group Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n\n" + @Operation(summary = "Retrieve Group Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n\n" + "\n\n" + "Field Defaults\n\n" + "Allowed Value Lists\n\n" + "Example Requests:\n\n" + "\n\n" + "groups/template\n\n" + "\n\n" + "groups/template?officeId=2\n\n" + "\n\n" + "groups/template?centerId=1\n\n" + "\n\n" + "groups/template?centerId=1&staffInSelectedOfficeOnly=true") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.GetGroupsTemplateResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.GetGroupsTemplateResponse.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @QueryParam("center") @ApiParam(value = "center") final boolean isCenterGroup, - @QueryParam("centerId") @ApiParam(value = "centerId") final Long centerId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @QueryParam("center") @Parameter(description = "center") final boolean isCenterGroup, + @QueryParam("centerId") @Parameter(description = "centerId") final Long centerId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -225,23 +223,24 @@ public class GroupsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Groups", httpMethod = "GET", notes = "The default implementation of listing Groups returns 200 entries with support for pagination and sorting. Using the parameter limit with value -1 returns all entries.\n\n" + @Operation(summary = "List Groups", description = "The default implementation of listing Groups returns 200 entries with support for pagination and sorting. Using the parameter limit with description -1 returns all entries.\n\n" + "Example Requests:\n\n" + "\n\n" + "groups\n\n" + "\n\n" + "groups?fields=name,officeName,joinedDate\n\n" + "\n\n" + "groups?offset=10&limit=50\n\n" + "\n\n" + "groups?orderBy=name&sortOrder=DESC") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.GetGroupsResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.GetGroupsResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId, - @QueryParam("staffId") @ApiParam(value = "staffId") final Long staffId, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, - @QueryParam("name") @ApiParam(value = "name") final String name, - @QueryParam("underHierarchy") @ApiParam(value = "underHierarchy") final String hierarchy, - @QueryParam("paged") @ApiParam(value = "paged") final Boolean paged, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("orphansOnly") @ApiParam(value = "orphansOnly") final Boolean orphansOnly) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, + @QueryParam("staffId") @Parameter(description = "staffId") final Long staffId, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + @QueryParam("name") @Parameter(description = "name") final String name, + @QueryParam("underHierarchy") @Parameter(description = "underHierarchy") final String hierarchy, + @QueryParam("paged") @Parameter(description = "paged") final Boolean paged, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("orphansOnly") @Parameter(description = "orphansOnly") final Boolean orphansOnly) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder); @@ -262,12 +261,13 @@ public class GroupsApiResource { @Path("{groupId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Group", httpMethod = "GET", notes = "Retrieve group information.\n\n" + "Example Requests:\n\n" - + "\n\n" + "groups/1\n\n" + "\n\n" + "groups/1?associations=clientMembers") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.GetGroupsGroupIdResponse.class) }) - public String retrieveOne(@Context final UriInfo uriInfo, @PathParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @QueryParam("roleId") @ApiParam(value = "roleId") final Long roleId) { + @Operation(summary = "Retrieve a Group", description = "Retrieve group information.\n\n" + "Example Requests:\n\n" + "\n\n" + + "groups/1\n\n" + "\n\n" + "groups/1?associations=clientMembers") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.GetGroupsGroupIdResponse.class))) }) + public String retrieveOne(@Context final UriInfo uriInfo, @PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @QueryParam("roleId") @Parameter(description = "roleId") final Long roleId) { this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); final Set associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters()); @@ -362,13 +362,13 @@ public class GroupsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Group", httpMethod = "POST", notes = "Creates a Group\n\n" + @Operation(summary = "Create a Group", description = "Creates a Group\n\n" + "Mandatory Fields: name, officeId, active, activationDate (if active=true)\n\n" + "Optional Fields: externalId, staffId, clientMembers") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = GroupsApiResourceSwagger.PostGroupsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.PostGroupsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PostGroupsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PostGroupsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createGroup() // @@ -382,14 +382,12 @@ public class GroupsApiResource { @Path("{groupId}/command/unassign_staff") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Unassign a Staff", httpMethod = "POST", notes = "Allows you to unassign the Staff.\n\n" - + "Mandatory Fields: staffId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = GroupsApiResourceSwagger.PostGroupsGroupIdCommandUnassignStaffRequest.class) }) + @Operation(summary = "Unassign a Staff", description = "Allows you to unassign the Staff.\n\n" + "Mandatory Fields: staffId") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PostGroupsGroupIdCommandUnassignStaffRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.PostGroupsGroupIdCommandUnassignStaffResponse.class) }) - public String unassignLoanOfficer(@PathParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PostGroupsGroupIdCommandUnassignStaffResponse.class))) }) + public String unassignLoanOfficer(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .unassignGroupStaff(groupId) // @@ -404,12 +402,12 @@ public class GroupsApiResource { @Path("{groupId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Group", httpMethod = "PUT", notes = "Updates a Group") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = GroupsApiResourceSwagger.PutGroupsGroupIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.PutGroupsGroupIdResponse.class) }) - public String update(@PathParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Group", description = "Updates a Group") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PutGroupsGroupIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PutGroupsGroupIdResponse.class))) }) + public String update(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateGroup(groupId) // @@ -423,9 +421,10 @@ public class GroupsApiResource { @Path("{groupId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Group", httpMethod = "DELETE", notes = "A group can be deleted if it is in pending state and has no associations - clients, loans or savings") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.DeleteGroupsGroupIdResponse.class) }) - public String delete(@PathParam("groupId") @ApiParam(value = "groupId") final Long groupId) { + @Operation(summary = "Delete a Group", description = "A group can be deleted if it is in pending state and has no associations - clients, loans or savings") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.DeleteGroupsGroupIdResponse.class))) }) + public String delete(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteGroup(groupId) // @@ -438,7 +437,7 @@ public class GroupsApiResource { @Path("{groupId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Activate a Group | Associate Clients | Disassociate Clients | Transfer Clients across groups | Generate Collection Sheet | Save Collection Sheet | Unassign a Staff | Assign a Staff | Close a Group | Unassign a Role | Update a Role", httpMethod = "POST", notes = "Activate a Group:\n\n" + @Operation(summary = "Activate a Group | Associate Clients | Disassociate Clients | Transfer Clients across groups | Generate Collection Sheet | Save Collection Sheet | Unassign a Staff | Assign a Staff | Close a Group | Unassign a Role | Update a Role", description = "Activate a Group:\n\n" + "Groups can be created in a Pending state. This API exists to enable group activation.\n\n" + "\n\n" + "If the group happens to be already active this API will result in an error.\n\n" + "Mandatory Fields: activationDate\n\n" + "Associate Clients:\n\n" + "This API allows to associate existing clients to a group.\n\n" + "\n\n" @@ -469,13 +468,13 @@ public class GroupsApiResource { + "Allows you to unassign Roles associated tp Group members.\n\n" + "Update a Role:\n\n" + "Allows you to update the member Role.\n\n" + "Mandatory Fields: role\n\n" + "Showing request/response for Transfer Clients across groups") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = GroupsApiResourceSwagger.PostGroupsGroupIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.PostGroupsGroupIdResponse.class) }) - public String activateOrGenerateCollectionSheet(@PathParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @QueryParam("roleId") @ApiParam(value = "roleId") final Long roleId, @ApiParam(hidden = true) final String apiRequestBodyAsJson, - @Context final UriInfo uriInfo) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PostGroupsGroupIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.PostGroupsGroupIdResponse.class))) }) + public String activateOrGenerateCollectionSheet(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @QueryParam("roleId") @Parameter(description = "roleId") final Long roleId, + @Parameter(hidden = true) final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); CommandProcessingResult result = null; @@ -545,11 +544,13 @@ public class GroupsApiResource { @Path("{groupId}/accounts") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Group accounts overview", httpMethod = "GET", notes = "Retrieves details of all Loan and Savings accounts associated with this group.\n\n" + @Operation(summary = "Retrieve Group accounts overview", description = "Retrieves details of all Loan and Savings accounts associated with this group.\n\n" + "\n\n" + "Example Requests:\n\n" + "\n\n" + "groups/1/accounts\n\n" + "\n\n" + "\n\n" + "groups/1/accounts?fields=loanAccounts,savingsAccounts,memberLoanAccounts,\n\n" + "memberSavingsAccounts") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = GroupsApiResourceSwagger.GetGroupsGroupIdAccountsResponse.class) }) - public String retrieveAccounts(@PathParam("groupId") @ApiParam(value = "groupId") final Long groupId, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = GroupsApiResourceSwagger.GetGroupsGroupIdAccountsResponse.class))) }) + public String retrieveAccounts(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission("GROUP"); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResourceSwagger.java index 670da0940..03a5e32c1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.group.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class GroupsApiResourceSwagger { private GroupsApiResourceSwagger() {} - @ApiModel(value = "GetGroupsTemplateResponse") + @Schema(description = "GetGroupsTemplateResponse") public static final class GetGroupsTemplateResponse { private GetGroupsTemplateResponse() {} @@ -39,11 +38,11 @@ final class GroupsApiResourceSwagger { private GetGroupsTemplateOfficeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String name; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String nameDecorated; } @@ -51,9 +50,9 @@ final class GroupsApiResourceSwagger { private GetGroupsTemplateStaffOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "C, Mike") + @Schema(example = "C, Mike") public String displayName; } @@ -61,13 +60,13 @@ final class GroupsApiResourceSwagger { private GetGroupsTemplateClientOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Petra Yton") + @Schema(example = "Petra Yton") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } @@ -84,29 +83,29 @@ final class GroupsApiResourceSwagger { private GetGroupsTemplateColumnValues() {} } - @ApiModelProperty(example = "group_id") + @Schema(example = "group_id") public String columnName; - @ApiModelProperty(example = "bigint") + @Schema(example = "bigint") public String columnType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer columnLength; - @ApiModelProperty(example = "INTEGER") + @Schema(example = "INTEGER") public String columnDisplayType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isColumnNullable; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isColumnPrimaryKey; public Set columnValues; } - @ApiModelProperty(example = "m_group") + @Schema(example = "m_group") public String applicationTableName; - @ApiModelProperty(example = "Group Activation Data") + @Schema(example = "Group Activation Data") public String registeredTableName; public Set columnHeaderData; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; public Set officeOptions; public Set staffOptions; @@ -114,7 +113,7 @@ final class GroupsApiResourceSwagger { public Set datatables; } - @ApiModel(value = "GetGroupsResponse") + @Schema(description = "GetGroupsResponse") public static final class GetGroupsResponse { private GetGroupsResponse() {} @@ -127,35 +126,35 @@ final class GroupsApiResourceSwagger { private GetGroupsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "clientStatusType.pending") + @Schema(example = "clientStatusType.pending") public String code; - @ApiModelProperty(example = "Pending") - public String value; + @Schema(example = "Pending") + public String description; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "AnotherGroup") + @Schema(example = "AnotherGroup") public String name; public GetGroupsStatus status; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = ".4.") + @Schema(example = ".4.") public String hierarchy; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetGroupsGroupIdResponse") + @Schema(description = "GetGroupsGroupIdResponse") public static final class GetGroupsGroupIdResponse { private GetGroupsGroupIdResponse() {} @@ -164,80 +163,80 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdTimeline() {} - @ApiModelProperty(example = "[2013, 11, 14]") + @Schema(example = "[2013, 11, 14]") public LocalDate activatedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String activatedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String activatedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String activatedByLastname; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "First Group") + @Schema(example = "First Group") public String name; - @ApiModelProperty(example = "000-1A") + @Schema(example = "000-1A") public String externalId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = ".1.") + @Schema(example = ".1.") public String hierarchy; public GetGroupsGroupIdTimeline timeline; } - @ApiModel(value = "PostGroupsRequest") + @Schema(description = "PostGroupsRequest") public static final class PostGroupsRequest { private PostGroupsRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Pending Group") + @Schema(example = "Pending Group") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; } - @ApiModel(value = "PostGroupsResponse") + @Schema(description = "PostGroupsResponse") public static final class PostGroupsResponse { private PostGroupsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer groupId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } - @ApiModel(value = "DeleteGroupsGroupIdResponse") + @Schema(description = "DeleteGroupsGroupIdResponse") public static final class DeleteGroupsGroupIdResponse { private DeleteGroupsGroupIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer groupId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } - @ApiModel(value = "PostGroupsGroupIdCommandUnassignStaffRequest") + @Schema(description = "PostGroupsGroupIdCommandUnassignStaffRequest") public static final class PostGroupsGroupIdCommandUnassignStaffRequest { private PostGroupsGroupIdCommandUnassignStaffRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer staffId; } - @ApiModel(value = "PostGroupsGroupIdCommandUnassignStaffResponse") + @Schema(description = "PostGroupsGroupIdCommandUnassignStaffResponse") public static final class PostGroupsGroupIdCommandUnassignStaffResponse { private PostGroupsGroupIdCommandUnassignStaffResponse() {} @@ -247,25 +246,25 @@ final class GroupsApiResourceSwagger { private PostGroupsGroupIdCommandUnassignStaffChanges() {} } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer groupId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PostGroupsGroupIdCommandUnassignStaffChanges changes; } - @ApiModel(value = "PutGroupsGroupIdRequest") + @Schema(description = "PutGroupsGroupIdRequest") public static final class PutGroupsGroupIdRequest { private PutGroupsGroupIdRequest() {} - @ApiModelProperty(example = "First Group (changed)") + @Schema(example = "First Group (changed)") public String name; } - @ApiModel(value = "PutGroupsGroupIdResponse") + @Schema(description = "PutGroupsGroupIdResponse") public static final class PutGroupsGroupIdResponse { private PutGroupsGroupIdResponse() {} @@ -274,20 +273,20 @@ final class GroupsApiResourceSwagger { private PutGroupsGroupIdChanges() {} - @ApiModelProperty(example = "First Group (changed)") + @Schema(example = "First Group (changed)") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer groupId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutGroupsGroupIdChanges changes; } - @ApiModel(value = "GetGroupsGroupIdAccountsResponse") + @Schema(description = "GetGroupsGroupIdAccountsResponse") public static final class GetGroupsGroupIdAccountsResponse { private GetGroupsGroupIdAccountsResponse() {} @@ -300,27 +299,27 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "loanStatusType.submitted.and.pending.approval") + @Schema(example = "loanStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean pendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } @@ -328,21 +327,21 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsLoanType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.group") + @Schema(example = "accountType.group") public String code; - @ApiModelProperty(example = "Group") - public String value; + @Schema(example = "Group") + public String description; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "000000003") + @Schema(example = "000000003") public Long accountNo; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer productId; - @ApiModelProperty(example = "daily product") + @Schema(example = "daily product") public String productName; public GetGroupsGroupIdAccountsStatus status; public GetGroupsGroupIdAccountsLoanType loanType; @@ -356,23 +355,23 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsSavingStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } @@ -380,17 +379,17 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsSavingCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -398,21 +397,21 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsSavingAccountType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.group") + @Schema(example = "accountType.group") public String code; - @ApiModelProperty(example = "Group") - public String value; + @Schema(example = "Group") + public String description; } - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer id; - @ApiModelProperty(example = "000000009") + @Schema(example = "000000009") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "p_sav") + @Schema(example = "p_sav") public String productName; public GetGroupsGroupIdAccountsSavingStatus status; public GetGroupsGroupIdAccountsSavingCurrency currency; @@ -427,27 +426,27 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsMemberLoanStatus() {} - @ApiModelProperty(example = "200") + @Schema(example = "200") public Integer id; - @ApiModelProperty(example = "loanStatusType.approved") + @Schema(example = "loanStatusType.approved") public String code; - @ApiModelProperty(example = "Approved") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Approved") + public String description; + @Schema(example = "false") public Boolean pendingApproval; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } @@ -455,21 +454,21 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsMemberLoanType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "accountType.jlg") + @Schema(example = "accountType.jlg") public String code; - @ApiModelProperty(example = "JLG") - public String value; + @Schema(example = "JLG") + public String description; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "000000004") + @Schema(example = "000000004") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "testLoan") + @Schema(example = "testLoan") public String productName; public GetGroupsGroupIdAccountsMemberLoanStatus status; public GetGroupsGroupIdAccountsMemberLoanType loanType; @@ -479,13 +478,13 @@ final class GroupsApiResourceSwagger { private GetGroupsGroupIdAccountsMemberSavingsAccounts() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "000000003") + @Schema(example = "000000003") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "p_sav") + @Schema(example = "p_sav") public String productName; public GetGroupsGroupIdAccountsSavingAccounts.GetGroupsGroupIdAccountsSavingStatus status; public GetGroupsGroupIdAccountsSavingAccounts.GetGroupsGroupIdAccountsSavingCurrency currency; @@ -498,7 +497,7 @@ final class GroupsApiResourceSwagger { public Set memberSavingsAccounts; } - @ApiModel(value = "PostGroupsGroupIdRequest") + @Schema(description = "PostGroupsGroupIdRequest") public static final class PostGroupsGroupIdRequest { private PostGroupsGroupIdRequest() {} @@ -507,21 +506,21 @@ final class GroupsApiResourceSwagger { private PostGroupsGroupIdClients() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer destinationGroupId; public Set clients; } - @ApiModel(value = "PostGroupsGroupIdResponse") + @Schema(description = "PostGroupsGroupIdResponse") public static final class PostGroupsGroupIdResponse { private PostGroupsGroupIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java index 3c545d961..ea1e0bd60 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java @@ -29,15 +29,15 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartS import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.periodTypeParamName; import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.toPeriodParamName; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -71,9 +71,7 @@ import org.springframework.stereotype.Component; @Path("/interestratecharts/{chartId}/chartslabs") @Component @Scope("singleton") -@Api(tags = { "Interest Rate Slab (A.K.A interest bands)" }) -@SwaggerDefinition(tags = { - @Tag(name = "Interest Rate Slab (A.K.A interest bands)", description = "The slabs a.k.a interest bands are associated with Interest Rate Chart. These bands allow to define different interest rates for different deposit term periods.") }) +@Tag(name = "Interest Rate Slab (A.K.A interest bands)", description = "The slabs a.k.a interest bands are associated with Interest Rate Chart. These bands allow to define different interest rates for different deposit term periods.") public class InterestRateChartSlabsApiResource { private final InterestRateChartSlabReadPlatformService interestRateChartSlabReadPlatformService; @@ -112,11 +110,12 @@ public class InterestRateChartSlabsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve all Slabs", httpMethod = "GET", notes = "Retrieve list of slabs associated with a chart\n" + "\n" + @Operation(summary = "Retrieve all Slabs", description = "Retrieve list of slabs associated with a chart\n" + "\n" + "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartSlabsApiResourceSwagger.GetInterestRateChartsChartIdChartSlabsResponse.class, responseContainer = "List") }) - public String retrieveAll(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.GetInterestRateChartsChartIdChartSlabsResponse.class)))) }) + public String retrieveAll(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); Collection chartSlabs = this.interestRateChartSlabReadPlatformService.retrieveAll(chartId); @@ -129,12 +128,12 @@ public class InterestRateChartSlabsApiResource { @Path("{chartSlabId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Slab", httpMethod = "GET", notes = "Retrieve a slab associated with an Interest rate chart\n" + "\n" + @Operation(summary = "Retrieve a Slab", description = "Retrieve a slab associated with an Interest rate chart\n" + "\n" + "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs/1\n") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartSlabsApiResourceSwagger.GetInterestRateChartsChartIdChartSlabsResponse.class) }) - public String retrieveOne(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, - @PathParam("chartSlabId") @ApiParam(value = "chartSlabId") final Long chartSlabId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.GetInterestRateChartsChartIdChartSlabsResponse.class))) }) + public String retrieveOne(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); @@ -150,15 +149,14 @@ public class InterestRateChartSlabsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Slab", httpMethod = "POST", notes = "Creates a new interest rate slab for an interest rate chart.\n" + @Operation(summary = "Create a Slab", description = "Creates a new interest rate slab for an interest rate chart.\n" + "Mandatory Fields\n" + "periodType, fromPeriod, annualInterestRate\n" + "Optional Fields\n" + "toPeriod and description\n" + "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsResponse.class) }) - public String create(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsResponse.class))) }) + public String create(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createInterestRateChartSlab(chartId) .withJson(apiRequestBodyAsJson).build(); @@ -172,14 +170,13 @@ public class InterestRateChartSlabsApiResource { @Path("{chartSlabId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Slab", httpMethod = "PUT", notes = "It updates the Slab from chart") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest.class) }) + @Operation(summary = "Update a Slab", description = "It updates the Slab from chart") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse.class) }) - public String update(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, - @PathParam("chartSlabId") @ApiParam(value = "chartSlabId") final Long chartSlabId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse.class))) }) + public String update(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateInterestRateChartSlab(chartId, chartSlabId) .withJson(apiRequestBodyAsJson).build(); @@ -193,11 +190,11 @@ public class InterestRateChartSlabsApiResource { @Path("{chartSlabId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Slab", httpMethod = "DELETE", notes = "Delete a Slab from a chart") + @Operation(summary = "Delete a Slab", description = "Delete a Slab from a chart") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartSlabsApiResourceSwagger.DeleteInterestRateChartsChartIdChartSlabsResponse.class) }) - public String delete(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, - @PathParam("chartSlabId") @ApiParam(value = "chartSlabId") final Long chartSlabId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.DeleteInterestRateChartsChartIdChartSlabsResponse.class))) }) + public String delete(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteInterestRateChartSlab(chartId, chartSlabId).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.toApiJsonSerializer.serialize(result); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResourceSwagger.java index 1223b6701..2cbe318f2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.interestratechart.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class InterestRateChartSlabsApiResourceSwagger { private InterestRateChartSlabsApiResourceSwagger() {} - @ApiModel(value = "GetInterestRateChartsChartIdChartSlabsResponse") + @Schema(description = "GetInterestRateChartsChartIdChartSlabsResponse") public static final class GetInterestRateChartsChartIdChartSlabsResponse { private GetInterestRateChartsChartIdChartSlabsResponse() {} @@ -42,80 +41,80 @@ final class InterestRateChartSlabsApiResourceSwagger { private GetInterestRateChartsChartIdChartSlabsEntityType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "InterestIncentiveEntityType.customer") + @Schema(example = "InterestIncentiveEntityType.customer") public Integer code; - @ApiModelProperty(example = "Customer") - public Integer value; + @Schema(example = "Customer") + public Integer description; } static final class GetInterestRateChartsChartIdChartSlabsAttributeName { private GetInterestRateChartsChartIdChartSlabsAttributeName() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "InterestIncentiveAttributeName.gender") + @Schema(example = "InterestIncentiveAttributeName.gender") public Integer code; - @ApiModelProperty(example = "Gender") - public Integer value; + @Schema(example = "Gender") + public Integer description; } static final class GetInterestRateChartsChartIdChartSlabsConditionType { private GetInterestRateChartsChartIdChartSlabsConditionType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "incentiveConditionType.equal") + @Schema(example = "incentiveConditionType.equal") public Integer code; - @ApiModelProperty(example = "equal") - public Integer value; + @Schema(example = "equal") + public Integer description; } static final class GetInterestRateChartsChartIdChartSlabsIncentiveType { private GetInterestRateChartsChartIdChartSlabsIncentiveType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "InterestIncentiveType.incentive") + @Schema(example = "InterestIncentiveType.incentive") public Integer code; - @ApiModelProperty(example = "Incentive") - public Integer value; + @Schema(example = "Incentive") + public Integer description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; public GetInterestRateChartsChartIdChartSlabsEntityType entityType; public GetInterestRateChartsChartIdChartSlabsAttributeName attributeName; public GetInterestRateChartsChartIdChartSlabsConditionType conditionType; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer attributeValue; - @ApiModelProperty(example = "FEMALE") + @Schema(example = "FEMALE") public String attributeValueDesc; public GetInterestRateChartsChartIdChartSlabsIncentiveType incentiveType; - @ApiModelProperty(example = "-1.000000") + @Schema(example = "-1.000000") public Float amount; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "5% interest from 1 day till 180 days of deposit") + @Schema(example = "5% interest from 1 day till 180 days of deposit") public String description; public InterestRateChartsApiResourceSwagger.GetInterestRateChartsTemplateResponse.GetInterestRateChartsTemplatePeriodTypes periodTypes; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromPeriod; - @ApiModelProperty(example = "180") + @Schema(example = "180") public Integer toPeriod; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Double annualInterestRate; public InterestRateChartsApiResourceSwagger.GetInterestRateChartsResponse.GetInterestRateChartsCurrency currency; public Set incentives; } - @ApiModel(value = "PostInterestRateChartsChartIdChartSlabsRequest") + @Schema(description = "PostInterestRateChartsChartIdChartSlabsRequest") public static final class PostInterestRateChartsChartIdChartSlabsRequest { private PostInterestRateChartsChartIdChartSlabsRequest() {} @@ -124,71 +123,71 @@ final class InterestRateChartSlabsApiResourceSwagger { private PostInterestRateChartsChartIdChartSlabsIncentives() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer entityType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer attributeName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer conditionType; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer attributeValue; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer incentiveType; - @ApiModelProperty(example = "-1") + @Schema(example = "-1") public Float amount; } - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer periodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromPeriod; - @ApiModelProperty(example = "180") + @Schema(example = "180") public Integer toPeriod; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Double annualInterestRate; - @ApiModelProperty(example = "5% interest from 1 day till 180 days of deposit") + @Schema(example = "5% interest from 1 day till 180 days of deposit") public String description; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; public Set incentives; } - @ApiModel(value = "PostInterestRateChartsChartIdChartSlabsResponse") + @Schema(description = "PostInterestRateChartsChartIdChartSlabsResponse") public static final class PostInterestRateChartsChartIdChartSlabsResponse { private PostInterestRateChartsChartIdChartSlabsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest") + @Schema(description = "PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest") public static final class PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest { private PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest() {} - @ApiModelProperty(example = "6") + @Schema(example = "6") public Double annualInterestRate; - @ApiModelProperty(example = "Interest rate changed to 6%") + @Schema(example = "Interest rate changed to 6%") public String description; } - @ApiModel(value = "PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse") + @Schema(description = "PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse") public static final class PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse { private PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest changes; } - @ApiModel(value = "DeleteInterestRateChartsChartIdChartSlabsResponse") + @Schema(description = "DeleteInterestRateChartsChartIdChartSlabsResponse") public static final class DeleteInterestRateChartsChartIdChartSlabsResponse { private DeleteInterestRateChartsChartIdChartSlabsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java index 5927459c7..4c4893db1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java @@ -26,15 +26,15 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartA import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.isPrimaryGroupingByAmountParamName; import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.nameParamName; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -70,9 +70,7 @@ import org.springframework.stereotype.Component; @Path("/interestratecharts") @Component @Scope("singleton") -@Api(tags = { "Interest Rate Chart" }) -@SwaggerDefinition(tags = { - @Tag(name = "Interest Rate Chart", description = "This defines an interest rate scheme that can be associated to a term deposit product. This will have a slab (band or range) of deposit periods and the associated interest rates applicable along with incentives for each band.") }) +@Tag(name = "Interest Rate Chart", description = "This defines an interest rate scheme that can be associated to a term deposit product. This will have a slab (band or range) of deposit periods and the associated interest rates applicable along with incentives for each band.") public class InterestRateChartsApiResource { private final InterestRateChartReadPlatformService chartReadPlatformService; @@ -101,10 +99,10 @@ public class InterestRateChartsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Chart Details Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for creating a chart. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Chart Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for creating a chart. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "interestratecharts/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartsApiResourceSwagger.GetInterestRateChartsTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.GetInterestRateChartsTemplateResponse.class))) }) public String template(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(InterestRateChartApiConstants.INTERESTRATE_CHART_RESOURCE_NAME); @@ -117,12 +115,12 @@ public class InterestRateChartsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve all Charts", httpMethod = "GET", notes = "Retrieve list of charts associated with a term deposit product(FD or RD).\n" + @Operation(summary = "Retrieve all Charts", description = "Retrieve list of charts associated with a term deposit product(FD or RD).\n" + "Example Requests:\n" + "\n" + "interestratecharts?productId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = InterestRateChartsApiResourceSwagger.GetInterestRateChartsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.GetInterestRateChartsResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId) { + @QueryParam("productId") @Parameter(description = "productId") final Long productId) { this.context.authenticatedUser().validateHasReadPermission(InterestRateChartApiConstants.INTERESTRATE_CHART_RESOURCE_NAME); @@ -136,11 +134,12 @@ public class InterestRateChartsApiResource { @Path("{chartId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Chart", httpMethod = "GET", notes = "It retrieves the Interest Rate Chart\n" + "Example Requests:\n" - + "\n" + "interestratecharts/1") + @Operation(summary = "Retrieve a Chart", description = "It retrieves the Interest Rate Chart\n" + "Example Requests:\n" + "\n" + + "interestratecharts/1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartsApiResourceSwagger.GetInterestRateChartsResponse.class) }) - public String retrieveOne(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.GetInterestRateChartsResponse.class))) }) + public String retrieveOne(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(InterestRateChartApiConstants.INTERESTRATE_CHART_RESOURCE_NAME); @@ -163,12 +162,11 @@ public class InterestRateChartsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Chart", httpMethod = "POST", notes = "Creates a new chart which can be attached to a term deposit products (FD or RD).") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InterestRateChartsApiResourceSwagger.PostInterestRateChartsRequest.class) }) + @Operation(summary = "Create a Chart", description = "Creates a new chart which can be attached to a term deposit products (FD or RD).") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.PostInterestRateChartsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartsApiResourceSwagger.PostInterestRateChartsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.PostInterestRateChartsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createInterestRateChart().withJson(apiRequestBodyAsJson).build(); @@ -181,13 +179,12 @@ public class InterestRateChartsApiResource { @Path("{chartId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Chart", notes = "It updates the Chart.", httpMethod = "PUT") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = InterestRateChartsApiResourceSwagger.PutInterestRateChartsChartIdRequest.class) }) + @Operation(summary = "Update a Chart", description = "It updates the chart") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.PutInterestRateChartsChartIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartsApiResourceSwagger.PutInterestRateChartsChartIdResponse.class) }) - public String update(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.PutInterestRateChartsChartIdResponse.class))) }) + public String update(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateInterestRateChart(chartId).withJson(apiRequestBodyAsJson) .build(); @@ -201,10 +198,10 @@ public class InterestRateChartsApiResource { @Path("{chartId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Chart", notes = "It deletes the chart", httpMethod = "DELETE") + @Operation(summary = "Delete a Chart", description = "It deletes the chart") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = InterestRateChartsApiResourceSwagger.DeleteInterestRateChartsChartIdResponse.class) }) - public String delete(@PathParam("chartId") @ApiParam(value = "chartId") final Long chartId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartsApiResourceSwagger.DeleteInterestRateChartsChartIdResponse.class))) }) + public String delete(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteInterestRateChart(chartId).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.toApiJsonSerializer.serialize(result); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResourceSwagger.java index f5652cca1..b7811aaf6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.interestratechart.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class InterestRateChartsApiResourceSwagger { private InterestRateChartsApiResourceSwagger() {} - @ApiModel(value = "GetInterestRateChartsTemplateResponse") + @Schema(description = "GetInterestRateChartsTemplateResponse") public static final class GetInterestRateChartsTemplateResponse { private GetInterestRateChartsTemplateResponse() {} @@ -39,18 +38,18 @@ final class InterestRateChartsApiResourceSwagger { private GetInterestRateChartsTemplatePeriodTypes() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.days") + @Schema(example = "interestChartPeriodType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } public Set periodTypes; } - @ApiModel(value = "GetInterestRateChartsResponse") + @Schema(description = "GetInterestRateChartsResponse") public static final class GetInterestRateChartsResponse { private GetInterestRateChartsResponse() {} @@ -59,12 +58,12 @@ final class InterestRateChartsApiResourceSwagger { private GetInterestRateChartsChartSlabs() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; public GetInterestRateChartsTemplateResponse.GetInterestRateChartsTemplatePeriodTypes periodTypes; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromPeriod; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer annualInterestRate; public GetInterestRateChartsCurrency currency; } @@ -73,85 +72,85 @@ final class InterestRateChartsApiResourceSwagger { private GetInterestRateChartsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "[2014, 1, 1]") + @Schema(example = "[2014, 1, 1]") public LocalDate fromDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsProductId; - @ApiModelProperty(example = "Fixed Deposit Product 001") + @Schema(example = "Fixed Deposit Product 001") public String savingsProductName; public Set chartSlabs; } - @ApiModel(value = "PostInterestRateChartsRequest") + @Schema(description = "PostInterestRateChartsRequest") public static final class PostInterestRateChartsRequest { private PostInterestRateChartsRequest() {} - @ApiModelProperty(example = "Chart - 2014") + @Schema(example = "Chart - 2014") public String name; - @ApiModelProperty(example = "This chart is applicable for year 2014") + @Schema(example = "This chart is applicable for year 2014") public String description; - @ApiModelProperty(example = "Document") + @Schema(example = "Document") public String type; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 Jan 2014") + @Schema(example = "01 Jan 2014") public String fromDate; } - @ApiModel(value = "PostInterestRateChartsResponse") + @Schema(description = "PostInterestRateChartsResponse") public static final class PostInterestRateChartsResponse { private PostInterestRateChartsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutInterestRateChartsChartIdRequest") + @Schema(description = "PutInterestRateChartsChartIdRequest") public static final class PutInterestRateChartsChartIdRequest { private PutInterestRateChartsChartIdRequest() {} - @ApiModelProperty(example = "Interest rate chart for 2014") + @Schema(example = "Interest rate chart for 2014") public String name; - @ApiModelProperty(example = "Interest rate chart for 2014") + @Schema(example = "Interest rate chart for 2014") public String description; } - @ApiModel(value = "PutInterestRateChartsChartIdResponse") + @Schema(description = "PutInterestRateChartsChartIdResponse") public static final class PutInterestRateChartsChartIdResponse { private PutInterestRateChartsChartIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "DeleteInterestRateChartsChartIdResponse") + @Schema(description = "DeleteInterestRateChartsChartIdResponse") public static final class DeleteInterestRateChartsChartIdResponse { private DeleteInterestRateChartsChartIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java index cb7cecd05..e27f62f13 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -66,11 +66,9 @@ import org.springframework.stereotype.Component; @Path("/loans/{loanId}/charges") @Component @Scope("singleton") -@Api(tags = { "Loan Charges" }) -@SwaggerDefinition(tags = { - @Tag(name = "Loan Charges", description = "Its typical for MFIs to add extra costs for their loan products. They can be either Fees or Penalties.\n" - + "\n" - + "Loan Charges are instances of Charges and represent either fees and penalties for loan products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Loan) are described here") }) +@Tag(name = "Loan Charges", description = "Its typical for MFIs to add extra costs for their loan products. They can be either Fees or Penalties.\n" + + "\n" + + "Loan Charges are instances of Charges and represent either fees and penalties for loan products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Loan) are described here") public class LoanChargesApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -107,11 +105,11 @@ public class LoanChargesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Loan Charges", httpMethod = "GET", notes = "It lists all the Loan Charges specific to a Loan \n\n" - + "Example Requests:\n" + "\n" + "loans/1/charges\n" + "\n" + "\n" + "loans/1/charges?fields=name,amountOrPercentage") + @Operation(summary = "List Loan Charges", description = "It lists all the Loan Charges specific to a Loan \n\n" + "Example Requests:\n" + + "\n" + "loans/1/charges\n" + "\n" + "\n" + "loans/1/charges?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = LoanChargesApiResourceSwagger.GetLoansLoanIdChargesChargeIdResponse.class) }) - public String retrieveAllLoanCharges(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = LoanChargesApiResourceSwagger.GetLoansLoanIdChargesChargeIdResponse.class)))) }) + public String retrieveAllLoanCharges(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -126,11 +124,12 @@ public class LoanChargesApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Loan Charges Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "loans/1/charges/template\n" + "\n") + @Operation(summary = "Retrieve Loan Charges Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "loans/1/charges/template\n" + "\n") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanChargesApiResourceSwagger.GetLoansLoanIdChargesTemplateResponse.class) }) - public String retrieveTemplate(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.GetLoansLoanIdChargesTemplateResponse.class))) }) + public String retrieveTemplate(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -146,12 +145,12 @@ public class LoanChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Loan Charge", httpMethod = "GET", notes = "Retrieves Loan Charge according to the Loan ID and Charge ID" + @Operation(summary = "Retrieve a Loan Charge", description = "Retrieves Loan Charge according to the Loan ID and Charge ID" + "Example Requests:\n" + "\n" + "/loans/1/charges/1\n" + "\n" + "\n" + "/loans/1/charges/1?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanChargesApiResourceSwagger.GetLoansLoanIdChargesChargeIdResponse.class) }) - public String retrieveLoanCharge(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long loanChargeId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.GetLoansLoanIdChargesChargeIdResponse.class))) }) + public String retrieveLoanCharge(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long loanChargeId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -169,14 +168,13 @@ public class LoanChargesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Loan Charge", httpMethod = "POST", notes = "It Creates a Loan Charge") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesRequest.class) }) + @Operation(summary = "Create a Loan Charge", description = "It Creates a Loan Charge") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesResponse.class) }) - public String executeLoanCharge(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesResponse.class))) }) + public String executeLoanCharge(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandProcessingResult result = null; if (is(commandParam, "pay")) { @@ -196,14 +194,13 @@ public class LoanChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Loan Charge", httpMethod = "PUT", notes = "Currently Loan Charges may be updated only if the Loan is not yet approved") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanChargesApiResourceSwagger.PutLoansLoanIdChargesChargeIdRequest.class) }) + @Operation(summary = "Update a Loan Charge", description = "Currently Loan Charges may be updated only if the Loan is not yet approved") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.PutLoansLoanIdChargesChargeIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanChargesApiResourceSwagger.PutLoansLoanIdChargesChargeIdResponse.class) }) - public String updateLoanCharge(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long loanChargeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.PutLoansLoanIdChargesChargeIdResponse.class))) }) + public String updateLoanCharge(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long loanChargeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateLoanCharge(loanId, loanChargeId) .withJson(apiRequestBodyAsJson).build(); @@ -217,15 +214,14 @@ public class LoanChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Pay Loan Charge", httpMethod = "POST", notes = "Loan Charge will be paid if the loan is linked with a savings account") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesChargeIdRequest.class) }) + @Operation(summary = "Pay Loan Charge", description = "Loan Charge will be paid if the loan is linked with a savings account") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesChargeIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesChargeIdResponse.class) }) - public String executeLoanCharge(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long loanChargeId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.PostLoansLoanIdChargesChargeIdResponse.class))) }) + public String executeLoanCharge(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long loanChargeId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); CommandProcessingResult result = null; @@ -248,11 +244,11 @@ public class LoanChargesApiResource { @Path("{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Loan Charge", httpMethod = "DELETE", notes = "Note: Currently, A Loan Charge may only be removed from Loans that are not yet approved.") + @Operation(summary = "Delete a Loan Charge", description = "Note: Currently, A Loan Charge may only be removed from Loans that are not yet approved.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanChargesApiResourceSwagger.DeleteLoansLoanIdChargesChargeIdResponse.class) }) - public String deleteLoanCharge(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long loanChargeId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanChargesApiResourceSwagger.DeleteLoansLoanIdChargesChargeIdResponse.class))) }) + public String deleteLoanCharge(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long loanChargeId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteLoanCharge(loanId, loanChargeId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResourceSwagger.java index 8e3b3ef22..c40d27572 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class LoanChargesApiResourceSwagger { private LoanChargesApiResourceSwagger() {} - @ApiModel(value = "GetLoansLoanIdChargesChargeIdResponse") + @Schema(description = "GetLoansLoanIdChargesChargeIdResponse") public static final class GetLoansLoanIdChargesChargeIdResponse { private GetLoansLoanIdChargesChargeIdResponse() {} @@ -38,74 +37,74 @@ final class LoanChargesApiResourceSwagger { private GetLoanChargeTimeType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeTimeType.disbursement") + @Schema(example = "chargeTimeType.disbursement") public String code; - @ApiModelProperty(example = "Disbursement") - public String value; + @Schema(example = "Disbursement") + public String description; } static final class GetLoanChargeCalculationType { private GetLoanChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetLoanChargeCurrency { private GetLoanChargeCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeId; - @ApiModelProperty(example = "Loan Processing fee") + @Schema(example = "Loan Processing fee") public String name; public GetLoanChargeTimeType chargeTimeType; public GetLoanChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetLoanChargeCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOutstanding; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOrPercentage; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = "GetLoansLoanIdChargesTemplateResponse") + @Schema(description = "GetLoansLoanIdChargesTemplateResponse") public static final class GetLoansLoanIdChargesTemplateResponse { private GetLoansLoanIdChargesTemplateResponse() {} @@ -118,158 +117,158 @@ final class LoanChargesApiResourceSwagger { private GetLoanChargeTemplateChargeTimeType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetLoanChargeTemplateChargeAppliesTo { private GetLoanChargeTemplateChargeAppliesTo() {} - @ApiModelProperty(example = "1 ") + @Schema(example = "1 ") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.loan") + @Schema(example = "chargeAppliesTo.loan") public String code; - @ApiModelProperty(example = "Loan") - public String value; + @Schema(example = "Loan") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Collection fee") + @Schema(example = "Collection fee") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; public GetLoansLoanIdChargesChargeIdResponse.GetLoanChargeCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; public GetLoanChargeTemplateChargeTimeType chargeTimeType; public GetLoanChargeTemplateChargeAppliesTo chargeAppliesTo; public GetLoansLoanIdChargesChargeIdResponse.GetLoanChargeCalculationType chargeCalculationType; } - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; public Set chargeOptions; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = " PostLoansLoanIdChargesRequest") + @Schema(description = " PostLoansLoanIdChargesRequest") public static final class PostLoansLoanIdChargesRequest { private PostLoansLoanIdChargesRequest() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer chargeId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "29 April 2013") + @Schema(example = "29 April 2013") public String dueDate; } - @ApiModel(value = " PostLoansLoanIdChargesResponse") + @Schema(description = " PostLoansLoanIdChargesResponse") public static final class PostLoansLoanIdChargesResponse { private PostLoansLoanIdChargesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long loanId; - @ApiModelProperty(example = "31") + @Schema(example = "31") public Integer resourceId; } - @ApiModel(value = " PutLoansLoanIdChargesChargeIdRequest") + @Schema(description = " PutLoansLoanIdChargesChargeIdRequest") public static final class PutLoansLoanIdChargesChargeIdRequest { private PutLoansLoanIdChargesChargeIdRequest() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "60") + @Schema(example = "60") public Float amount; - @ApiModelProperty(example = "27 March 2013") + @Schema(example = "27 March 2013") public String dueDate; } - @ApiModel(value = "PutLoansLoanIdChargesChargeIdResponse") + @Schema(description = "PutLoansLoanIdChargesChargeIdResponse") public static final class PutLoansLoanIdChargesChargeIdResponse { private PutLoansLoanIdChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long loanId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer resourceId; public PutLoansLoanIdChargesChargeIdRequest changes; } - @ApiModel(value = "PostLoansLoanIdChargesChargeIdRequest") + @Schema(description = "PostLoansLoanIdChargesChargeIdRequest") public static final class PostLoansLoanIdChargesChargeIdRequest { private PostLoansLoanIdChargesChargeIdRequest() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "19 September 2013") + @Schema(example = "19 September 2013") public String transactionDate; } - @ApiModel(value = "PostLoansLoanIdChargesChargeIdResponse") + @Schema(description = "PostLoansLoanIdChargesChargeIdResponse") public static final class PostLoansLoanIdChargesChargeIdResponse { private PostLoansLoanIdChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long clientId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Long loanId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long savingsId; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer resourceId; } - @ApiModel(value = "DeleteLoansLoanIdChargesChargeIdResponse") + @Schema(description = "DeleteLoansLoanIdChargesChargeIdResponse") public static final class DeleteLoansLoanIdChargesChargeIdResponse { private DeleteLoansLoanIdChargesChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long loanId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java index 425d67ec9..6d793b72a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.HashSet; import javax.ws.rs.Consumes; import javax.ws.rs.POST; @@ -55,9 +54,7 @@ import org.springframework.stereotype.Component; @Path("/loans/{loanId}/schedule") @Component @Scope("singleton") -@Api(tags = { "Loan Rescheduling" }) -@SwaggerDefinition(tags = { - @Tag(name = "Loan Rescheduling", description = "Loan Term Variations provides the ability to change due dates, amounts and number of instalments before loan approval.") }) +@Tag(name = "Loan Rescheduling", description = "Loan Term Variations provides the ability to change due dates, amounts and number of instalments before loan approval.") public class LoanScheduleApiResource { private final String resourceNameForPermissions = "LOAN"; @@ -83,18 +80,17 @@ public class LoanScheduleApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Calculate loan repayment schedule based on Loan term variations | Updates loan repayment schedule based on Loan term variations | Updates loan repayment schedule by removing Loan term variations", httpMethod = "POST", notes = "Calculate loan repayment schedule based on Loan term variations:\n\n" + @Operation(summary = "Calculate loan repayment schedule based on Loan term variations | Updates loan repayment schedule based on Loan term variations | Updates loan repayment schedule by removing Loan term variations", description = "Calculate loan repayment schedule based on Loan term variations:\n\n" + "Mandatory Fields: exceptions,locale,dateFormat\n\n" + "Updates loan repayment schedule based on Loan term variations:\n\n" + "Mandatory Fields: exceptions,locale,dateFormat\n\n" + "Updates loan repayment schedule by removing Loan term variations:\n\n" + "It updates the loan repayment schedule by removing Loan term variations\n\n" + "Showing request/response for 'Updates loan repayment schedule by removing Loan term variations'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanScheduleApiResourceSwagger.PostLoansLoanIdScheduleRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanScheduleApiResourceSwagger.PostLoansLoanIdScheduleRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanScheduleApiResourceSwagger.PostLoansLoanIdScheduleResponse.class) }) - public String calculateLoanScheduleOrSubmitVariableSchedule(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanScheduleApiResourceSwagger.PostLoansLoanIdScheduleResponse.class))) }) + public String calculateLoanScheduleOrSubmitVariableSchedule(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandRequest = null; if (is(commandParam, "calculateLoanSchedule")) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResourceSwagger.java index 6528b0bb2..8d6edb9d3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; /** @@ -29,13 +28,13 @@ final class LoanScheduleApiResourceSwagger { private LoanScheduleApiResourceSwagger() {} - @ApiModel(value = "PostLoansLoanIdScheduleRequest") + @Schema(description = "PostLoansLoanIdScheduleRequest") public static final class PostLoansLoanIdScheduleRequest { private PostLoansLoanIdScheduleRequest() {} } - @ApiModel(value = "PostLoansLoanIdScheduleResponse") + @Schema(description = "PostLoansLoanIdScheduleResponse") public static final class PostLoansLoanIdScheduleResponse { private PostLoansLoanIdScheduleResponse() {} @@ -44,11 +43,11 @@ final class LoanScheduleApiResourceSwagger { private PostLoanChanges() {} - @ApiModelProperty(example = "[21, 22]") + @Schema(example = "[21, 22]") public List removedEntityIds; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; public PostLoanChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java index bf23d9c7c..b3951fa7c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -66,9 +65,7 @@ import org.springframework.stereotype.Component; @Path("/loans/{loanId}/transactions") @Component @Scope("singleton") -@Api(tags = { "Loan Transactions" }) -@SwaggerDefinition(tags = { - @Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.") }) +@Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.") public class LoanTransactionsApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -108,16 +105,16 @@ public class LoanTransactionsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Loan Transaction Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Loan Transaction Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n\n" + "Example Request:\n" + "\n" + "loans/1/transactions/template?command=repayment") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanTransactionsApiResourceSwagger.GetLoansLoanIdTransactionsTemplateResponse.class) }) - public String retrieveTransactionTemplate(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo, - @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat, - @QueryParam("transactionDate") @ApiParam(value = "transactionDate") final DateParam transactionDateParam, - @QueryParam("locale") @ApiParam(value = "locale") final String locale) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanTransactionsApiResourceSwagger.GetLoansLoanIdTransactionsTemplateResponse.class))) }) + public String retrieveTransactionTemplate(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, + @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat, + @QueryParam("transactionDate") @Parameter(description = "transactionDate") final DateParam transactionDateParam, + @QueryParam("locale") @Parameter(description = "locale") final String locale) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -170,12 +167,13 @@ public class LoanTransactionsApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Transaction Details", httpMethod = "GET", notes = "Retrieves a Transaction Details\n\n" - + "Example Request:\n" + "\n" + "loans/5/transactions/3") + @Operation(summary = "Retrieve a Transaction Details", description = "Retrieves a Transaction Details\n\n" + "Example Request:\n" + "\n" + + "loans/5/transactions/3") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanTransactionsApiResourceSwagger.GetLoansLoanIdTransactionsTransactionIdResponse.class) }) - public String retrieveTransaction(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanTransactionsApiResourceSwagger.GetLoansLoanIdTransactionsTransactionIdResponse.class))) }) + public String retrieveTransaction(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -193,15 +191,14 @@ public class LoanTransactionsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Make a Repayment | Make a Refund of an Active Loan by Cash | Foreclosure of an Active Loan | Waive Interest | Write-off Loan | Make Recovery Payment | Undo Loan Write-off Transaction", httpMethod = "POST", notes = "Make Recovery Payment:\n\n" + @Operation(summary = "Make a Repayment | Make a Refund of an Active Loan by Cash | Foreclosure of an Active Loan | Waive Interest | Write-off Loan | Make Recovery Payment | Undo Loan Write-off Transaction", description = "Make Recovery Payment:\n\n" + "This API allows collecting recovery payments for written-off loans") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsResponse.class) }) - public String executeLoanTransaction(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsResponse.class))) }) + public String executeLoanTransaction(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -246,15 +243,14 @@ public class LoanTransactionsApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Adjust a Transaction", httpMethod = "POST", notes = "Note: there is no need to specify command={transactionType} parameter.\n\n" + @Operation(summary = "Adjust a Transaction", description = "Note: there is no need to specify command={transactionType} parameter.\n\n" + "Mandatory Fields: transactionDate, transactionAmount") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsTransactionIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsTransactionIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsTransactionIdResponse.class) }) - public String adjustLoanTransaction(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsTransactionIdResponse.class))) }) + public String adjustLoanTransaction(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); final CommandWrapper commandRequest = builder.adjustTransaction(loanId, transactionId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResourceSwagger.java index 0c3ee82a6..53b1c669f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; /** @@ -29,7 +28,7 @@ final class LoanTransactionsApiResourceSwagger { private LoanTransactionsApiResourceSwagger() {} - @ApiModel(value = "GetLoansLoanIdTransactionsTemplateResponse") + @Schema(description = "GetLoansLoanIdTransactionsTemplateResponse") public static final class GetLoansLoanIdTransactionsTemplateResponse { private GetLoansLoanIdTransactionsTemplateResponse() {} @@ -38,47 +37,47 @@ final class LoanTransactionsApiResourceSwagger { private GetLoansTransactionType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "loanTransactionType.repayment") + @Schema(example = "loanTransactionType.repayment") public String code; - @ApiModelProperty(example = "Repayment") - public String value; + @Schema(example = "Repayment") + public String description; } static final class GetLoansTotal { private GetLoansTotal() {} - @ApiModelProperty(example = "XOF") + @Schema(example = "XOF") public String currencyCode; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer digitsAfterDecimal; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "471") + @Schema(example = "471") public Float amount; - @ApiModelProperty(example = "CFA Franc BCEAO") + @Schema(example = "CFA Franc BCEAO") public String defaultName; - @ApiModelProperty(example = "currency.XOF") + @Schema(example = "currency.XOF") public String nameCode; - @ApiModelProperty(example = "CFA") + @Schema(example = "CFA") public String displaySymbol; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean zero; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean greaterThanZero; - @ApiModelProperty(example = "471 CFA") + @Schema(example = "471 CFA") public String displaySymbolValue; } public GetLoansTransactionType transactionType; - @ApiModelProperty(example = "[2009, 8, 1]") + @Schema(example = "[2009, 8, 1]") public LocalDate date; public GetLoansTotal total; } - @ApiModel(value = "GetLoansLoanIdTransactionsTransactionIdResponse") + @Schema(description = "GetLoansLoanIdTransactionsTransactionIdResponse") public static final class GetLoansLoanIdTransactionsTransactionIdResponse { private GetLoansLoanIdTransactionsTransactionIdResponse() {} @@ -87,27 +86,27 @@ final class LoanTransactionsApiResourceSwagger { private GetLoansType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "loanTransactionType.repayment") + @Schema(example = "loanTransactionType.repayment") public String code; - @ApiModelProperty(example = "Repayment") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Repayment") + public String description; + @Schema(example = "false") public Boolean disbursement; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean repaymentAtDisbursement; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean repayment; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean contra; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waiveInterest; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waiveCharges; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean writeOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean recoveryRepayment; } @@ -115,76 +114,76 @@ final class LoanTransactionsApiResourceSwagger { private GetLoansCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; public GetLoansType type; - @ApiModelProperty(example = "[2012, 5, 14]") + @Schema(example = "[2012, 5, 14]") public LocalDate date; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean manuallyReversed; public GetLoansCurrency currency; - @ApiModelProperty(example = "559.88") + @Schema(example = "559.88") public Double amount; - @ApiModelProperty(example = "559.88") + @Schema(example = "559.88") public Double interestPortion; } - @ApiModel(value = "PostLoansLoanIdTransactionsRequest") + @Schema(description = "PostLoansLoanIdTransactionsRequest") public static final class PostLoansLoanIdTransactionsRequest { private PostLoansLoanIdTransactionsRequest() {} } - @ApiModel(value = "PostLoansLoanIdTransactionsResponse") + @Schema(description = "PostLoansLoanIdTransactionsResponse") public static final class PostLoansLoanIdTransactionsResponse { private PostLoansLoanIdTransactionsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Integer resourceId; } - @ApiModel(value = "PostLoansLoanIdTransactionsTransactionIdRequest") + @Schema(description = "PostLoansLoanIdTransactionsTransactionIdRequest") public static final class PostLoansLoanIdTransactionsTransactionIdRequest { private PostLoansLoanIdTransactionsTransactionIdRequest() {} - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "25 May 2012") + @Schema(example = "25 May 2012") public String transactionDate; - @ApiModelProperty(example = "50,000.00") + @Schema(example = "50,000.00") public Double transactionAmount; - @ApiModelProperty(example = "An optional note about why your adjusting or changing the transaction.") + @Schema(example = "An optional note about why your adjusting or changing the transaction.") public String note; } - @ApiModel(value = "PostLoansLoanIdTransactionsTransactionIdResponse") + @Schema(description = "PostLoansLoanIdTransactionsTransactionIdResponse") public static final class PostLoansLoanIdTransactionsTransactionIdResponse { private PostLoansLoanIdTransactionsTransactionIdResponse() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java index fe46eebfc..1f4c7f6e8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java @@ -23,15 +23,14 @@ import static org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations import com.google.gson.JsonElement; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; @@ -146,67 +145,57 @@ import org.springframework.util.CollectionUtils; @Path("/loans") @Component @Scope("singleton") -@Api(tags = { "Loans" }) -@SwaggerDefinition(tags = { - @Tag(name = "Loans", description = "The API concept of loans models the loan application process and the loan contract/monitoring process.\n" - + "\n" + "Field Descriptions\n" + "accountNo\n" - + "The account no. associated with this loan. Is auto generated if not provided at loan application creation time.\n" - + "externalId\n" + "A place to put an external reference for this loan e.g. The ID another system uses.\n" - + "If provided, it must be unique.\n" + "fundId\n" + "Optional: For associating a loan with a given fund.\n" - + "loanOfficerId\n" + "Optional: For associating a loan with a given staff member who is a loan officer.\n" - + "loanPurposeId\n" - + "Optional: For marking a loan with a given loan purpose option. Loan purposes are configurable and can be setup by system admin through code/code values screens.\n" - + "principal\n" + "The loan amount to be disbursed to through loan.\n" + "loanTermFrequency\n" + "The length of loan term\n" - + "Used like: loanTermFrequency loanTermFrequencyType\n" + "e.g. 12 Months\n" + "loanTermFrequencyType\n" - + "The loan term period to use. Used like: loanTermFrequency loanTermFrequencyType\n" - + "e.g. 12 Months Example Values: 0=Days, 1=Weeks, 2=Months, 3=Years\n" + "numberOfRepayments\n" - + "Number of installments to repay.\n" + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" - + "e.g. 10 (repayments) Every 12 Weeks\n" + "repaymentEvery\n" - + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + "e.g. 10 (repayments) Every 12 Weeks\n" - + "repaymentFrequencyType\n" + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" - + "e.g. 10 (repayments) Every 12 Weeks \n" + "Example Values: 0=Days, 1=Weeks, 2=Months\n" + "interestRatePerPeriod\n" - + "Interest Rate.\n" + "Used like: interestRatePerPeriod % interestRateFrequencyType - interestType\n" - + "e.g. 12.0000% Per year - Declining Balance\n" + "interestRateFrequencyType\n" - + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" - + "e.g. 12.0000% Per year - Declining Balance \n" + "Example Values: 2=Per month, 3=Per year\n" - + "graceOnPrincipalPayment\n" - + "Optional: Integer - represents the number of repayment periods that grace should apply to the principal component of a repayment period.\n" - + "graceOnInterestPayment\n" - + "Optional: Integer - represents the number of repayment periods that grace should apply to the interest component of a repayment period. Interest is still calculated but offset to later repayment periods.\n" - + "graceOnInterestCharged\n" - + "Optional: Integer - represents the number of repayment periods that should be interest-free.\n" - + "graceOnArrearsAgeing\n" - + "Optional: Integer - Used in Arrears calculation to only take into account loans that are more than graceOnArrearsAgeing days overdue.\n" - + "interestChargedFromDate\n" + "Optional: Date - The date from with interest is to start being charged.\n" - + "expectedDisbursementDate\n" - + "The proposed disbursement date of the loan so a proposed repayment schedule can be provided.\n" + "submittedOnDate\n" - + "The date the loan application was submitted by applicant.\n" + "linkAccountId\n" - + "The Savings Account id for linking with loan account for payments.\n" + "amortizationType\n" - + "Example Values: 0=Equal principle payments, 1=Equal installments\n" + "interestType\n" - + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" - + "e.g. 12.0000% Per year - Declining Balance \n" + "Example Values: 0=Declining Balance, 1=Flat\n" - + "interestCalculationPeriodType\n" + "Example Values: 0=Daily, 1=Same as repayment period\n" - + "allowPartialPeriodInterestCalcualtion\n" - + "This value will be supported along with interestCalculationPeriodType as Same as repayment period to calculate interest for partial periods. Example: Interest charged from is 5th of April , Principal is 10000 and interest is 1% per month then the interest will be (10000 * 1%)* (25/30) , it calculates for the month first then calculates exact periods between start date and end date(can be a decimal)\n" - + "inArrearsTolerance\n" - + "The amount that can be 'waived' at end of all loan payments because it is too small to worry about.\n" - + "This is also the tolerance amount assessed when determining if a loan is in arrears.\n" - + "transactionProcessingStrategyId\n" - + "An enumeration that indicates the type of transaction processing strategy to be used. This relates to functionality that is also known as Payment Application Logic.\n" - + "A number of out of the box approaches exist, some are custom to specific MFIs, some are more general and indicate the order in which payments are processed.\n" - + "\n" - + "Refer to the Payment Application Logic / Transaction Processing Strategy section in the appendix for more detailed overview of each available payment application logic provided out of the box.\n" - + "\n" + "List of current approaches:\n" + "1 = Mifos style (Similar to Old Mifos)\n" - + "2 = Heavensfamily (Custom MFI approach)\n" + "3 = Creocore (Custom MFI approach)\n" + "4 = RBI (India)\n" - + "5 = Principal Interest Penalties Fees Order\n" + "6 = Interest Principal Penalties Fees Order\n" - + "7 = Early Payment Strategy\n" + "loanType\n" + "To represent different type of loans.\n" - + "At present there are three type of loans are supported. \n" + "Available loan types:\n" - + "individual: Loan given to individual member\n" + "group: Loan given to group as a whole\n" - + "jlg: Joint liability group loan given to members in a group on individual basis. JLG loan can be given to one or more members in a group.\n" - + "recalculationRestFrequencyDate\n" - + "Specifies rest frequency start date for interest recalculation. This date must be before or equal to disbursement date\n" - + "recalculationCompoundingFrequencyDate\n" - + "Specifies compounding frequency start date for interest recalculation. This date must be equal to disbursement date") }) +@Tag(name = "Loans", description = "The API concept of loans models the loan application process and the loan contract/monitoring process.\n" + + "\n" + "Field Descriptions\n" + "accountNo\n" + + "The account no. associated with this loan. Is auto generated if not provided at loan application creation time.\n" + + "externalId\n" + "A place to put an external reference for this loan e.g. The ID another system uses.\n" + + "If provided, it must be unique.\n" + "fundId\n" + "Optional: For associating a loan with a given fund.\n" + "loanOfficerId\n" + + "Optional: For associating a loan with a given staff member who is a loan officer.\n" + "loanPurposeId\n" + + "Optional: For marking a loan with a given loan purpose option. Loan purposes are configurable and can be setup by system admin through code/code values screens.\n" + + "principal\n" + "The loan amount to be disbursed to through loan.\n" + "loanTermFrequency\n" + "The length of loan term\n" + + "Used like: loanTermFrequency loanTermFrequencyType\n" + "e.g. 12 Months\n" + "loanTermFrequencyType\n" + + "The loan term period to use. Used like: loanTermFrequency loanTermFrequencyType\n" + + "e.g. 12 Months Example Values: 0=Days, 1=Weeks, 2=Months, 3=Years\n" + "numberOfRepayments\n" + + "Number of installments to repay.\n" + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + + "e.g. 10 (repayments) Every 12 Weeks\n" + "repaymentEvery\n" + + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + "e.g. 10 (repayments) Every 12 Weeks\n" + + "repaymentFrequencyType\n" + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + + "e.g. 10 (repayments) Every 12 Weeks \n" + "Example Values: 0=Days, 1=Weeks, 2=Months\n" + "interestRatePerPeriod\n" + + "Interest Rate.\n" + "Used like: interestRatePerPeriod % interestRateFrequencyType - interestType\n" + + "e.g. 12.0000% Per year - Declining Balance\n" + "interestRateFrequencyType\n" + + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" + "e.g. 12.0000% Per year - Declining Balance \n" + + "Example Values: 2=Per month, 3=Per year\n" + "graceOnPrincipalPayment\n" + + "Optional: Integer - represents the number of repayment periods that grace should apply to the principal component of a repayment period.\n" + + "graceOnInterestPayment\n" + + "Optional: Integer - represents the number of repayment periods that grace should apply to the interest component of a repayment period. Interest is still calculated but offset to later repayment periods.\n" + + "graceOnInterestCharged\n" + "Optional: Integer - represents the number of repayment periods that should be interest-free.\n" + + "graceOnArrearsAgeing\n" + + "Optional: Integer - Used in Arrears calculation to only take into account loans that are more than graceOnArrearsAgeing days overdue.\n" + + "interestChargedFromDate\n" + "Optional: Date - The date from with interest is to start being charged.\n" + + "expectedDisbursementDate\n" + "The proposed disbursement date of the loan so a proposed repayment schedule can be provided.\n" + + "submittedOnDate\n" + "The date the loan application was submitted by applicant.\n" + "linkAccountId\n" + + "The Savings Account id for linking with loan account for payments.\n" + "amortizationType\n" + + "Example Values: 0=Equal principle payments, 1=Equal installments\n" + "interestType\n" + + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" + "e.g. 12.0000% Per year - Declining Balance \n" + + "Example Values: 0=Declining Balance, 1=Flat\n" + "interestCalculationPeriodType\n" + + "Example Values: 0=Daily, 1=Same as repayment period\n" + "allowPartialPeriodInterestCalcualtion\n" + + "This value will be supported along with interestCalculationPeriodType as Same as repayment period to calculate interest for partial periods. Example: Interest charged from is 5th of April , Principal is 10000 and interest is 1% per month then the interest will be (10000 * 1%)* (25/30) , it calculates for the month first then calculates exact periods between start date and end date(can be a decimal)\n" + + "inArrearsTolerance\n" + "The amount that can be 'waived' at end of all loan payments because it is too small to worry about.\n" + + "This is also the tolerance amount assessed when determining if a loan is in arrears.\n" + "transactionProcessingStrategyId\n" + + "An enumeration that indicates the type of transaction processing strategy to be used. This relates to functionality that is also known as Payment Application Logic.\n" + + "A number of out of the box approaches exist, some are custom to specific MFIs, some are more general and indicate the order in which payments are processed.\n" + + "\n" + + "Refer to the Payment Application Logic / Transaction Processing Strategy section in the appendix for more detailed overview of each available payment application logic provided out of the box.\n" + + "\n" + "List of current approaches:\n" + "1 = Mifos style (Similar to Old Mifos)\n" + "2 = Heavensfamily (Custom MFI approach)\n" + + "3 = Creocore (Custom MFI approach)\n" + "4 = RBI (India)\n" + "5 = Principal Interest Penalties Fees Order\n" + + "6 = Interest Principal Penalties Fees Order\n" + "7 = Early Payment Strategy\n" + "loanType\n" + + "To represent different type of loans.\n" + "At present there are three type of loans are supported. \n" + + "Available loan types:\n" + "individual: Loan given to individual member\n" + "group: Loan given to group as a whole\n" + + "jlg: Joint liability group loan given to members in a group on individual basis. JLG loan can be given to one or more members in a group.\n" + + "recalculationRestFrequencyDate\n" + + "Specifies rest frequency start date for interest recalculation. This date must be before or equal to disbursement date\n" + + "recalculationCompoundingFrequencyDate\n" + + "Specifies compounding frequency start date for interest recalculation. This date must be equal to disbursement date") public class LoansApiResource { private final Set LOAN_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "accountNo", "status", "externalId", "clientId", @@ -333,8 +322,9 @@ public class LoansApiResource { @Path("{loanId}/template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String retrieveApprovalTemplate(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("templateType") @ApiParam(value = "templateType") final String templateType, @Context final UriInfo uriInfo) { + public String retrieveApprovalTemplate(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -356,17 +346,18 @@ public class LoansApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Loan Details Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Requests:\n" + "\n" + @Operation(summary = "Retrieve Loan Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Requests:\n" + "\n" + "loans/template?templateType=individual&clientId=1\n" + "\n" + "\n" + "loans/template?templateType=individual&clientId=1&productId=1") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.GetLoansTemplateResponse.class) }) - public String template(@QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, - @QueryParam("templateType") @ApiParam(value = "templateType") final String templateType, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @DefaultValue("false") @QueryParam("activeOnly") @ApiParam(value = "activeOnly") final boolean onlyActive, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansTemplateResponse.class))) }) + public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("false") @QueryParam("activeOnly") @Parameter(description = "activeOnly") final boolean onlyActive, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -489,13 +480,14 @@ public class LoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Loan", httpMethod = "GET", notes = "Note: template=true parameter doesn't apply to this resource." + @Operation(summary = "Retrieve a Loan", description = "Note: template=true parameter doesn't apply to this resource." + "Example Requests:\n" + "\n" + "loans/1\n" + "\n" + "\n" + "loans/1?fields=id,principal,annualInterestRate\n" + "\n" + "\n" + "loans/1?associations=all\n" + "\n" + "loans/1?associations=all&exclude=guarantors\n" + "\n" + "\n" + "loans/1?fields=id,principal,annualInterestRate&associations=repaymentSchedule,transactions") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.GetLoansLoanIdResponse.class) }) - public String retrieveLoan(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansLoanIdResponse.class))) }) + public String retrieveLoan(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, @Context final UriInfo uriInfo) { long start = System.currentTimeMillis(); this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -749,19 +741,20 @@ public class LoansApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Loans", httpMethod = "GET", notes = "The list capability of loans can support pagination and sorting.\n" + @Operation(summary = "List Loans", description = "The list capability of loans can support pagination and sorting.\n" + "Example Requests:\n" + "\n" + "loans\n" + "\n" + "loans?fields=accountNo\n" + "\n" + "loans?offset=10&limit=50\n" + "\n" + "loans?orderBy=accountNo&sortOrder=DESC") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.GetLoansResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, // @QueryParam("underHierarchy") final String hierarchy, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder, - @QueryParam("accountNo") @ApiParam(value = "accountNo") final String accountNo) { + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("accountNo") @Parameter(description = "accountNo") final String accountNo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -777,19 +770,19 @@ public class LoansApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Calculate loan repayment schedule | Submit a new Loan Application", httpMethod = "POST", notes = "It calculates the loan repayment Schedule\n" + @Operation(summary = "Calculate loan repayment schedule | Submit a new Loan Application", description = "It calculates the loan repayment Schedule\n" + "Submits a new loan application\n" + "Mandatory Fields: clientId, productId, principal, loanTermFrequency, loanTermFrequencyType, loanType, numberOfRepayments, repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, amortizationType, interestType, interestCalculationPeriodType, transactionProcessingStrategyId, expectedDisbursementDate, submittedOnDate, loanType\n" + "Optional Fields: graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, linkAccountId, allowPartialPeriodInterestCalcualtion, fixedEmiAmount, maxOutstandingLoanBalance, disbursementData, graceOnArrearsAgeing, createStandingInstructionAtDisbursement (requires linkedAccountId if set to true)\n" + "Additional Mandatory Fields if interest recalculation is enabled for product and Rest frequency not same as repayment period: recalculationRestFrequencyDate\n" + "Additional Mandatory Fields if interest recalculation with interest/fee compounding is enabled for product and compounding frequency not same as repayment period: recalculationCompoundingFrequencyDate\n" + "Additional Mandatory Field if Entity-Datatable Check is enabled for the entity of type loan: datatables") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoansApiResourceSwagger.PostLoansRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.PostLoansResponse.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansResponse.class))) }) public String calculateLoanScheduleOrSubmitLoanApplication( - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { if (is(commandParam, "calculateLoanSchedule")) { @@ -813,12 +806,12 @@ public class LoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Modify a loan application", httpMethod = "PUT", notes = "Loan application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoansApiResourceSwagger.PutLoansLoanIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.PutLoansLoanIdResponse.class) }) - public String modifyLoanApplication(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Modify a loan application", description = "Loan application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PutLoansLoanIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PutLoansLoanIdResponse.class))) }) + public String modifyLoanApplication(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateLoanApplication(loanId).withJson(apiRequestBodyAsJson) .build(); @@ -832,9 +825,10 @@ public class LoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Loan Application", httpMethod = "DELETE", notes = "Note: Only loans in \"Submitted and awaiting approval\" status can be deleted.") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.DeleteLoansLoanIdResponse.class) }) - public String deleteLoanApplication(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId) { + @Operation(summary = "Delete a Loan Application", description = "Note: Only loans in \"Submitted and awaiting approval\" status can be deleted.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.DeleteLoansLoanIdResponse.class))) }) + public String deleteLoanApplication(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteLoanApplication(loanId).build(); @@ -847,7 +841,7 @@ public class LoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve Loan Application | Recover Loan Guarantee | Undo Loan Application Approval | Assign a Loan Officer | Unassign a Loan Officer | Reject Loan Application | Applicant Withdraws from Loan Application | Disburse Loan Disburse Loan To Savings Account | Undo Loan Disbursal", httpMethod = "POST", notes = "Approve Loan Application:\n" + @Operation(summary = "Approve Loan Application | Recover Loan Guarantee | Undo Loan Application Approval | Assign a Loan Officer | Unassign a Loan Officer | Reject Loan Application | Applicant Withdraws from Loan Application | Disburse Loan Disburse Loan To Savings Account | Undo Loan Disbursal", description = "Approve Loan Application:\n" + "Mandatory Fields: approvedOnDate\n" + "Optional Fields: approvedLoanAmount and expectedDisbursementDate\n" + "Approves the loan application\n\n" + "Recover Loan Guarantee:\n" + "Recovers the loan guarantee\n\n" + "Undo Loan Application Approval:\n" + "Undoes the Loan Application Approval\n\n" + "Assign a Loan Officer:\n" @@ -859,12 +853,12 @@ public class LoansApiResource { + "Disburses the Loan\n\n" + "Disburse Loan To Savings Account:\n" + "Mandatory Fields: actualDisbursementDate\n" + "Optional Fields: transactionAmount and fixedEmiAmount\n" + "Disburses the loan to Saving Account\n\n" + "Undo Loan Disbursal:\n" + "Undoes the Loan Disbursal\n" + "Showing request and response for Assign a Loan Officer") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoansApiResourceSwagger.PostLoansLoanIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.PostLoansLoanIdResponse.class) }) - public String stateTransitions(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansLoanIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansLoanIdResponse.class))) }) + public String stateTransitions(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -943,7 +937,7 @@ public class LoansApiResource { @Path("glimAccount/{glimId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve GLIM Application | Undo GLIM Application Approval | Reject GLIM Application | Disburse Loan Disburse Loan To Savings Account | Undo Loan Disbursal", httpMethod = "POST", notes = "Approve GLIM Application:\n" + @Operation(summary = "Approve GLIM Application | Undo GLIM Application Approval | Reject GLIM Application | Disburse Loan Disburse Loan To Savings Account | Undo Loan Disbursal", description = "Approve GLIM Application:\n" + "Mandatory Fields: approvedOnDate\n" + "Optional Fields: approvedLoanAmount and expectedDisbursementDate\n" + "Approves the GLIM application\n\n" + "Undo GLIM Application Approval:\n" + "Undoes the GLIM Application Approval\n\n" + "Reject GLIM Application:\n" + "Mandatory Fields: rejectedOnDate\n" + "Allows you to reject the GLIM application\n\n" @@ -951,9 +945,9 @@ public class LoansApiResource { + "Disburses the Loan\n\n" + "Disburse Loan To Savings Account:\n" + "Mandatory Fields: actualDisbursementDate\n" + "Optional Fields: transactionAmount and fixedEmiAmount\n" + "Disburses the loan to Saving Account\n\n" + "Undo Loan Disbursal:\n" + "Undoes the Loan Disbursal\n") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoansApiResourceSwagger.PostLoansLoanIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoansApiResourceSwagger.PostLoansLoanIdResponse.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansLoanIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansLoanIdResponse.class))) }) public String glimStateTransitions(@PathParam("glimId") final Long glimId, @QueryParam("command") final String commandParam, final String apiRequestBodyAsJson) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java index 875521b40..58e95ab0b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.loanaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class LoansApiResourceSwagger { private LoansApiResourceSwagger() {} - @ApiModel(value = "GetLoansTemplateResponse") + @Schema(description = "GetLoansTemplateResponse") public static final class GetLoansTemplateResponse { private GetLoansTemplateResponse() {} @@ -39,7 +38,7 @@ final class LoansApiResourceSwagger { private GetLoansTemplateTimeline() {} - @ApiModelProperty(example = "[2013, 3, 8]") + @Schema(example = "[2013, 3, 8]") public LocalDate expectedDisbursementDate; } @@ -47,23 +46,23 @@ final class LoansApiResourceSwagger { private GetLoansTemplateProductOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Kampala Product (with cash accounting)") + @Schema(example = "Kampala Product (with cash accounting)") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long clientId; - @ApiModelProperty(example = "Kampala first Client") + @Schema(example = "Kampala first Client") public String clientName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientOfficeId; public GetLoansTemplateTimeline timeline; public Set productOptions; } - @ApiModel(value = "GetLoansLoanIdResponse") + @Schema(description = "GetLoansLoanIdResponse") public static final class GetLoansLoanIdResponse { private GetLoansLoanIdResponse() {} @@ -72,27 +71,27 @@ final class LoansApiResourceSwagger { private GetLoansLoanIdStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "loanStatusType.active") + @Schema(example = "loanStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Active") + public String description; + @Schema(example = "false") public Boolean pendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } @@ -100,29 +99,29 @@ final class LoansApiResourceSwagger { private GetLoansLoanIdLoanType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "loanType.individual") + @Schema(example = "loanType.individual") public String code; - @ApiModelProperty(example = "Individual") - public String value; + @Schema(example = "Individual") + public String description; } static final class GetLoansLoanIdCurrency { private GetLoansLoanIdCurrency() {} - @ApiModelProperty(example = "UGX") + @Schema(example = "UGX") public String code; - @ApiModelProperty(example = "Uganda Shilling") + @Schema(example = "Uganda Shilling") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "USh") + @Schema(example = "USh") public String displaySymbol; - @ApiModelProperty(example = "currency.UGX") + @Schema(example = "currency.UGX") public String nameCode; - @ApiModelProperty(example = "Uganda Shilling (USh)") + @Schema(example = "Uganda Shilling (USh)") public String displayLabel; } @@ -130,105 +129,105 @@ final class LoansApiResourceSwagger { private GetLoansLoanIdTermPeriodFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "termFrequency.periodFrequencyType.months") + @Schema(example = "termFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetLoansLoanIdRepaymentFrequencyType { private GetLoansLoanIdRepaymentFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "repaymentFrequency.periodFrequencyType.months") + @Schema(example = "repaymentFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetLoansLoanIdInterestRateFrequencyType { private GetLoansLoanIdInterestRateFrequencyType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "interestRateFrequency.periodFrequencyType.years") + @Schema(example = "interestRateFrequency.periodFrequencyType.years") public String code; - @ApiModelProperty(example = "Per year") - public String value; + @Schema(example = "Per year") + public String description; } static final class GetLoansLoanIdAmortizationType { private GetLoansLoanIdAmortizationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "amortizationType.equal.installments") + @Schema(example = "amortizationType.equal.installments") public String code; - @ApiModelProperty(example = "Equal installments") - public String value; + @Schema(example = "Equal installments") + public String description; } static final class GetLoansLoanIdInterestType { private GetLoansLoanIdInterestType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestType.flat") + @Schema(example = "interestType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetLoansLoanIdInterestCalculationPeriodType { private GetLoansLoanIdInterestCalculationPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestCalculationPeriodType.same.as.repayment.period") + @Schema(example = "interestCalculationPeriodType.same.as.repayment.period") public String code; - @ApiModelProperty(example = "Same as repayment period") - public String value; + @Schema(example = "Same as repayment period") + public String description; } static final class GetLoansLoanIdTimeline { private GetLoansLoanIdTimeline() {} - @ApiModelProperty(example = "[2012, 4, 3]") + @Schema(example = "[2012, 4, 3]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "admin") + @Schema(example = "admin") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; - @ApiModelProperty(example = "[2012, 4, 3]") + @Schema(example = "[2012, 4, 3]") public LocalDate approvedOnDate; - @ApiModelProperty(example = "admin") + @Schema(example = "admin") public String approvedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String approvedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String approvedByLastname; - @ApiModelProperty(example = "[2012, 4, 10]") + @Schema(example = "[2012, 4, 10]") public LocalDate expectedDisbursementDate; - @ApiModelProperty(example = "[2012, 4, 10]") + @Schema(example = "[2012, 4, 10]") public LocalDate actualDisbursementDate; - @ApiModelProperty(example = "admin") + @Schema(example = "admin") public String disbursedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String disbursedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String disbursedByLastname; - @ApiModelProperty(example = "[2012, 4, 10]") + @Schema(example = "[2012, 4, 10]") public LocalDate expectedMaturityDate; } @@ -245,9 +244,9 @@ final class LoansApiResourceSwagger { private GetLoansLoanIdLinkedAccount() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; } @@ -255,13 +254,13 @@ final class LoansApiResourceSwagger { private GetLoansLoanIdDisbursementDetails() {} - @ApiModelProperty(example = "71") + @Schema(example = "71") public Integer id; - @ApiModelProperty(example = "[2013, 11, 1]") + @Schema(example = "[2013, 11, 1]") public LocalDate expectedDisbursementDate; - @ApiModelProperty(example = "22000.000000") + @Schema(example = "22000.000000") public Float principal; - @ApiModelProperty(example = "22000.000000") + @Schema(example = "22000.000000") public Float approvedPrincipal; } @@ -273,252 +272,252 @@ final class LoansApiResourceSwagger { private GetLoansLoanIdChargeTimeType() {} - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer id; - @ApiModelProperty(example = "chargeTimeType.overdueInstallment") + @Schema(example = "chargeTimeType.overdueInstallment") public String code; - @ApiModelProperty(example = "overdue fees") - public String value; + @Schema(example = "overdue fees") + public String description; } static final class GetLoansLoanIdChargeCalculationType { private GetLoansLoanIdChargeCalculationType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.percent.of.amount") + @Schema(example = "chargeCalculationType.percent.of.amount") public String code; - @ApiModelProperty(example = "% Amount") - public String value; + @Schema(example = "% Amount") + public String description; } static final class GetLoansLoanIdChargePaymentMode { private GetLoansLoanIdChargePaymentMode() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.regular") + @Schema(example = "chargepaymentmode.regular") public String code; - @ApiModelProperty(example = "Regular") - public String value; + @Schema(example = "Regular") + public String description; } static final class GetLoansLoanIdFeeFrequency { private GetLoansLoanIdFeeFrequency() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "feeFrequencyperiodFrequencyType.weeks") + @Schema(example = "feeFrequencyperiodFrequencyType.weeks") public String code; - @ApiModelProperty(example = "Weeks") - public String value; + @Schema(example = "Weeks") + public String description; } - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer id; - @ApiModelProperty(example = "overdraft penality") + @Schema(example = "overdraft penality") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; public LoanChargesApiResourceSwagger.GetLoansLoanIdChargesChargeIdResponse.GetLoanChargeCurrency currency; - @ApiModelProperty(example = "3.000000") + @Schema(example = "3.000000") public Float amount; public GetLoansLoanIdChargeTimeType chargeTimeType; public LoanChargesApiResourceSwagger.GetLoansLoanIdChargesTemplateResponse.GetLoanChargeTemplateChargeOptions.GetLoanChargeTemplateChargeAppliesTo chargeAppliesTo; public GetLoansLoanIdChargeCalculationType chargeCalculationType; public GetLoansLoanIdChargePaymentMode chargePaymentMode; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer feeInterval; public GetLoansLoanIdFeeFrequency feeFrequency; } public GetLoansLoanIdCurrency currency; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long principalDisbursed; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long principalPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long principalWrittenOff; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long principalOutstanding; - @ApiModelProperty(example = "833333.3") + @Schema(example = "833333.3") public Double principalOverdue; - @ApiModelProperty(example = "240000") + @Schema(example = "240000") public Long interestCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long interestPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long interestWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long interestWrittenOff; - @ApiModelProperty(example = "240000") + @Schema(example = "240000") public Long interestOutstanding; - @ApiModelProperty(example = "200000") + @Schema(example = "200000") public Long interestOverdue; - @ApiModelProperty(example = "18000") + @Schema(example = "18000") public Long feeChargesCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesDueAtDisbursementCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesWrittenOff; - @ApiModelProperty(example = "18000") + @Schema(example = "18000") public Long feeChargesOutstanding; - @ApiModelProperty(example = "15000") + @Schema(example = "15000") public Long feeChargesOverdue; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesWrittenOff; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesOutstanding; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesOverdue; - @ApiModelProperty(example = "1258000") + @Schema(example = "1258000") public Long totalExpectedRepayment; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalRepayment; - @ApiModelProperty(example = "258000") + @Schema(example = "258000") public Long totalExpectedCostOfLoan; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalCostOfLoan; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalWrittenOff; - @ApiModelProperty(example = "1258000") + @Schema(example = "1258000") public Long totalOutstanding; - @ApiModelProperty(example = "1048333.3") + @Schema(example = "1048333.3") public Double totalOverdue; - @ApiModelProperty(example = "[2012, 5, 10]") + @Schema(example = "[2012, 5, 10]") public LocalDate overdueSinceDate; public GetLoansLoanIdLinkedAccount linkedAccount; public Set disbursementDetails; - @ApiModelProperty(example = "1100.000000") + @Schema(example = "1100.000000") public Float fixedEmiAmount; - @ApiModelProperty(example = "35000") + @Schema(example = "35000") public Long maxOutstandingLoanBalance; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean canDisburse; public Set emiAmountVariations; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean inArrears; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isNPA; public Set overdueCharges; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; public GetLoansLoanIdStatus status; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Kampala first Client") + @Schema(example = "Kampala first Client") public String clientName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanProductId; - @ApiModelProperty(example = "Kampala Product (with cash accounting)") + @Schema(example = "Kampala Product (with cash accounting)") public String loanProductName; - @ApiModelProperty(example = "Typical Kampala loan product with cash accounting enabled for testing.") + @Schema(example = "Typical Kampala loan product with cash accounting enabled for testing.") public String loanProductDescription; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Integer loanPurposeId; - @ApiModelProperty(example = "option.HousingImprovement") + @Schema(example = "option.HousingImprovement") public String loanPurposeName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer loanOfficerId; - @ApiModelProperty(example = "LoanOfficer, Kampala") + @Schema(example = "LoanOfficer, Kampala") public String loanOfficerName; public GetLoansLoanIdLoanType loanType; public GetLoansLoanIdCurrency currency; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long principal; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer termFrequency; public GetLoansLoanIdTermPeriodFrequencyType termPeriodFrequencyType; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; public GetLoansLoanIdRepaymentFrequencyType repaymentFrequencyType; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer interestRatePerPeriod; public GetLoansLoanIdInterestRateFrequencyType interestRateFrequencyType; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer annualInterestRate; public GetLoansLoanIdAmortizationType amortizationType; public GetLoansLoanIdInterestType interestType; public GetLoansLoanIdInterestCalculationPeriodType interestCalculationPeriodType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer transactionProcessingStrategyId; public GetLoansLoanIdTimeline timeline; public GetLoansLoanIdSummary summary; } - @ApiModel(value = "GetLoansResponse") + @Schema(description = "GetLoansResponse") public static final class GetLoansResponse { private GetLoansResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "PostLoansRequest") + @Schema(description = "PostLoansRequest") public static final class PostLoansRequest { private PostLoansRequest() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "100,000.00") + @Schema(example = "100,000.00") public Double principal; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer loanTermFrequency; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer loanTermFrequencyType; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer repaymentFrequencyType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer interestRatePerPeriod; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amortizationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCalculationPeriodType; - @ApiModelProperty(example = "20 September 2011") + @Schema(example = "20 September 2011") public String expectedDisbursementDate; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer transactionProcessingStrategyId; } - @ApiModel(value = "PostLoansResponse") + @Schema(description = "PostLoansResponse") public static final class PostLoansResponse { private PostLoansResponse() {} @@ -527,96 +526,96 @@ final class LoansApiResourceSwagger { private PostLoansRepaymentSchedulePeriods() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer period; - @ApiModelProperty(example = "[2011, 9, 20]") + @Schema(example = "[2011, 9, 20]") public LocalDate dueDate; - @ApiModelProperty(example = "100000") + @Schema(example = "100000") public Long principalDisbursed; - @ApiModelProperty(example = "100000") + @Schema(example = "100000") public Long principalLoanBalanceOutstanding; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesDue; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesOutstanding; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalOriginalDueForPeriod; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalDueForPeriod; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalOutstandingForPeriod; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalOverdue; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalActualCostOfLoanForPeriod; } public GetLoansLoanIdResponse.GetLoansLoanIdCurrency currency; - @ApiModelProperty(example = "366") + @Schema(example = "366") public Integer loanTermInDays; - @ApiModelProperty(example = "100000") + @Schema(example = "100000") public Long totalPrincipalDisbursed; - @ApiModelProperty(example = "100000") + @Schema(example = "100000") public Long totalPrincipalExpected; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalPrincipalPaid; - @ApiModelProperty(example = "13471.52") + @Schema(example = "13471.52") public Double totalInterestCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalFeeChargesCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalPenaltyChargesCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalWrittenOff; - @ApiModelProperty(example = "113471.52") + @Schema(example = "113471.52") public Double totalRepaymentExpected; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalRepayment; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalOutstanding; public Set periods; } - @ApiModel(value = "PutLoansLoanIdRequest") + @Schema(description = "PutLoansLoanIdRequest") public static final class PutLoansLoanIdRequest { private PutLoansLoanIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Long principal; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer loanTermFrequency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer loanTermFrequencyType; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer repaymentFrequencyType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer interestRatePerPeriod; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestCalculationPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amortizationType; - @ApiModelProperty(example = "04 March 2014") + @Schema(example = "04 March 2014") public String expectedDisbursementDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transactionProcessingStrategyId; } - @ApiModel(value = "PutLoansLoanIdResponse") + @Schema(description = "PutLoansLoanIdResponse") public static final class PutLoansLoanIdResponse { private PutLoansLoanIdResponse() {} @@ -625,67 +624,67 @@ final class LoansApiResourceSwagger { private PutLoansLoanIdChanges() {} - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Long principal; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutLoansLoanIdChanges changes; } - @ApiModel(value = "DeleteLoansLoanIdResponse") + @Schema(description = "DeleteLoansLoanIdResponse") public static final class DeleteLoansLoanIdResponse { private DeleteLoansLoanIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PostLoansLoanIdRequest") + @Schema(description = "PostLoansLoanIdRequest") public static final class PostLoansLoanIdRequest { private PostLoansLoanIdRequest() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toLoanOfficerId; - @ApiModelProperty(example = "02 September 2014") + @Schema(example = "02 September 2014") public String assignmentDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer fromLoanOfficerId; } - @ApiModel(value = "PostLoansLoanIdResponse") + @Schema(description = "PostLoansLoanIdResponse") public static final class PostLoansLoanIdResponse { private PostLoansLoanIdResponse() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer clientId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer loanId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java index a1f117cab..6187a4076 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.loanproduct.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -87,9 +87,7 @@ import org.springframework.stereotype.Component; @Path("/loanproducts") @Component @Scope("singleton") -@Api(tags = { "Loan Products" }) -@SwaggerDefinition(tags = { - @Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.") }) +@Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.") public class LoanProductsApiResource { private final Set LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "shortName", "description", "fundId", @@ -170,7 +168,7 @@ public class LoanProductsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Loan Product", httpMethod = "POST", notes = "Depending of the Accounting Rule (accountingRule) selected, additional fields with details of the appropriate Ledger Account identifiers would need to be passed in.\n" + @Operation(summary = "Create a Loan Product", description = "Depending of the Accounting Rule (accountingRule) selected, additional fields with details of the appropriate Ledger Account identifiers would need to be passed in.\n" + "\n" + "Refer MifosX Accounting Specs Draft for more details regarding the significance of the selected accounting rule\n\n" + "Mandatory Fields: name, shortName, currencyCode, digitsAfterDecimal, inMultiplesOf, principal, numberOfRepayments, repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, transactionProcessingStrategyId, accountingRule, isInterestRecalculationEnabled, daysInYearType, daysInMonthType\n\n" + "Optional Fields: inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, graceOnArrearsAgeing, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, includeInBorrowerCycle, useBorrowerCycle,principalVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, multiDisburseLoan,maxTrancheCount, outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf, allowAttributeOverrides, allowPartialPeriodInterestCalcualtion\n\n" @@ -183,10 +181,10 @@ public class LoanProductsApiResource { + "Additional Optional Fields if interest recalculation is enabled(true) and interestRecalculationCompoundingMethod is enabled and recalculationCompoundingFrequencyType is not same as repayment period: recalculationCompoundingFrequencyInterval, recalculationCompoundingFrequencyDate\n\n" + "Additional Mandatory Fields if Hold Guarantee funds is enabled(true): mandatoryGuarantee\n\n" + "Additional Optional Fields if Hold Guarantee funds is enabled(true): minimumGuaranteeFromOwnFunds,minimumGuaranteeFromGuarantor") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanProductsApiResourceSwagger.PostLoanProductsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = LoanProductsApiResourceSwagger.PostLoanProductsResponse.class) }) - public String createLoanProduct(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanProductsApiResourceSwagger.PostLoanProductsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanProductsApiResourceSwagger.PostLoanProductsResponse.class))) }) + public String createLoanProduct(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createLoanProduct().withJson(apiRequestBodyAsJson).build(); @@ -198,10 +196,10 @@ public class LoanProductsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Loan Products", httpMethod = "GET", notes = "Lists Loan Products\n\n" + "Example Requests:\n" + "\n" - + "loanproducts\n" + "\n" + "\n" + "loanproducts?fields=name,description,interestRateFrequencyType,amortizationType") + @Operation(summary = "List Loan Products", description = "Lists Loan Products\n\n" + "Example Requests:\n" + "\n" + "loanproducts\n" + + "\n" + "\n" + "loanproducts?fields=name,description,interestRateFrequencyType,amortizationType") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = LoanProductsApiResourceSwagger.GetLoanProductsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = LoanProductsApiResourceSwagger.GetLoanProductsResponse.class)))) }) public String retrieveAllLoanProducts(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -225,12 +223,12 @@ public class LoanProductsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Loan Product Details Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "loanproducts/template") + @Operation(summary = "Retrieve Loan Product Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "loanproducts/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanProductsApiResourceSwagger.GetLoanProductsTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanProductsApiResourceSwagger.GetLoanProductsTemplateResponse.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo, - @QueryParam("isProductMixTemplate") @ApiParam(value = "isProductMixTemplate") final boolean isProductMixTemplate) { + @QueryParam("isProductMixTemplate") @Parameter(description = "isProductMixTemplate") final boolean isProductMixTemplate) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -253,12 +251,12 @@ public class LoanProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Loan Product", httpMethod = "GET", notes = "Retrieves a Loan Product\n\n" + "Example Requests:\n" - + "\n" + "loanproducts/1\n" + "\n" + "\n" + "loanproducts/1?template=true\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Loan Product", description = "Retrieves a Loan Product\n\n" + "Example Requests:\n" + "\n" + + "loanproducts/1\n" + "\n" + "\n" + "loanproducts/1?template=true\n" + "\n" + "\n" + "loanproducts/1?fields=name,description,numberOfRepayments") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanProductsApiResourceSwagger.GetLoanProductsProductIdResponse.class) }) - public String retrieveLoanProductDetails(@PathParam("productId") @ApiParam(value = "productId") final Long productId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanProductsApiResourceSwagger.GetLoanProductsProductIdResponse.class))) }) + public String retrieveLoanProductDetails(@PathParam("productId") @Parameter(description = "productId") final Long productId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -294,13 +292,12 @@ public class LoanProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Loan Product", httpMethod = "PUT", notes = "Updates a Loan Product") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = LoanProductsApiResourceSwagger.PutLoanProductsProductIdRequest.class) }) + @Operation(summary = "Update a Loan Product", description = "Updates a Loan Product") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanProductsApiResourceSwagger.PutLoanProductsProductIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = LoanProductsApiResourceSwagger.PutLoanProductsProductIdResponse.class) }) - public String updateLoanProduct(@PathParam("productId") @ApiParam(value = "productId") final Long productId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoanProductsApiResourceSwagger.PutLoanProductsProductIdResponse.class))) }) + public String updateLoanProduct(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateLoanProduct(productId).withJson(apiRequestBodyAsJson) .build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java index d5a48c4d1..0f389ef3e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.loanproduct.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.List; import java.util.Set; @@ -31,83 +30,83 @@ final class LoanProductsApiResourceSwagger { private LoanProductsApiResourceSwagger() {} - @ApiModel(value = "PostLoanProductsRequest") + @Schema(description = "PostLoanProductsRequest") public static final class PostLoanProductsRequest { private PostLoanProductsRequest() {} - @ApiModelProperty(example = "LP Accrual Accounting") + @Schema(example = "LP Accrual Accounting") public String name; - @ApiModelProperty(example = "LPAA") + @Schema(example = "LPAA") public String shortName; - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer digitsAfterDecimal; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "100,000.00") + @Schema(example = "100,000.00") public Double principal; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer repaymentFrequencyType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transactionProcessingStrategyId; - @ApiModelProperty(example = "1.75") + @Schema(example = "1.75") public Double interestRatePerPeriod; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer interestRateFrequencyType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amortizationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCalculationPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer daysInMonthType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer daysInYearType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isInterestRecalculationEnabled; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer accountingRule; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer fundSourceAccountId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer loanPortfolioAccountId; - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer receivableInterestAccountId; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer receivableFeeAccountId; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer receivablePenaltyAccountId; - @ApiModelProperty(example = "34") + @Schema(example = "34") public Integer interestOnLoanAccountId; - @ApiModelProperty(example = "37") + @Schema(example = "37") public Integer incomeFromFeeAccountId; - @ApiModelProperty(example = "35") + @Schema(example = "35") public Integer incomeFromPenaltyAccountId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer overpaymentLiabilityAccountId; - @ApiModelProperty(example = "41") + @Schema(example = "41") public Integer writeOffAccountId; } - @ApiModel(value = "PostLoanProductsResponse") + @Schema(description = "PostLoanProductsResponse") public static final class PostLoanProductsResponse { private PostLoanProductsResponse() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer resourceId; } - @ApiModel(value = "GetLoanProductsResponse") + @Schema(description = "GetLoanProductsResponse") public static final class GetLoanProductsResponse { private GetLoanProductsResponse() {} @@ -116,19 +115,19 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -136,84 +135,84 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsRepaymentFrequencyType() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "repaymentFrequency.periodFrequencyType.days") + @Schema(example = "repaymentFrequency.periodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetLoanProductsInterestRateFrequencyType { private GetLoanProductsInterestRateFrequencyType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "interestRateFrequency.periodFrequencyType.years") + @Schema(example = "interestRateFrequency.periodFrequencyType.years") public String code; - @ApiModelProperty(example = "Per year") - public String value; + @Schema(example = "Per year") + public String description; } static final class GetLoanProductsAmortizationType { private GetLoanProductsAmortizationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "amortizationType.equal.installments") + @Schema(example = "amortizationType.equal.installments") public String code; - @ApiModelProperty(example = "Equal installments") - public String value; + @Schema(example = "Equal installments") + public String description; } static final class GetLoanProductsInterestType { private GetLoanProductsInterestType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestType.flat") + @Schema(example = "interestType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetLoansProductsInterestCalculationPeriodType { private GetLoansProductsInterestCalculationPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestCalculationPeriodType.same.as.repayment.period") + @Schema(example = "interestCalculationPeriodType.same.as.repayment.period") public String code; - @ApiModelProperty(example = "Same as repayment period") - public String value; + @Schema(example = "Same as repayment period") + public String description; } static final class GetLoansProductsDaysInMonthType { private GetLoansProductsDaysInMonthType() {} - @ApiModelProperty(example = "30") + @Schema(example = "30") public Integer id; - @ApiModelProperty(example = "DaysInMonthType.days360") + @Schema(example = "DaysInMonthType.days360") public String code; - @ApiModelProperty(example = "30 Days") - public String value; + @Schema(example = "30 Days") + public String description; } static final class GetLoansProductsDaysInYearType { private GetLoansProductsDaysInYearType() {} - @ApiModelProperty(example = "360") + @Schema(example = "360") public Integer id; - @ApiModelProperty(example = "DaysInYearType.days360") + @Schema(example = "DaysInYearType.days360") public String code; - @ApiModelProperty(example = "360 Days") - public String value; + @Schema(example = "360 Days") + public String description; } static final class GetLoanProductsInterestRecalculationData { @@ -224,60 +223,60 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsInterestRecalculationCompoundingType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "interestRecalculationCompoundingMethod.fee") + @Schema(example = "interestRecalculationCompoundingMethod.fee") public String code; - @ApiModelProperty(example = "Fee") - public String value; + @Schema(example = "Fee") + public String description; } static final class GetLoanProductsInterestRecalculationCompoundingFrequencyType { private GetLoanProductsInterestRecalculationCompoundingFrequencyType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestRecalculationFrequencyType.same.as.repayment.period") + @Schema(example = "interestRecalculationFrequencyType.same.as.repayment.period") public String code; - @ApiModelProperty(example = "Same as repayment period") - public String value; + @Schema(example = "Same as repayment period") + public String description; } static final class GetLoanProductsRescheduleStrategyType { private GetLoanProductsRescheduleStrategyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "loanRescheduleStrategyMethod.reduce.number.of.installments") + @Schema(example = "loanRescheduleStrategyMethod.reduce.number.of.installments") public String code; - @ApiModelProperty(example = "Reduce number of installments") - public String value; + @Schema(example = "Reduce number of installments") + public String description; } static final class GetLoanProductsPreClosureInterestCalculationStrategy { private GetLoanProductsPreClosureInterestCalculationStrategy() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "loanPreClosureInterestCalculationStrategy.tillPreClosureDate") + @Schema(example = "loanPreClosureInterestCalculationStrategy.tillPreClosureDate") public String code; - @ApiModelProperty(example = "Till preclose Date") - public String value; + @Schema(example = "Till preclose Date") + public String description; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; public GetLoanProductsInterestRecalculationData.GetLoanProductsInterestRecalculationCompoundingType interestRecalculationCompoundingType; public GetLoanProductsInterestRecalculationCompoundingFrequencyType interestRecalculationCompoundingFrequencyType; public GetLoanProductsInterestRecalculationData.GetLoanProductsRescheduleStrategyType rescheduleStrategyType; public GetLoanProductsInterestRecalculationCompoundingFrequencyType recalculationRestFrequencyType; public GetLoanProductsPreClosureInterestCalculationStrategy preClosureInterestCalculationStrategy; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isArrearsBasedOnOriginalSchedule; } @@ -285,75 +284,75 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsAccountingRule() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountingRuleType.cash") + @Schema(example = "accountingRuleType.cash") public String code; - @ApiModelProperty(example = "CASH BASED") - public String value; + @Schema(example = "CASH BASED") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "personal loan product") + @Schema(example = "personal loan product") public String name; - @ApiModelProperty(example = "pe1") + @Schema(example = "pe1") public String shortName; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean includeInBorrowerCycle; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean useBorrowerCycle; - @ApiModelProperty(example = "[2013, 9, 2]") + @Schema(example = "[2013, 9, 2]") public LocalDate startDate; - @ApiModelProperty(example = "[2014, 2, 7]") + @Schema(example = "[2014, 2, 7]") public LocalDate endDate; - @ApiModelProperty(example = "loanProduct.active") + @Schema(example = "loanProduct.active") public String status; public GetLoanProductsCurrency currency; - @ApiModelProperty(example = "10000.000000") + @Schema(example = "10000.000000") public Float principal; - @ApiModelProperty(example = "5000.000000") + @Schema(example = "5000.000000") public Float minPrincipal; - @ApiModelProperty(example = "15000.000000") + @Schema(example = "15000.000000") public Float maxPrincipal; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer numberOfRepayments; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer minNumberOfRepayments; - @ApiModelProperty(example = "15") + @Schema(example = "15") public Integer maxNumberOfRepayments; - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer repaymentEvery; public GetLoanProductsRepaymentFrequencyType repaymentFrequencyType; - @ApiModelProperty(example = "15.000000") + @Schema(example = "15.000000") public Float interestRatePerPeriod; public GetLoanProductsResponse.GetLoanProductsInterestRateFrequencyType interestRateFrequencyType; - @ApiModelProperty(example = "15.000000") + @Schema(example = "15.000000") public Float annualInterestRate; public GetLoanProductsAmortizationType amortizationType; public GetLoanProductsInterestType interestType; public GetLoansProductsInterestCalculationPeriodType interestCalculationPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transactionProcessingStrategyId; - @ApiModelProperty(example = "Mifos style") + @Schema(example = "Mifos style") public String transactionProcessingStrategyName; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List principalVariationsForBorrowerCycle; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List interestRateVariationsForBorrowerCycle; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List numberOfRepaymentVariationsForBorrowerCycle; public GetLoansProductsDaysInMonthType daysInMonthType; public GetLoansProductsDaysInYearType daysInYearType; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isInterestRecalculationEnabled; public GetLoanProductsInterestRecalculationData interestRecalculationData; public GetLoanProductsResponse.GetLoanProductsAccountingRule accountingRule; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer principalThresholdForLastInstalment; } - @ApiModel(value = "GetLoanProductsTemplateResponse") + @Schema(description = "GetLoanProductsTemplateResponse") public static final class GetLoanProductsTemplateResponse { private GetLoanProductsTemplateResponse() {} @@ -362,19 +361,19 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsTemplateCurrency() {} - @ApiModelProperty(example = "") + @Schema(example = "") public String code; - @ApiModelProperty(example = "") + @Schema(example = "") public String name; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer decimalPlaces; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "") + @Schema(example = "") public String displaySymbol; - @ApiModelProperty(example = "") + @Schema(example = "") public String nameCode; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public String displayLabel; } @@ -382,72 +381,72 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsRepaymentTemplateFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "repaymentFrequency.periodFrequencyType.months") + @Schema(example = "repaymentFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetLoanProductsInterestRateTemplateFrequencyType { private GetLoanProductsInterestRateTemplateFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "interestRateFrequency.periodFrequencyType.months") + @Schema(example = "interestRateFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Per month") - public String value; + @Schema(example = "Per month") + public String description; } static final class GetLoanProductsInterestTemplateType { private GetLoanProductsInterestTemplateType() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestType.declining.balance") + @Schema(example = "interestType.declining.balance") public String code; - @ApiModelProperty(example = "Declining Balance") - public String value; + @Schema(example = "Declining Balance") + public String description; } static final class GetLoanProductsAccountingRule { private GetLoanProductsAccountingRule() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountingRuleType.none") + @Schema(example = "accountingRuleType.none") public String code; - @ApiModelProperty(example = "NONE") - public String value; + @Schema(example = "NONE") + public String description; } static final class GetLoansProductsDaysInMonthTemplateType { private GetLoansProductsDaysInMonthTemplateType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "DaysInMonthType.actual") + @Schema(example = "DaysInMonthType.actual") public String code; - @ApiModelProperty(example = "Actual") - public String value; + @Schema(example = "Actual") + public String description; } static final class GetLoanProductsDaysInYearTemplateType { private GetLoanProductsDaysInYearTemplateType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "DaysInYearType.actual") + @Schema(example = "DaysInYearType.actual") public String code; - @ApiModelProperty(example = "Actual") - public String value; + @Schema(example = "Actual") + public String description; } static final class GetLoanProductsInterestRecalculationTemplateData { @@ -458,24 +457,24 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsInterestRecalculationCompoundingType() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestRecalculationCompoundingMethod.none") + @Schema(example = "interestRecalculationCompoundingMethod.none") public String code; - @ApiModelProperty(example = "None") - public String value; + @Schema(example = "None") + public String description; } static final class GetLoanProductsRescheduleStrategyType { private GetLoanProductsRescheduleStrategyType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "loanRescheduleStrategyMethod.reduce.emi.amount") + @Schema(example = "loanRescheduleStrategyMethod.reduce.emi.amount") public String code; - @ApiModelProperty(example = "Reduce EMI amount") - public String value; + @Schema(example = "Reduce EMI amount") + public String description; } public GetLoanProductsInterestRecalculationTemplateData.GetLoanProductsInterestRecalculationCompoundingType interestRecalculationCompoundingType; @@ -487,11 +486,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsPaymentTypeOptions() {} - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer id; - @ApiModelProperty(example = "check") + @Schema(example = "check") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer position; } @@ -499,17 +498,17 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsCurrencyOptions() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -517,11 +516,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsTransactionProcessingStrategyOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "mifos-standard-strategy") + @Schema(example = "mifos-standard-strategy") public String code; - @ApiModelProperty(example = "Penalties, Fees, Interest, Principal order") + @Schema(example = "Penalties, Fees, Interest, Principal order") public String name; } @@ -533,60 +532,60 @@ final class LoanProductsApiResourceSwagger { private GetLoanChargeTimeType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeTimeType.disbursement") + @Schema(example = "chargeTimeType.disbursement") public String code; - @ApiModelProperty(example = "Disbursement") - public String value; + @Schema(example = "Disbursement") + public String description; } static final class GetLoanProductsChargeAppliesTo { private GetLoanProductsChargeAppliesTo() {} - @ApiModelProperty(example = "1 ") + @Schema(example = "1 ") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.loan") + @Schema(example = "chargeAppliesTo.loan") public String code; - @ApiModelProperty(example = "Loan") - public String value; + @Schema(example = "Loan") + public String description; } static final class GetLoanChargeCalculationType { private GetLoanChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetLoansChargePaymentMode { private GetLoansChargePaymentMode() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.regular") + @Schema(example = "chargepaymentmode.regular") public String code; - @ApiModelProperty(example = "Regular") - public String value; + @Schema(example = "Regular") + public String description; } - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer id; - @ApiModelProperty(example = "des charges") + @Schema(example = "des charges") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; public GetLoanProductsCurrencyOptions currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Long amount; public GetLoanChargeTimeType chargeTimeType; public GetLoanProductsChargeAppliesTo chargeAppliesTo; @@ -606,50 +605,50 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsLiabilityType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.liability") + @Schema(example = "accountType.liability") public String code; - @ApiModelProperty(example = "LIABILITY") - public String value; + @Schema(example = "LIABILITY") + public String description; } static final class GetLoanProductsLiabilityUsage { private GetLoanProductsLiabilityUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public String value; + @Schema(example = "DETAIL") + public String description; } static final class GetLoanProductsLiabilityTagId { private GetLoanProductsLiabilityTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; } - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "over payment") + @Schema(example = "over payment") public String name; - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetLoanProductsLiabilityType type; public GetLoanProductsLiabilityUsage usage; - @ApiModelProperty(example = "over payment") + @Schema(example = "over payment") public String nameDecorated; public GetLoanProductsLiabilityTagId tagId; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer organizationRunningBalance; } @@ -657,22 +656,22 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsAssetAccountOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Loan portfolio") + @Schema(example = "Loan portfolio") public String name; - @ApiModelProperty(example = "02") + @Schema(example = "02") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityType type; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityUsage usage; - @ApiModelProperty(example = "Loan portfolio") + @Schema(example = "Loan portfolio") public String nameDecorated; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityTagId tagId; - @ApiModelProperty(example = "60000") + @Schema(example = "60000") public Integer organizationRunningBalance; } @@ -684,30 +683,30 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsExpenseType() {} - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer id; - @ApiModelProperty(example = "accountType.expense") + @Schema(example = "accountType.expense") public String code; - @ApiModelProperty(example = "EXPENSE") - public String value; + @Schema(example = "EXPENSE") + public String description; } - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer id; - @ApiModelProperty(example = "loans written off 2") + @Schema(example = "loans written off 2") public String name; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetLoanProductsExpenseType type; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityUsage usage; - @ApiModelProperty(example = "loans written off 2") + @Schema(example = "loans written off 2") public String nameDecorated; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityTagId tagId; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer organizationRunningBalance; } @@ -719,30 +718,30 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsIncomeType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "accountType.income") + @Schema(example = "accountType.income") public String code; - @ApiModelProperty(example = "INCOME") - public String value; + @Schema(example = "INCOME") + public String description; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "income from interest") + @Schema(example = "income from interest") public String name; - @ApiModelProperty(example = "04") + @Schema(example = "04") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetLoanProductsIncomeType type; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityUsage usage; - @ApiModelProperty(example = "income from interest") + @Schema(example = "income from interest") public String nameDecorated; public GetLoanProductsLiabilityAccountOptions.GetLoanProductsLiabilityTagId tagId; - @ApiModelProperty(example = "19") + @Schema(example = "19") public Integer organizationRunningBalance; } @@ -756,17 +755,17 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsValueConditionTypeOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "mifos-standard-strategyLoanProductValueConditionType.equal") + @Schema(example = "mifos-standard-strategyLoanProductValueConditionType.equal") public String code; - @ApiModelProperty(example = "equals") - public String value; + @Schema(example = "equals") + public String description; } - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean includeInBorrowerCycle; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean useBorrowerCycle; public GetLoanProductsTemplateCurrency currency; public GetLoanProductsRepaymentTemplateFrequencyType repaymentFrequencyType; @@ -774,16 +773,16 @@ final class LoanProductsApiResourceSwagger { public GetLoanProductsResponse.GetLoanProductsAmortizationType amortizationType; public GetLoanProductsInterestTemplateType interestType; public GetLoanProductsResponse.GetLoansProductsInterestCalculationPeriodType interestCalculationPeriodType; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List principalVariationsForBorrowerCycle; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List interestRateVariationsForBorrowerCycle; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List numberOfRepaymentVariationsForBorrowerCycle; public GetLoanProductsTemplateResponse.GetLoanProductsAccountingRule accountingRule; public GetLoansProductsDaysInMonthTemplateType daysInMonthType; public GetLoanProductsDaysInYearTemplateType daysInYearType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isInterestRecalculationEnabled; public GetLoanProductsInterestRecalculationTemplateData interestRecalculationData; public Set paymentTypeOptions; @@ -806,7 +805,7 @@ final class LoanProductsApiResourceSwagger { public Set interestRecalculationFrequencyTypeOptions; } - @ApiModel(value = "GetLoanProductsProductIdResponse") + @Schema(description = "GetLoanProductsProductIdResponse") public static final class GetLoanProductsProductIdResponse { private GetLoanProductsProductIdResponse() {} @@ -815,12 +814,12 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsInterestRateFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "interestRateFrequency.periodFrequencyType.months") + @Schema(example = "interestRateFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Per month") - public String value; + @Schema(example = "Per month") + public String description; } static final class GetLoanProductsPrincipalVariationsForBorrowerCycle { @@ -831,37 +830,37 @@ final class LoanProductsApiResourceSwagger { private GetLoanProductsParamType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "LoanProductParamType.principal") + @Schema(example = "LoanProductParamType.principal") public String code; - @ApiModelProperty(example = "principal") - public String value; + @Schema(example = "principal") + public String description; } static final class GetLoanProductsValueConditionType { private GetLoanProductsValueConditionType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "LoanProductValueConditionType.equal") + @Schema(example = "LoanProductValueConditionType.equal") public String code; - @ApiModelProperty(example = "equals") - public String value; + @Schema(example = "equals") + public String description; } - @ApiModelProperty(example = "21") + @Schema(example = "21") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer borrowerCycleNumber; public GetLoanProductsParamType paramType; public GetLoanProductsValueConditionType valueConditionType; - @ApiModelProperty(example = "2000.000000") + @Schema(example = "2000.000000") public Float minValue; - @ApiModelProperty(example = "20000.000000") + @Schema(example = "20000.000000") public Float maxValue; - @ApiModelProperty(example = "15000.000000") + @Schema(example = "15000.000000") public Float defaultValue; } @@ -873,11 +872,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanFundSourceAccount() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "fund source") + @Schema(example = "fund source") public String name; - @ApiModelProperty(example = "01") + @Schema(example = "01") public Integer glCode; } @@ -885,11 +884,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanPortfolioAccount() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Loan portfolio") + @Schema(example = "Loan portfolio") public String name; - @ApiModelProperty(example = "02") + @Schema(example = "02") public Integer glCode; } @@ -897,11 +896,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanTransfersInSuspenseAccount() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "transfers") + @Schema(example = "transfers") public String name; - @ApiModelProperty(example = "03") + @Schema(example = "03") public Integer glCode; } @@ -909,11 +908,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanInterestOnLoanAccount() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "income from interest") + @Schema(example = "income from interest") public String name; - @ApiModelProperty(example = "04") + @Schema(example = "04") public Integer glCode; } @@ -921,11 +920,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanIncomeFromFeeAccount() {} - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer id; - @ApiModelProperty(example = "income from fees 2") + @Schema(example = "income from fees 2") public String name; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer glCode; } @@ -933,11 +932,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanIncomeFromPenaltyAccount() {} - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer id; - @ApiModelProperty(example = "income from penalities 2") + @Schema(example = "income from penalities 2") public String name; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer glCode; } @@ -945,11 +944,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanWriteOffAccount() {} - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer id; - @ApiModelProperty(example = "loans written off 2") + @Schema(example = "loans written off 2") public String name; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer glCode; } @@ -957,11 +956,11 @@ final class LoanProductsApiResourceSwagger { private GetLoanOverpaymentLiabilityAccount() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "over payment") + @Schema(example = "over payment") public String name; - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer glCode; } @@ -983,9 +982,9 @@ final class LoanProductsApiResourceSwagger { private GetLoanPaymentType() {} - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer id; - @ApiModelProperty(example = "check") + @Schema(example = "check") public String name; } @@ -1001,13 +1000,13 @@ final class LoanProductsApiResourceSwagger { private GetLoanCharge() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "flat install") + @Schema(example = "flat install") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } @@ -1015,77 +1014,77 @@ final class LoanProductsApiResourceSwagger { public GetLoanAccountingMappings.GetLoanIncomeFromFeeAccount incomeAccount; } - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "advanced accounting") + @Schema(example = "advanced accounting") public String name; - @ApiModelProperty(example = "ad11") + @Schema(example = "ad11") public String shortName; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean includeInBorrowerCycle; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean useBorrowerCycle; - @ApiModelProperty(example = "loanProduct.active") + @Schema(example = "loanProduct.active") public String status; public GetLoanProductsResponse.GetLoanProductsCurrency currency; - @ApiModelProperty(example = "10000.000000") + @Schema(example = "10000.000000") public Float principal; - @ApiModelProperty(example = "2000.000000") + @Schema(example = "2000.000000") public Float minPrincipal; - @ApiModelProperty(example = "15000.000000") + @Schema(example = "15000.000000") public Float maxPrincipal; - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer numberOfRepayments; - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer repaymentEvery; public GetLoanProductsResponse.GetLoanProductsRepaymentFrequencyType repaymentFrequencyType; - @ApiModelProperty(example = "5.000000") + @Schema(example = "5.000000") public Float interestRatePerPeriod; public GetLoanProductsProductIdResponse.GetLoanProductsInterestRateFrequencyType interestRateFrequencyType; - @ApiModelProperty(example = "60.000000") + @Schema(example = "60.000000") public Float annualInterestRate; public GetLoanProductsResponse.GetLoanProductsAmortizationType amortizationType; public GetLoanProductsTemplateResponse.GetLoanProductsInterestTemplateType interestType; public GetLoanProductsResponse.GetLoansProductsInterestCalculationPeriodType interestCalculationPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transactionProcessingStrategyId; - @ApiModelProperty(example = "Mifos style") + @Schema(example = "Mifos style") public String transactionProcessingStrategyName; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List charges; public Set productsPrincipalVariationsForBorrowerCycle; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List interestRateVariationsForBorrowerCycle; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List numberOfRepaymentVariationsForBorrowerCycle; public GetLoanProductsResponse.GetLoanProductsAccountingRule accountingRule; public GetLoanAccountingMappings accountingMappings; public Set paymentChannelToFundSourceMappings; public Set feeToIncomeAccountMappings; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean multiDisburseLoan; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer maxTrancheCount; - @ApiModelProperty(example = "36000.000000") + @Schema(example = "36000.000000") public Float outstandingLoanBalance; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer overdueDaysForNPA; - @ApiModelProperty(example = "50") + @Schema(example = "50") public Integer principalThresholdForLastInstalment; } - @ApiModel(value = "PutLoanProductsProductIdRequest") + @Schema(description = "PutLoanProductsProductIdRequest") public static final class PutLoanProductsProductIdRequest { private PutLoanProductsProductIdRequest() {} - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "70,000.00") + @Schema(example = "70,000.00") public Double principal; } - @ApiModel(value = "PutLoanProductsProductIdResponse") + @Schema(description = "PutLoanProductsProductIdResponse") public static final class PutLoanProductsProductIdResponse { private PutLoanProductsProductIdResponse() {} @@ -1094,13 +1093,13 @@ final class LoanProductsApiResourceSwagger { private PutLoanChanges() {} - @ApiModelProperty(example = "70,000.00") + @Schema(example = "70,000.00") public Double principal; - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutLoanChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java index 0ad4f01e9..c40ad3deb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.note.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -61,8 +61,8 @@ import org.springframework.stereotype.Component; @Path("/{resourceType}/{resourceId}/notes") @Component @Scope("singleton") -@Api(tags = { "Notes" }) -@SwaggerDefinition(tags = { @Tag(name = "Notes", description = "Notes API allows to enter notes for supported resources.") }) + +@Tag(name = "Notes", description = "Notes API allows to enter notes for supported resources.") public class NotesApiResource { private final Set NOTE_DATA_PARAMETERS = new HashSet<>( @@ -89,13 +89,13 @@ public class NotesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Resource's Notes", httpMethod = "GET", notes = "Retrieves a Resource's Notes\n\n" + @Operation(summary = "Retrieve a Resource's description", description = "Retrieves a Resource's Notes\n\n" + "Note: Notes are returned in descending createOn order.\n" + "\n" + "Example Requests:\n" + "\n" + "clients/2/notes\n" + "\n" + "\n" + "groups/2/notes?fields=note,createdOn,createdByUsername") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = NotesApiResourceSwagger.GetResourceTypeResourceIdNotesResponse.class) }) - public String retrieveNotesByResource(@PathParam("resourceType") @ApiParam(value = "resourceType") final String resourceType, - @PathParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = NotesApiResourceSwagger.GetResourceTypeResourceIdNotesResponse.class)))) }) + public String retrieveNotesByResource(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, + @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, @Context final UriInfo uriInfo) { final NoteType noteType = NoteType.fromApiUrl(resourceType); @@ -117,15 +117,15 @@ public class NotesApiResource { @Path("{noteId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Resource Note", httpMethod = "GET", notes = "Retrieves a Resource Note\n\n" + "Example Requests:\n" - + "\n" + "clients/1/notes/76\n" + "\n" + "\n" + "groups/1/notes/20\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Resource Note", description = "Retrieves a Resource Note\n\n" + "Example Requests:\n" + "\n" + + "clients/1/notes/76\n" + "\n" + "\n" + "groups/1/notes/20\n" + "\n" + "\n" + "clients/1/notes/76?fields=note,createdOn,createdByUsername\n" + "\n" + "\n" + "groups/1/notes/20?fields=note,createdOn,createdByUsername") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = NotesApiResourceSwagger.GetResourceTypeResourceIdNotesNoteIdResponse.class) }) - public String retrieveNote(@PathParam("resourceType") @ApiParam(value = "resourceType") final String resourceType, - @PathParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, - @PathParam("noteId") @ApiParam(value = "noteId") final Long noteId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.GetResourceTypeResourceIdNotesNoteIdResponse.class))) }) + public String retrieveNote(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, + @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, + @PathParam("noteId") @Parameter(description = "noteId") final Long noteId, @Context final UriInfo uriInfo) { final NoteType noteType = NoteType.fromApiUrl(resourceType); @@ -146,15 +146,14 @@ public class NotesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Add a Resource Note", httpMethod = "POST", notes = "Adds a new note to a supported resource.\n\n" - + "Example Requests:\n" + "\n" + "clients/1/notes\n" + "\n" + "\n" + "groups/1/notes") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = NotesApiResourceSwagger.PostResourceTypeResourceIdNotesRequest.class) }) + @Operation(summary = "Add a Resource Note", description = "Adds a new note to a supported resource.\n\n" + "Example Requests:\n" + "\n" + + "clients/1/notes\n" + "\n" + "\n" + "groups/1/notes") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.PostResourceTypeResourceIdNotesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = NotesApiResourceSwagger.PostResourceTypeResourceIdNotesResponse.class) }) - public String addNewNote(@PathParam("resourceType") @ApiParam(value = "resourceType") final String resourceType, - @PathParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.PostResourceTypeResourceIdNotesResponse.class))) }) + public String addNewNote(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, + @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final NoteType noteType = NoteType.fromApiUrl(resourceType); @@ -175,15 +174,14 @@ public class NotesApiResource { @Path("{noteId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Resource Note", httpMethod = "PUT", notes = "Updates a Resource Note") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = NotesApiResourceSwagger.PutResourceTypeResourceIdNotesNoteIdRequest.class) }) + @Operation(summary = "Update a Resource Note", description = "Updates a Resource Note") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.PutResourceTypeResourceIdNotesNoteIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = NotesApiResourceSwagger.PutResourceTypeResourceIdNotesNoteIdResponse.class) }) - public String updateNote(@PathParam("resourceType") @ApiParam(value = "resourceType") final String resourceType, - @PathParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, - @PathParam("noteId") @ApiParam(value = "noteId") final Long noteId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.PutResourceTypeResourceIdNotesNoteIdResponse.class))) }) + public String updateNote(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, + @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, + @PathParam("noteId") @Parameter(description = "noteId") final Long noteId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final NoteType noteType = NoteType.fromApiUrl(resourceType); @@ -205,12 +203,12 @@ public class NotesApiResource { @Path("{noteId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Resource Note", httpMethod = "DELETE", notes = "Deletes a Resource Note") + @Operation(summary = "Delete a Resource Note", description = "Deletes a Resource Note") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = NotesApiResourceSwagger.DeleteResourceTypeResourceIdNotesNoteIdResponse.class) }) - public String deleteNote(@PathParam("resourceType") @ApiParam(value = "resourceType") final String resourceType, - @PathParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId, - @PathParam("noteId") @ApiParam(value = "noteId") final Long noteId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.DeleteResourceTypeResourceIdNotesNoteIdResponse.class))) }) + public String deleteNote(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, + @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, + @PathParam("noteId") @Parameter(description = "noteId") final Long noteId) { final NoteType noteType = NoteType.fromApiUrl(resourceType); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResourceSwagger.java index c5f0a22bd..402a92a27 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.note.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.joda.time.DateTime; /** @@ -29,7 +28,7 @@ final class NotesApiResourceSwagger { private NotesApiResourceSwagger() {} - @ApiModel(value = "GetResourceTypeResourceIdNotesResponse") + @Schema(description = "GetResourceTypeResourceIdNotesResponse") public static final class GetResourceTypeResourceIdNotesResponse { private GetResourceTypeResourceIdNotesResponse() {} @@ -38,93 +37,93 @@ final class NotesApiResourceSwagger { private GetNotesNoteType() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "noteType.client") + @Schema(example = "noteType.client") public String code; - @ApiModelProperty(example = "Client note") - public String value; + @Schema(example = "Client note") + public String description; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; public GetNotesNoteType noteType; - @ApiModelProperty(example = "First note edited") + @Schema(example = "First note edited") public String note; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer createdById; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdByUsername; - @ApiModelProperty(example = "1342498505000") + @Schema(example = "1342498505000") public DateTime createdOn; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer updatedById; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String updatedByUsername; - @ApiModelProperty(example = "1342498517000") + @Schema(example = "1342498517000") public DateTime updatedOn; } - @ApiModel(value = "GetResourceTypeResourceIdNotesNoteIdResponse") + @Schema(description = "GetResourceTypeResourceIdNotesNoteIdResponse") public static final class GetResourceTypeResourceIdNotesNoteIdResponse { private GetResourceTypeResourceIdNotesNoteIdResponse() {} - @ApiModelProperty(example = "76") + @Schema(example = "76") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; public GetResourceTypeResourceIdNotesResponse.GetNotesNoteType noteType; - @ApiModelProperty(example = "a note about the client") + @Schema(example = "a note about the client") public String note; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer createdById; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String createdByUsername; - @ApiModelProperty(example = "1359463135000") + @Schema(example = "1359463135000") public DateTime createdOn; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer updatedById; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String updatedByUsername; - @ApiModelProperty(example = "1359463135000") + @Schema(example = "1359463135000") public DateTime updatedOn; } - @ApiModel(value = "PostResourceTypeResourceIdNotesRequest") + @Schema(description = "PostResourceTypeResourceIdNotesRequest") public static final class PostResourceTypeResourceIdNotesRequest { private PostResourceTypeResourceIdNotesRequest() {} - @ApiModelProperty(example = "a note about the client") + @Schema(example = "a note about the client") public String note; } - @ApiModel(value = "PostResourceTypeResourceIdNotesResponse") + @Schema(description = "PostResourceTypeResourceIdNotesResponse") public static final class PostResourceTypeResourceIdNotesResponse { private PostResourceTypeResourceIdNotesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "76") + @Schema(example = "76") public Integer resourceId; } - @ApiModel(value = "PutResourceTypeResourceIdNotesNoteIdRequest") + @Schema(description = "PutResourceTypeResourceIdNotesNoteIdRequest") public static final class PutResourceTypeResourceIdNotesNoteIdRequest { private PutResourceTypeResourceIdNotesNoteIdRequest() {} - @ApiModelProperty(example = "a note about the client") + @Schema(example = "a note about the client") public String note; } - @ApiModel(value = "PutResourceTypeResourceIdNotesNoteIdResponse") + @Schema(description = "PutResourceTypeResourceIdNotesNoteIdResponse") public static final class PutResourceTypeResourceIdNotesNoteIdResponse { private PutResourceTypeResourceIdNotesNoteIdResponse() {} @@ -133,25 +132,25 @@ final class NotesApiResourceSwagger { private PutNotesChanges() {} - @ApiModelProperty(example = "a note about the client") + @Schema(example = "a note about the client") public String note; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "76") + @Schema(example = "76") public Integer resourceId; public PutNotesChanges changes; } - @ApiModel(value = "DeleteResourceTypeResourceIdNotesNoteIdResponse") + @Schema(description = "DeleteResourceTypeResourceIdNotesNoteIdResponse") public static final class DeleteResourceTypeResourceIdNotesNoteIdResponse { private DeleteResourceTypeResourceIdNotesNoteIdResponse() {} - @ApiModelProperty(example = "76") + @Schema(example = "76") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java index c39f17eb6..db90ef806 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.paymenttype.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -55,8 +55,8 @@ import org.springframework.stereotype.Component; @Path("/paymenttypes") @Component -@Api(tags = { "Payment Type" }) -@SwaggerDefinition(tags = { @Tag(name = "Payment Type", description = "This defines the payment type") }) + +@Tag(name = "Payment Type", description = "This defines the payment type") public class PaymentTypeApiResource { private final PlatformSecurityContext securityContext; @@ -86,9 +86,9 @@ public class PaymentTypeApiResource { @GET @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Retrieve all Payment Types", httpMethod = "GET", notes = "Retrieve list of payment types") + @Operation(summary = "Retrieve all Payment Types", description = "Retrieve list of payment types") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = PaymentTypeApiResourceSwagger.GetPaymentTypesResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.GetPaymentTypesResponse.class)))) }) public String getAllPaymentTypes(@Context final UriInfo uriInfo) { this.securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.resourceNameForPermissions); final Collection paymentTypes = this.readPlatformService.retrieveAllPaymentTypes(); @@ -100,10 +100,10 @@ public class PaymentTypeApiResource { @Path("{paymentTypeId}") @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Retrieve a Payment Type", httpMethod = "GET", notes = "Retrieves a payment type") + @Operation(summary = "Retrieve a Payment Type", description = "Retrieves a payment type") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = PaymentTypeApiResourceSwagger.GetPaymentTypesPaymentTypeIdResponse.class) }) - public String retrieveOnePaymentType(@PathParam("paymentTypeId") @ApiParam(value = "paymentTypeId") final Long paymentTypeId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.GetPaymentTypesPaymentTypeIdResponse.class))) }) + public String retrieveOnePaymentType(@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId, @Context final UriInfo uriInfo) { this.securityContext.authenticatedUser().validateHasReadPermission(PaymentTypeApiResourceConstants.resourceNameForPermissions); this.paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId); @@ -115,12 +115,12 @@ public class PaymentTypeApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Payment Type", httpMethod = "POST", notes = "Creates a new Payment type\n\n" - + "Mandatory Fields: name\n\n" + "Optional Fields: Description, isCashPayment,Position") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = PaymentTypeApiResourceSwagger.PostPaymentTypesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = PaymentTypeApiResourceSwagger.PostPaymentTypesResponse.class) }) - public String createPaymentType(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a Payment Type", description = "Creates a new Payment type\n\n" + "Mandatory Fields: name\n\n" + + "Optional Fields: Description, isCashPayment,Position") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PostPaymentTypesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PostPaymentTypesResponse.class))) }) + public String createPaymentType(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createPaymentType().withJson(apiRequestBodyAsJson).build(); @@ -133,13 +133,12 @@ public class PaymentTypeApiResource { @Path("{paymentTypeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Payment Type", httpMethod = "PUT", notes = "Updates a Payment Type") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdRequest.class) }) + @Operation(summary = "Update a Payment Type", description = "Updates a Payment Type") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdResponse.class) }) - public String updatePaymentType(@PathParam("paymentTypeId") @ApiParam(value = "paymentTypeId") final Long paymentTypeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.PutPaymentTypesPaymentTypeIdResponse.class))) }) + public String updatePaymentType(@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePaymentType(paymentTypeId).withJson(apiRequestBodyAsJson) .build(); @@ -153,10 +152,10 @@ public class PaymentTypeApiResource { @Path("{paymentTypeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Payment Type", httpMethod = "DELETE", notes = "Deletes payment type") + @Operation(summary = "Delete a Payment Type", description = "Deletes payment type") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = PaymentTypeApiResourceSwagger.DeletePaymentTypesPaymentTypeIdResponse.class) }) - public String deleteCode(@PathParam("paymentTypeId") @ApiParam(value = "paymentTypeId") final Long paymentTypeId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PaymentTypeApiResourceSwagger.DeletePaymentTypesPaymentTypeIdResponse.class))) }) + public String deleteCode(@PathParam("paymentTypeId") @Parameter(description = "paymentTypeId") final Long paymentTypeId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deletePaymentType(paymentTypeId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceSwagger.java index 48ee1e7a3..ead8bd51d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.paymenttype.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by Chirag Gupta on 01/01/18. @@ -28,94 +27,94 @@ final class PaymentTypeApiResourceSwagger { private PaymentTypeApiResourceSwagger() {} - @ApiModel(value = "GetPaymentTypesResponse") + @Schema(description = "GetPaymentTypesResponse") public static final class GetPaymentTypesResponse { private GetPaymentTypesResponse() {} - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer id; - @ApiModelProperty(example = "PTC") + @Schema(example = "PTC") public String name; - @ApiModelProperty(example = "Cash") + @Schema(example = "Cash") public String description; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isCashPayment; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } - @ApiModel(value = "GetPaymentTypesPaymentTypeIdResponse") + @Schema(description = "GetPaymentTypesPaymentTypeIdResponse") public static final class GetPaymentTypesPaymentTypeIdResponse { private GetPaymentTypesPaymentTypeIdResponse() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; - @ApiModelProperty(example = "cash") + @Schema(example = "cash") public String name; - @ApiModelProperty(example = "cash Payment") + @Schema(example = "cash Payment") public String description; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isCashPayment; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer position; } - @ApiModel(value = "PostPaymentTypesRequest") + @Schema(description = "PostPaymentTypesRequest") public static final class PostPaymentTypesRequest { private PostPaymentTypesRequest() {} - @ApiModelProperty(example = "cash") + @Schema(example = "cash") public String name; - @ApiModelProperty(example = "cash payment type") + @Schema(example = "cash payment type") public String description; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isCashPayment; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer position; } - @ApiModel(value = "PostPaymentTypesResponse") + @Schema(description = "PostPaymentTypesResponse") public static final class PostPaymentTypesResponse { private PostPaymentTypesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutPaymentTypesPaymentTypeIdRequest") + @Schema(description = "PutPaymentTypesPaymentTypeIdRequest") public static final class PutPaymentTypesPaymentTypeIdRequest { private PutPaymentTypesPaymentTypeIdRequest() {} - @ApiModelProperty(example = "mPay") + @Schema(example = "mPay") public String name; - @ApiModelProperty(example = "not a cash payment type") + @Schema(example = "not a cash payment type") public String description; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isCashPayment; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer position; } - @ApiModel(value = "PutPaymentTypesPaymentTypeIdResponse") + @Schema(description = "PutPaymentTypesPaymentTypeIdResponse") public static final class PutPaymentTypesPaymentTypeIdResponse { private PutPaymentTypesPaymentTypeIdResponse() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer resourceId; } - @ApiModel(value = "DeletePaymentTypesPaymentTypeIdResponse") + @Schema(description = "DeletePaymentTypesPaymentTypeIdResponse") public static final class DeletePaymentTypesPaymentTypeIdResponse { private DeletePaymentTypesPaymentTypeIdResponse() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java index 59bf373cc..64ec8fb52 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.portfolio.products.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -58,7 +58,7 @@ import org.springframework.stereotype.Component; @Path("/products/{type}") @Component @Scope("singleton") -@Api(value = "Products", description = "") + public class ProductsApiResource { private final ApplicationContext applicationContext; @@ -82,7 +82,8 @@ public class ProductsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String retrieveTemplate(@PathParam("type") @ApiParam(value = "type") final String productType, @Context final UriInfo uriInfo) { + public String retrieveTemplate(@PathParam("type") @Parameter(description = "type") final String productType, + @Context final UriInfo uriInfo) { String serviceName = productType + ProductsApiConstants.READPLATFORM_NAME; try { ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName); @@ -98,12 +99,12 @@ public class ProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Share Product", httpMethod = "GET", notes = "Retrieves a Share Product\n\n" + "Example Requests:\n" - + "\n" + "products/share/1\n" + "\n" + "\n" + "products/share/1?template=true") + @Operation(summary = "Retrieve a Share Product", description = "Retrieves a Share Product\n\n" + "Example Requests:\n" + "\n" + + "products/share/1\n" + "\n" + "\n" + "products/share/1?template=true") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ProductsApiResourceSwagger.GetProductsTypeProductIdResponse.class) }) - public String retrieveProduct(@PathParam("productId") @ApiParam(value = "productId") final Long productId, - @PathParam("type") @ApiParam(value = "type") final String productType, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ProductsApiResourceSwagger.GetProductsTypeProductIdResponse.class))) }) + public String retrieveProduct(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @PathParam("type") @Parameter(description = "type") final String productType, @Context final UriInfo uriInfo) { try { String serviceName = productType + ProductsApiConstants.READPLATFORM_NAME; ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName); @@ -118,12 +119,13 @@ public class ProductsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Share Products", httpMethod = "GET", notes = "Lists Share Products\n\n" - + "Mandatory Fields: limit, offset\n\n" + "Example Requests:\n" + "\n" + "shareproducts") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ProductsApiResourceSwagger.GetProductsTypeResponse.class) }) - public String retrieveAllProducts(@PathParam("type") @ApiParam(value = "type") final String productType, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, @Context final UriInfo uriInfo) { + @Operation(summary = "List Share Products", description = "Lists Share Products\n\n" + "Mandatory Fields: limit, offset\n\n" + + "Example Requests:\n" + "\n" + "shareproducts") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ProductsApiResourceSwagger.GetProductsTypeResponse.class))) }) + public String retrieveAllProducts(@PathParam("type") @Parameter(description = "type") final String productType, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, @Context final UriInfo uriInfo) { try { String serviceName = productType + ProductsApiConstants.READPLATFORM_NAME; ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName); @@ -138,15 +140,15 @@ public class ProductsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Share Product", httpMethod = "POST", notes = "Creates a Share Product\n\n" + @Operation(summary = "Create a Share Product", description = "Creates a Share Product\n\n" + "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, locale, totalShares, unitPrice, nominalShares,allowDividendCalculationForInactiveClients,accountingRule\n\n" + "Mandatory Fields for Cash based accounting (accountingRule = 2): shareReferenceId, shareSuspenseId, shareEquityId, incomeFromFeeAccountId\n\n" + "Optional Fields: sharesIssued, minimumShares, maximumShares, minimumActivePeriodForDividends, minimumactiveperiodFrequencyType, lockinPeriodFrequency, lockinPeriodFrequencyType, marketPricePeriods, chargesSelected") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ProductsApiResourceSwagger.PostProductsTypeRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ProductsApiResourceSwagger.PostProductsTypeResponse.class) }) - public String createProduct(@PathParam("type") @ApiParam(value = "type") final String productType, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ProductsApiResourceSwagger.PostProductsTypeRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ProductsApiResourceSwagger.PostProductsTypeResponse.class))) }) + public String createProduct(@PathParam("type") @Parameter(description = "type") final String productType, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = null; this.platformSecurityContext.authenticatedUser(); commandWrapper = new CommandWrapperBuilder().createProduct(productType).withJson(apiRequestBodyAsJson).build(); @@ -158,10 +160,10 @@ public class ProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String handleCommands(@PathParam("type") @ApiParam(value = "type") final String productType, - @PathParam("productId") @ApiParam(value = "productId") final Long productId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @SuppressWarnings("unused") @Context final UriInfo uriInfo, @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + public String handleCommands(@PathParam("type") @Parameter(description = "type") final String productType, + @PathParam("productId") @Parameter(description = "productId") final Long productId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @SuppressWarnings("unused") @Context final UriInfo uriInfo, @Parameter(hidden = true) final String apiRequestBodyAsJson) { CommandWrapper commandWrapper = new CommandWrapperBuilder().createProductCommand(productType, commandParam, productId) .withJson(apiRequestBodyAsJson).build(); final CommandProcessingResult commandProcessingResult = this.commandsSourceWritePlatformService.logCommandSource(commandWrapper); @@ -172,14 +174,13 @@ public class ProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Share Product", httpMethod = "PUT", notes = "Updates a Share Product") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ProductsApiResourceSwagger.PutProductsTypeProductIdRequest.class) }) + @Operation(summary = "Update a Share Product", description = "Updates a Share Product") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ProductsApiResourceSwagger.PutProductsTypeProductIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = ProductsApiResourceSwagger.PutProductsTypeProductIdResponse.class) }) - public String updateProduct(@PathParam("type") @ApiParam(value = "type") final String productType, - @PathParam("productId") @ApiParam(value = "productId") final Long productId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ProductsApiResourceSwagger.PutProductsTypeProductIdResponse.class))) }) + public String updateProduct(@PathParam("type") @Parameter(description = "type") final String productType, + @PathParam("productId") @Parameter(description = "productId") final Long productId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { this.platformSecurityContext.authenticatedUser(); final CommandWrapper commandRequest = new CommandWrapperBuilder().updateProduct(productType, productId) .withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResourceSwagger.java index 82ed03450..22f7d490b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.products.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class ProductsApiResourceSwagger { private ProductsApiResourceSwagger() {} - @ApiModel(value = "GetProductsTypeProductIdResponse") + @Schema(description = "GetProductsTypeProductIdResponse") public static final class GetProductsTypeProductIdResponse { private GetProductsTypeProductIdResponse() {} @@ -38,19 +37,19 @@ final class ProductsApiResourceSwagger { private GetProductsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -58,11 +57,11 @@ final class ProductsApiResourceSwagger { private GetProductsMarketPrice() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "Feb 1, 2016") + @Schema(example = "Feb 1, 2016") public String fromDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer shareValue; } @@ -74,17 +73,17 @@ final class ProductsApiResourceSwagger { private GetChargesCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -92,60 +91,60 @@ final class ProductsApiResourceSwagger { private GetChargeTimeType() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; - @ApiModelProperty(example = "chargeTimeType.activation") + @Schema(example = "chargeTimeType.activation") public String code; - @ApiModelProperty(example = "Share Account Activate") - public String value; + @Schema(example = "Share Account Activate") + public String description; } static final class GetChargeAppliesTo { private GetChargeAppliesTo() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.shares") + @Schema(example = "chargeAppliesTo.shares") public String code; - @ApiModelProperty(example = "Shares") - public String value; + @Schema(example = "Shares") + public String description; } static final class GetChargeCalculationType { private GetChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetChargePaymentMode { private GetChargePaymentMode() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.regular") + @Schema(example = "chargepaymentmode.regular") public String code; - @ApiModelProperty(example = "Regular") - public String value; + @Schema(example = "Regular") + public String description; } - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer id; - @ApiModelProperty(example = "Share Account Activation Flat") + @Schema(example = "Share Account Activation Flat") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; public GetChargesCurrency currency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amount; public GetChargeTimeType chargeTimeType; public GetChargeAppliesTo chargeAppliesTo; @@ -157,22 +156,22 @@ final class ProductsApiResourceSwagger { private GetLockPeriodTypeEnum() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetProductsAccountingRule { private GetProductsAccountingRule() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountingRuleType.cash") + @Schema(example = "accountingRuleType.cash") public String code; - @ApiModelProperty(example = "CASH BASED") - public String value; + @Schema(example = "CASH BASED") + public String description; } static final class GetProductsAccountingMappings { @@ -183,11 +182,11 @@ final class ProductsApiResourceSwagger { private GetShareReferenceId() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String name; - @ApiModelProperty(example = "ASSET_ED1461237837829") + @Schema(example = "ASSET_ED1461237837829") public String glCode; } @@ -195,11 +194,11 @@ final class ProductsApiResourceSwagger { private GetIncomeFromFeeAccountId() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String name; - @ApiModelProperty(example = "INCOME_OY1461237869836") + @Schema(example = "INCOME_OY1461237869836") public String glCode; } @@ -207,11 +206,11 @@ final class ProductsApiResourceSwagger { private GetShareEquityId() {} - @ApiModelProperty(example = "66") + @Schema(example = "66") public Integer id; - @ApiModelProperty(example = "Equity Account") + @Schema(example = "Equity Account") public String name; - @ApiModelProperty(example = "EQUITY1") + @Schema(example = "EQUITY1") public String glCode; } @@ -219,11 +218,11 @@ final class ProductsApiResourceSwagger { private GetShareSuspenseId() {} - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String name; - @ApiModelProperty(example = "LIABILITY_MA1461237860198") + @Schema(example = "LIABILITY_MA1461237860198") public String glCode; } @@ -237,12 +236,12 @@ final class ProductsApiResourceSwagger { private GetProductsMinimumActivePeriodFrequencyTypeOptions() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "savings.lockin.sharePeriodFrequencyType.days") + @Schema(example = "savings.lockin.sharePeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetProductsAccountingMappingOptions { @@ -257,51 +256,51 @@ final class ProductsApiResourceSwagger { private GetProductsLiabilityType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.liability") + @Schema(example = "accountType.liability") public String code; - @ApiModelProperty(example = "LIABILITY") - public String value; + @Schema(example = "LIABILITY") + public String description; } static final class GetProductsLiabilityUsage { private GetProductsLiabilityUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public String value; + @Schema(example = "DETAIL") + public String description; } static final class GetProductsTagId { private GetProductsTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isActive; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String name; - @ApiModelProperty(example = "LIABILITY_2T1461237838897") + @Schema(example = "LIABILITY_2T1461237838897") public String glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetProductsLiabilityType type; public GetProductsLiabilityUsage usage; - @ApiModelProperty(example = "DEFAULT_DESCRIPTION") + @Schema(example = "DEFAULT_DESCRIPTION") public String description; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String nameDecorated; public GetProductsTagId tagId; } @@ -314,29 +313,29 @@ final class ProductsApiResourceSwagger { private GetAssetType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountType.asset") + @Schema(example = "accountType.asset") public String code; - @ApiModelProperty(example = "ASSET") - public String value; + @Schema(example = "ASSET") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String name; - @ApiModelProperty(example = "ASSET_ED1461237837829") + @Schema(example = "ASSET_ED1461237837829") public String glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetAssetType type; public GetProductsLiabilityAccountOptions.GetProductsLiabilityUsage usage; - @ApiModelProperty(example = "DEFAULT_DESCRIPTION") + @Schema(example = "DEFAULT_DESCRIPTION") public String description; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String nameDecorated; public GetProductsLiabilityAccountOptions.GetProductsTagId tagId; } @@ -349,29 +348,29 @@ final class ProductsApiResourceSwagger { private GetIncomeType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountType.income") + @Schema(example = "accountType.income") public String code; - @ApiModelProperty(example = "INCOME") - public String value; + @Schema(example = "INCOME") + public String description; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String name; - @ApiModelProperty(example = "INCOME_9O1461237838422") + @Schema(example = "INCOME_9O1461237838422") public String glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetIncomeType type; public GetProductsLiabilityAccountOptions.GetProductsLiabilityUsage usage; - @ApiModelProperty(example = "DEFAULT_DESCRIPTION") + @Schema(example = "DEFAULT_DESCRIPTION") public String description; - @ApiModelProperty(example = "ACCOUNT_NAME_1FJBQ") + @Schema(example = "ACCOUNT_NAME_1FJBQ") public String nameDecorated; public GetProductsLiabilityAccountOptions.GetProductsTagId tagId; } @@ -384,27 +383,27 @@ final class ProductsApiResourceSwagger { private GetEquityType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "accountType.equity") + @Schema(example = "accountType.equity") public String code; - @ApiModelProperty(example = "EQUITY") - public String value; + @Schema(example = "EQUITY") + public String description; } - @ApiModelProperty(example = "66") + @Schema(example = "66") public Integer id; - @ApiModelProperty(example = "Equity Account") + @Schema(example = "Equity Account") public String name; - @ApiModelProperty(example = "EQUITY1") + @Schema(example = "EQUITY1") public String glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetEquityType type; public GetProductsLiabilityAccountOptions.GetProductsLiabilityUsage usage; - @ApiModelProperty(example = "Equity Account") + @Schema(example = "Equity Account") public String nameDecorated; public GetProductsLiabilityAccountOptions.GetProductsTagId tagId; } @@ -415,37 +414,37 @@ final class ProductsApiResourceSwagger { public Set equityAccountOptions; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Share Product") + @Schema(example = "Share Product") public String name; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String shortName; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String description; public GetProductsCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer totalShares; - @ApiModelProperty(example = "50") + @Schema(example = "50") public Integer totalSharesIssued; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer unitPrice; - @ApiModelProperty(example = "50") + @Schema(example = "50") public Integer shareCapital; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minimumShares; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer nominalShares; - @ApiModelProperty(example = "50") + @Schema(example = "50") public Integer maximumShares; public Set marketPrice; public Set charges; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean allowDividendCalculationForInactiveClients; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer lockinPeriod; public GetLockPeriodTypeEnum lockPeriodTypeEnum; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minimumActivePeriod; public GetLockPeriodTypeEnum minimumActivePeriodForDividendsTypeEnum; public GetProductsAccountingRule accountingRule; @@ -457,7 +456,7 @@ final class ProductsApiResourceSwagger { public GetProductsAccountingMappingOptions accountingMappingOptions; } - @ApiModel(value = "GetProductsTypeResponse") + @Schema(description = "GetProductsTypeResponse") public static final class GetProductsTypeResponse { private GetProductsTypeResponse() {} @@ -466,22 +465,22 @@ final class ProductsApiResourceSwagger { private GetProductsPageItems() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Share Product") + @Schema(example = "Share Product") public String name; - @ApiModelProperty(example = "Share Product Description") + @Schema(example = "Share Product Description") public String shortName; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer totalShares; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "PostProductsTypeRequest") + @Schema(description = "PostProductsTypeRequest") public static final class PostProductsTypeRequest { private PostProductsTypeRequest() {} @@ -490,13 +489,13 @@ final class ProductsApiResourceSwagger { private PostProductsMarketPricePeriods() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "04 May 2016") + @Schema(example = "04 May 2016") public String fromDate; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer shareValue; } @@ -504,75 +503,75 @@ final class ProductsApiResourceSwagger { private PostProductsChargesSelected() {} - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer id; } - @ApiModelProperty(example = "Share Product") + @Schema(example = "Share Product") public String name; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String shortName; - @ApiModelProperty(example = "Description") + @Schema(example = "Description") public String description; - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer digitsAfterDecimal; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer inMultiplesOf; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer totalShares; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer sharesIssued; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer unitPrice; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer minimumShares; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer nominalShares; - @ApiModelProperty(example = "30") + @Schema(example = "30") public Integer maximumShares; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minimumActivePeriodForDividends; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer minimumactiveperiodFrequencyType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer lockinPeriodFrequency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer lockinPeriodFrequencyType; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean allowDividendCalculationForInactiveClients; public Set marketPricePeriods; public Set chargesSelected; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountingRule; } - @ApiModel(value = "PostProductsTypeResponse") + @Schema(description = "PostProductsTypeResponse") public static final class PostProductsTypeResponse { private PostProductsTypeResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutProductsTypeProductIdRequest") + @Schema(description = "PutProductsTypeProductIdRequest") public static final class PutProductsTypeProductIdRequest { private PutProductsTypeProductIdRequest() {} - @ApiModelProperty(example = "Share Product Description.") + @Schema(example = "Share Product Description.") public String description; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "5.0") + @Schema(example = "5.0") public Double unitPrice; } - @ApiModel(value = "PutProductsTypeProductIdResponse") + @Schema(description = "PutProductsTypeProductIdResponse") public static final class PutProductsTypeProductIdResponse { private PutProductsTypeProductIdResponse() {} @@ -581,15 +580,15 @@ final class ProductsApiResourceSwagger { private PutProductsChanges() {} - @ApiModelProperty(example = "Share Product Description.") + @Schema(example = "Share Product Description.") public String description; - @ApiModelProperty(example = "5.0") + @Schema(example = "5.0") public Double unitPrice; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutProductsChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java index e5f34b25b..94df33711 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java @@ -21,15 +21,15 @@ package org.apache.fineract.portfolio.savings.api; import com.google.gson.JsonElement; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.math.BigDecimal; import java.util.Arrays; @@ -88,9 +88,7 @@ import org.springframework.util.CollectionUtils; @Path("/fixeddepositaccounts") @Component @Scope("singleton") -@Api(tags = { "Fixed Deposit Account" }) -@SwaggerDefinition(tags = { - @Tag(name = "Fixed Deposit Account", description = "Fixed Deposit accounts are instances of a praticular fixed deposit product created. An application process around the creation of accounts is also supported.") }) +@Tag(name = "Fixed Deposit Account", description = "Fixed Deposit accounts are instances of a praticular fixed deposit product created. An application process around the creation of accounts is also supported.") public class FixedDepositAccountsApiResource { private final DepositAccountReadPlatformService depositAccountReadPlatformService; @@ -132,15 +130,15 @@ public class FixedDepositAccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Fixed Deposit Account Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for fixed deposit applications. The template data returned consists of any or all of:\n\n" + @Operation(summary = "Retrieve Fixed Deposit Account Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for fixed deposit applications. The template data returned consists of any or all of:\n\n" + "\n\n" + "Field Defaults\n\n" + "Allowed Value Lists" + "Example Requests:\n\n" + "\n\n" + "fixeddepositaccounts/template?clientId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsTemplateResponse.class) }) - public String template(@QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsTemplateResponse.class))) }) + public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); @@ -155,15 +153,15 @@ public class FixedDepositAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Fixed deposit applications/accounts", httpMethod = "GET", notes = "Lists Fixed Deposit Accounts\n\n" + @Operation(summary = "List Fixed deposit applications/accounts", description = "Lists Fixed Deposit Accounts\n\n" + "Example Requests:\n\n" + "\n\n" + "fixeddepositaccounts\n\n" + "\n\n" + "fixeddepositaccounts?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsResponse.class, responseContainer = "List") }) - public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @ApiParam(value = "paged") final Boolean paged, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsResponse.class)))) }) + public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @Parameter(description = "paged") final Boolean paged, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); final PaginationParameters paginationParameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder); @@ -185,14 +183,13 @@ public class FixedDepositAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Submit new fixed deposit application", httpMethod = "POST", notes = "Submits a new fixed deposit application" + @Operation(summary = "Submit new fixed deposit application", description = "Submits a new fixed deposit application" + "Mandatory Fields: clientId or groupId, productId, submittedOnDate, depositAmount, depositPeriod, depositPeriodFrequencyId\n\n" + "Optional Fields: accountNo, externalId, fieldOfficerId,linkAccountId(if provided initial deposit amount will be collected from this account),transferInterestToSavings(By enabling this flag all interest postings will be transferred to linked saving account )") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsResponse.class) }) - public String submitApplication(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsResponse.class))) }) + public String submitApplication(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createFixedDepositAccount().withJson(apiRequestBodyAsJson) .build(); @@ -206,13 +203,13 @@ public class FixedDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a fixed deposit application/account", httpMethod = "GET", notes = "Retrieves a fixed deposit application/account\n\n" + @Operation(summary = "Retrieve a fixed deposit application/account", description = "Retrieves a fixed deposit application/account\n\n" + "Example Requests :\n\n" + "\n\n" + "fixeddepositaccounts/1" + "\n\n" + "fixeddepositaccounts/1?associations=all") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsAccountIdResponse.class) }) - public String retrieveOne(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @DefaultValue("all") @QueryParam("chargeStatus") @ApiParam(value = "chargeStatus") final String chargeStatus, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsAccountIdResponse.class))) }) + public String retrieveOne(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); @@ -309,13 +306,12 @@ public class FixedDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Modify a fixed deposit application", httpMethod = "PUT", notes = "Fixed deposit application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdRequest.class) }) + @Operation(summary = "Modify a fixed deposit application", description = "Fixed deposit application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdResponse.class) }) - public String update(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdResponse.class))) }) + public String update(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateFixedDepositAccount(accountId) .withJson(apiRequestBodyAsJson).build(); @@ -329,7 +325,7 @@ public class FixedDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve fixed deposit application | Undo approval fixed deposit application | Reject fixed deposit application | Withdraw fixed deposit application | Activate a fixed deposit account | Close a fixed deposit account | Premature Close a fixed deposit account | Calculate Premature amount on Fixed deposit account | Calculate Interest on Fixed Deposit Account | Post Interest on Fixed Deposit Account", httpMethod = "POST", notes = "Approve fixed deposit application:\n\n" + @Operation(summary = "Approve fixed deposit application | Undo approval fixed deposit application | Reject fixed deposit application | Withdraw fixed deposit application | Activate a fixed deposit account | Close a fixed deposit account | Premature Close a fixed deposit account | Calculate Premature amount on Fixed deposit account | Calculate Interest on Fixed Deposit Account | Post Interest on Fixed Deposit Account", description = "Approve fixed deposit application:\n\n" + "Approves fixed deposit application so long as its in 'Submitted and pending approval' state.\n\n" + "Undo approval fixed deposit application:\n\n" + "Will move 'approved' fixed deposit application back to 'Submitted and pending approval' state.\n\n" @@ -348,13 +344,12 @@ public class FixedDepositAccountsApiResource { + "Post Interest on Fixed Deposit Account:\n\n" + "Calculates and Posts interest earned on a fixed deposit account based on today's date and whether an interest posting or crediting event is due.\n\n" + "Showing request/response for Calculate Interest on Fixed Deposit Account") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdResponse.class) }) - public String handleCommands(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdResponse.class))) }) + public String handleCommands(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String jsonApiRequest = apiRequestBodyAsJson; if (StringUtils.isBlank(jsonApiRequest)) { @@ -418,10 +413,10 @@ public class FixedDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a fixed deposit application", httpMethod = "DELETE", notes = "At present we support hard delete of fixed deposit application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the fixed deposit account.") + @Operation(summary = "Delete a fixed deposit application", description = "At present we support hard delete of fixed deposit application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the fixed deposit account.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositAccountsApiResourceSwagger.DeleteFixedDepositAccountsAccountIdResponse.class) }) - public String delete(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.DeleteFixedDepositAccountsAccountIdResponse.class))) }) + public String delete(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteFixedDepositAccount(accountId).build(); @@ -434,8 +429,8 @@ public class FixedDepositAccountsApiResource { @Path("{accountId}/template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String accountClosureTemplate(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo) { + public String accountClosureTemplate(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); DepositAccountData account = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResourceSwagger.java index 7dcd311d5..cd3547582 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class FixedDepositAccountsApiResourceSwagger { private FixedDepositAccountsApiResourceSwagger() {} - @ApiModel(value = "GetFixedDepositAccountsTemplateResponse") + @Schema(description = "GetFixedDepositAccountsTemplateResponse") public static final class GetFixedDepositAccountsTemplateResponse { private GetFixedDepositAccountsTemplateResponse() {} @@ -39,20 +38,20 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsProductOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "small business") + @Schema(example = "small business") public String clientName; public Set productOptions; } - @ApiModel(value = "GetFixedDepositAccountsResponse") + @Schema(description = "GetFixedDepositAccountsResponse") public static final class GetFixedDepositAccountsResponse { private GetFixedDepositAccountsResponse() {} @@ -61,29 +60,29 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean prematureClosed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean transferInProgress; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean transferOnHold; } @@ -91,13 +90,13 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsTimeline() {} - @ApiModelProperty(example = "[2014, 3, 1]") + @Schema(example = "[2014, 3, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; } @@ -105,19 +104,19 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -125,48 +124,48 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetFixedDepositAccountsInterestPostingPeriodType { private GetFixedDepositAccountsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetFixedDepositAccountsInterestCalculationType { private GetFixedDepositAccountsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetFixedDepositAccountsInterestCalculationDaysInYearType { private GetFixedDepositAccountsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetFixedDepositAccountsSummary { @@ -174,7 +173,7 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsSummary() {} public GetFixedDepositAccountsCurrency currency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float accountBalance; } @@ -182,51 +181,51 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsMinDepositTermType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.months") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetFixedDepositAccountsMaxDepositTermType { private GetFixedDepositAccountsMaxDepositTermType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.years") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.years") public String code; - @ApiModelProperty(example = "Years") - public String value; + @Schema(example = "Years") + public String description; } static final class GetFixedDepositAccountsDepositPeriodFrequency { private GetFixedDepositAccountsDepositPeriodFrequency() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "deposit.period.savingsPeriodFrequencyType.months") + @Schema(example = "deposit.period.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Sangamesh N") + @Schema(example = "Sangamesh N") public String clientName; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer savingsProductId; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetFixedDepositAccountsStatus status; public GetFixedDepositAccountsTimeline timeline; @@ -236,66 +235,66 @@ final class FixedDepositAccountsApiResourceSwagger { public GetFixedDepositAccountsInterestCalculationType interestCalculationType; public GetFixedDepositAccountsInterestCalculationDaysInYearType interestCalculationDaysInYearType; public GetFixedDepositAccountsSummary summary; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean interestFreePeriodApplicable; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer minDepositTerm; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer maxDepositTerm; public GetFixedDepositAccountsMinDepositTermType minDepositTermType; public GetFixedDepositAccountsMaxDepositTermType maxDepositTermType; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Float depositAmount; - @ApiModelProperty(example = "5140.25") + @Schema(example = "5140.25") public Float maturityAmount; - @ApiModelProperty(example = "[2014, 9, 1]") + @Schema(example = "[2014, 9, 1]") public LocalDate maturityDate; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer depositPeriod; public GetFixedDepositAccountsDepositPeriodFrequency depositPeriodFrequency; } - @ApiModel(value = "PostFixedDepositAccountsRequest") + @Schema(description = "PostFixedDepositAccountsRequest") public static final class PostFixedDepositAccountsRequest { private PostFixedDepositAccountsRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 March 2014") + @Schema(example = "01 March 2014") public String submittedOnDate; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Float depositAmount; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer depositPeriod; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer depositPeriodFrequencyId; } - @ApiModel(value = "PostFixedDepositAccountsResponse") + @Schema(description = "PostFixedDepositAccountsResponse") public static final class PostFixedDepositAccountsResponse { private PostFixedDepositAccountsResponse() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetFixedDepositAccountsAccountIdResponse") + @Schema(description = "GetFixedDepositAccountsAccountIdResponse") public static final class GetFixedDepositAccountsAccountIdResponse { private GetFixedDepositAccountsAccountIdResponse() {} @@ -312,40 +311,40 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsPeriodType() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.days") + @Schema(example = "interestChartPeriodType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetFixedDepositAccountsAccountChartCurrency { private GetFixedDepositAccountsAccountChartCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; public GetFixedDepositAccountsPeriodType periodType; - @ApiModelProperty(example = "181") + @Schema(example = "181") public Integer fromPeriod; - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer toPeriod; - @ApiModelProperty(example = "5.5") + @Schema(example = "5.5") public Double annualInterestRate; public GetFixedDepositAccountsAccountChartCurrency currency; } @@ -354,21 +353,21 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsPeriodTypes() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.days") + @Schema(example = "interestChartPeriodType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "[2013, 10, 2]") + @Schema(example = "[2013, 10, 2]") public LocalDate fromDate; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer accountId; - @ApiModelProperty(example = "FD000023") + @Schema(example = "FD000023") public Long accountNumber; public Set chartSlabs; public Set periodTypes; @@ -378,19 +377,19 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsAccountIdCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -399,25 +398,25 @@ final class FixedDepositAccountsApiResourceSwagger { private GetFixedDepositAccountsAccountIdSummary() {} public GetFixedDepositAccountsAccountIdCurrency currency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float accountBalance; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "FD000023") + @Schema(example = "FD000023") public Long accountNo; - @ApiModelProperty(example = "FD-23") + @Schema(example = "FD-23") public String externalId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Sangamesh N") + @Schema(example = "Sangamesh N") public String clientName; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer savingsProductId; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsStatus status; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsTimeline timeline; @@ -426,41 +425,41 @@ final class FixedDepositAccountsApiResourceSwagger { public GetFixedDepositAccountsResponse.GetFixedDepositAccountsInterestPostingPeriodType interestPostingPeriodType; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsInterestCalculationType interestCalculationType; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsInterestCalculationDaysInYearType interestCalculationDaysInYearType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean interestFreePeriodApplicable; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer minDepositTerm; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer maxDepositTerm; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsMinDepositTermType minDepositTermType; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsMaxDepositTermType maxDepositTermType; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Float depositAmount; - @ApiModelProperty(example = "5140.25") + @Schema(example = "5140.25") public Float maturityAmount; - @ApiModelProperty(example = "[2014, 9, 1]") + @Schema(example = "[2014, 9, 1]") public LocalDate maturityDate; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer depositPeriod; public GetFixedDepositAccountsResponse.GetFixedDepositAccountsDepositPeriodFrequency depositPeriodFrequency; public GetFixedDepositAccountsAccountIdSummary summary; public GetFixedDepositAccountsAccountChart accountChart; } - @ApiModel(value = "PutFixedDepositAccountsAccountIdRequest") + @Schema(description = "PutFixedDepositAccountsAccountIdRequest") public static final class PutFixedDepositAccountsAccountIdRequest { private PutFixedDepositAccountsAccountIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "6000") + @Schema(example = "6000") public Float depositAmount; } - @ApiModel(value = "PutFixedDepositAccountsAccountIdResponse") + @Schema(description = "PutFixedDepositAccountsAccountIdResponse") public static final class PutFixedDepositAccountsAccountIdResponse { private PutFixedDepositAccountsAccountIdResponse() {} @@ -469,54 +468,54 @@ final class FixedDepositAccountsApiResourceSwagger { private PutFixedDepositAccountsChanges() {} - @ApiModelProperty(example = "6000") + @Schema(example = "6000") public Float depositAmount; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutFixedDepositAccountsChanges changes; } - @ApiModel(value = "PostFixedDepositAccountsAccountIdRequest") + @Schema(description = "PostFixedDepositAccountsAccountIdRequest") public static final class PostFixedDepositAccountsAccountIdRequest { private PostFixedDepositAccountsAccountIdRequest() {} } - @ApiModel(value = "PostFixedDepositAccountsAccountIdResponse") + @Schema(description = "PostFixedDepositAccountsAccountIdResponse") public static final class PostFixedDepositAccountsAccountIdResponse { private PostFixedDepositAccountsAccountIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "DeleteFixedDepositAccountsAccountIdResponse") + @Schema(description = "DeleteFixedDepositAccountsAccountIdResponse") public static final class DeleteFixedDepositAccountsAccountIdResponse { private DeleteFixedDepositAccountsAccountIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java index 03c7d656b..8d1900205 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -88,11 +88,9 @@ import org.springframework.util.CollectionUtils; @Path("/fixeddepositproducts") @Component @Scope("singleton") -@Api(tags = { "Fixed Deposit Product" }) -@SwaggerDefinition(tags = { - @Tag(name = "Fixed Deposit Product", description = "This is one of the advanced term deposit product offered by MFI's. The Fixed Deposit Products (aka FD) product offerings are modeled using this API.\n" - + "\n" + "The FD products are deposit accounts which are held for a fixed term – like 1 year, 2 years etc.\n" + "\n" - + "When creating fixed deposit accounts, the details from the fixed deposit product are used to auto fill details of the fixed deposit account application process.") }) +@Tag(name = "Fixed Deposit Product", description = "This is one of the advanced term deposit product offered by MFI's. The Fixed Deposit Products (aka FD) product offerings are modeled using this API.\n" + + "\n" + "The FD products are deposit accounts which are held for a fixed term – like 1 year, 2 years etc.\n" + "\n" + + "When creating fixed deposit accounts, the details from the fixed deposit product are used to auto fill details of the fixed deposit account application process.") public class FixedDepositProductsApiResource { private final DepositProductReadPlatformService depositProductReadPlatformService; @@ -147,16 +145,15 @@ public class FixedDepositProductsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Fixed Deposit Product", httpMethod = "POST", notes = "Creates a Fixed Deposit Product\n\n" + @Operation(summary = "Create a Fixed Deposit Product", description = "Creates a Fixed Deposit Product\n\n" + "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minDepositTerm, minDepositTermTypeId, accountingRule\n\n" + "Optional Fields: lockinPeriodFrequency, lockinPeriodFrequencyType, maxDepositTerm, maxDepositTermTypeId, inMultiplesOfDepositTerm, inMultiplesOfDepositTermTypeId, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, charts, , withHoldTax, taxGroupId\n\n" + "\n" + "Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createFixedDepositProduct().withJson(apiRequestBodyAsJson) .build(); @@ -170,13 +167,12 @@ public class FixedDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Fixed Deposit Product", httpMethod = "PUT", notes = "Updates a Fixed Deposit Product") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdRequest.class) }) + @Operation(summary = "Update a Fixed Deposit Product", description = "Updates a Fixed Deposit Product") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdResponse.class) }) - public String update(@PathParam("productId") @ApiParam(value = "productId") final Long productId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdResponse.class))) }) + public String update(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateFixedDepositProduct(productId) .withJson(apiRequestBodyAsJson).build(); @@ -190,10 +186,10 @@ public class FixedDepositProductsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Fixed Deposit Products", httpMethod = "GET", notes = "Lists Fixed Deposit Products\n\n" - + "Example Requests:\n" + "\n" + "fixeddepositproducts\n" + "\n" + "\n" + "fixeddepositproducts?fields=name") + @Operation(summary = "List Fixed Deposit Products", description = "Lists Fixed Deposit Products\n\n" + "Example Requests:\n" + "\n" + + "fixeddepositproducts\n" + "\n" + "\n" + "fixeddepositproducts?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -210,12 +206,13 @@ public class FixedDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Fixed Deposit Product", httpMethod = "GET", notes = "Retrieves a Fixed Deposit Product\n\n" - + "Example Requests:\n" + "\n" + "fixeddepositproducts/1\n" + "\n" + "\n" + "fixeddepositproducts/1?template=true\n" + "\n" - + "\n" + "fixeddepositproducts/1?fields=name,description") + @Operation(summary = "Retrieve a Fixed Deposit Product", description = "Retrieves a Fixed Deposit Product\n\n" + "Example Requests:\n" + + "\n" + "fixeddepositproducts/1\n" + "\n" + "\n" + "fixeddepositproducts/1?template=true\n" + "\n" + "\n" + + "fixeddepositproducts/1?fields=name,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsProductIdResponse.class) }) - public String retrieveOne(@PathParam("productId") @ApiParam(value = "productId") final Long productId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsProductIdResponse.class))) }) + public String retrieveOne(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -355,10 +352,10 @@ public class FixedDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Fixed Deposit Product", httpMethod = "DELETE", notes = "Deletes a Fixed Deposit Product") + @Operation(summary = "Delete a Fixed Deposit Product", description = "Deletes a Fixed Deposit Product") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = FixedDepositProductsApiResourceSwagger.DeleteFixedDepositProductsProductIdResponse.class) }) - public String delete(@PathParam("productId") @ApiParam(value = "productId") final Long productId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.DeleteFixedDepositProductsProductIdResponse.class))) }) + public String delete(@PathParam("productId") @Parameter(description = "productId") final Long productId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteFixedDepositProduct(productId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResourceSwagger.java index ce1daa7b8..9fe796d21 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class FixedDepositProductsApiResourceSwagger { private FixedDepositProductsApiResourceSwagger() {} - @ApiModel(value = "PostFixedDepositProductsRequest") + @Schema(description = "PostFixedDepositProductsRequest") public static final class PostFixedDepositProductsRequest { private PostFixedDepositProductsRequest() {} @@ -43,93 +42,93 @@ final class FixedDepositProductsApiResourceSwagger { private PostFixedDepositProductsChartSlabs() {} - @ApiModelProperty(example = "from 0 to 90 days") + @Schema(example = "from 0 to 90 days") public String description; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer periodType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fromPeriod; - @ApiModelProperty(example = "90") + @Schema(example = "90") public Integer toPeriod; - @ApiModelProperty(example = "4.5") + @Schema(example = "4.5") public Double annualInterestRate; } - @ApiModelProperty(example = "01 Jan 2014") + @Schema(example = "01 Jan 2014") public String fromDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; public Set chartSlabs; } - @ApiModelProperty(example = "Fixed deposit product") + @Schema(example = "Fixed deposit product") public String name; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String shortName; - @ApiModelProperty(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") + @Schema(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") public String description; - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer digitsAfterDecimal; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCompoundingPeriodType; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer interestPostingPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCalculationType; - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer interestCalculationDaysInYearType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountingRule; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "1.75") + @Schema(example = "1.75") public Double preClosurePenalInterest; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer preClosurePenalInterestOnTypeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTerm; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTermTypeId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer maxDepositTerm; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer maxDepositTermTypeId; public Set charts; } - @ApiModel(value = "PostFixedDepositProductsResponse") + @Schema(description = "PostFixedDepositProductsResponse") public static final class PostFixedDepositProductsResponse { private PostFixedDepositProductsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutFixedDepositProductsProductIdRequest") + @Schema(description = "PutFixedDepositProductsProductIdRequest") public static final class PutFixedDepositProductsProductIdRequest { private PutFixedDepositProductsProductIdRequest() {} - @ApiModelProperty(example = "Fixed deposit product new offerings") + @Schema(example = "Fixed deposit product new offerings") public String description; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer minDepositTerm; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTermTypeId; } - @ApiModel(value = "PutFixedDepositProductsProductIdResponse") + @Schema(description = "PutFixedDepositProductsProductIdResponse") public static final class PutFixedDepositProductsProductIdResponse { private PutFixedDepositProductsProductIdResponse() {} @@ -138,18 +137,18 @@ final class FixedDepositProductsApiResourceSwagger { private PutFixedDepositProductsChanges() {} - @ApiModelProperty(example = "Fixed deposit product new offerings") + @Schema(example = "Fixed deposit product new offerings") public String description; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer minDepositTerm; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutFixedDepositProductsChanges changes; } - @ApiModel(value = "GetFixedDepositProductsResponse") + @Schema(description = "GetFixedDepositProductsResponse") public static final class GetFixedDepositProductsResponse { private GetFixedDepositProductsResponse() {} @@ -158,19 +157,19 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -178,104 +177,104 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsMinDepositTermType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.months") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetFixedDepositProductsMaxDepositTermType { private GetFixedDepositProductsMaxDepositTermType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.years") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.years") public String code; - @ApiModelProperty(example = "Years") - public String value; + @Schema(example = "Years") + public String description; } static final class GetFixedDepositProductsInterestCompoundingPeriodType { private GetFixedDepositProductsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetFixedDepositProductsInterestPostingPeriodType { private GetFixedDepositProductsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetFixedDepositProductsInterestCalculationType { private GetFixedDepositProductsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetFixedDepositProductsInterestCalculationDaysInYearType { private GetFixedDepositProductsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetFixedDepositProductsAccountingRule { private GetFixedDepositProductsAccountingRule() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountingRuleType.none") + @Schema(example = "accountingRuleType.none") public String code; - @ApiModelProperty(example = "NONE") - public String value; + @Schema(example = "NONE") + public String description; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String name; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String shortName; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String description; public GetFixedDepositProductsCurrency currency; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer minDepositTerm; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer maxDepositTerm; public GetFixedDepositProductsMinDepositTermType minDepositTermType; public GetFixedDepositProductsMaxDepositTermType maxDepositTermType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double nominalAnnualInterestRate; public GetFixedDepositProductsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetFixedDepositProductsInterestPostingPeriodType interestPostingPeriodType; @@ -284,7 +283,7 @@ final class FixedDepositProductsApiResourceSwagger { public GetFixedDepositProductsAccountingRule accountingRule; } - @ApiModel(value = "GetFixedDepositProductsProductIdResponse") + @Schema(description = "GetFixedDepositProductsProductIdResponse") public static final class GetFixedDepositProductsProductIdResponse { private GetFixedDepositProductsProductIdResponse() {} @@ -293,17 +292,17 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -311,12 +310,12 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") public String code; - @ApiModelProperty(example = "Daily") - public String value; + @Schema(example = "Daily") + public String description; } static final class GetFixedDepositProductsProductIdAccountingMappings { @@ -327,11 +326,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdSavingsReferenceAccount() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "savings ref") + @Schema(example = "savings ref") public String name; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer glCode; } @@ -339,11 +338,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdIncomeFromFeeAccount() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "income from savings fee") + @Schema(example = "income from savings fee") public String name; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer glCode; } @@ -351,11 +350,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdIncomeFromPenaltyAccount() {} - @ApiModelProperty(example = "17") + @Schema(example = "17") public Integer id; - @ApiModelProperty(example = "income from sav penalties") + @Schema(example = "income from sav penalties") public String name; - @ApiModelProperty(example = "25") + @Schema(example = "25") public Integer glCode; } @@ -363,11 +362,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdInterestOnSavingsAccount() {} - @ApiModelProperty(example = "15") + @Schema(example = "15") public Integer id; - @ApiModelProperty(example = "interest on savings") + @Schema(example = "interest on savings") public String name; - @ApiModelProperty(example = "23") + @Schema(example = "23") public Integer glCode; } @@ -375,11 +374,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdSavingsControlAccount() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; - @ApiModelProperty(example = "savings ref tool kit") + @Schema(example = "savings ref tool kit") public String name; - @ApiModelProperty(example = "21") + @Schema(example = "21") public Integer glCode; } @@ -387,11 +386,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdTransfersInSuspenseAccount() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer id; - @ApiModelProperty(example = "saving transfers") + @Schema(example = "saving transfers") public String name; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Integer glCode; } @@ -411,13 +410,13 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdFeeToIncomeAccountMappingsCharge() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "sav charge") + @Schema(example = "sav charge") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } @@ -425,11 +424,11 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdFeeToIncomeAccountMappingsIncomeAccount() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "income from savings fee") + @Schema(example = "income from savings fee") public String name; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer glCode; } @@ -445,13 +444,13 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdPenaltyToIncomeAccountMappingsCharge() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "sav 2") + @Schema(example = "sav 2") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; } @@ -463,36 +462,36 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdPreClosurePenalInterestOnType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "preClosurePenalInterestOnType.wholeTerm") + @Schema(example = "preClosurePenalInterestOnType.wholeTerm") public String code; - @ApiModelProperty(example = "Whole term") - public String value; + @Schema(example = "Whole term") + public String description; } static final class GetFixedDepositProductsProductIdMinDepositTermType { private GetFixedDepositProductsProductIdMinDepositTermType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.weeks") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.weeks") public String code; - @ApiModelProperty(example = "Weeks") - public String value; + @Schema(example = "Weeks") + public String description; } static final class GetFixedDepositProductsProductIdMaxDepositTermType { private GetFixedDepositProductsProductIdMaxDepositTermType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.years") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.years") public String code; - @ApiModelProperty(example = "Years") - public String value; + @Schema(example = "Years") + public String description; } static final class GetFixedDepositProductsProductIdActiveChart { @@ -507,47 +506,47 @@ final class FixedDepositProductsApiResourceSwagger { private GetFixedDepositProductsProductIdPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.weeks") + @Schema(example = "interestChartPeriodType.weeks") public String code; - @ApiModelProperty(example = "Weeks") - public String value; + @Schema(example = "Weeks") + public String description; } - @ApiModelProperty(example = "18") + @Schema(example = "18") public Integer id; - @ApiModelProperty(example = "from 0 to 90 days") + @Schema(example = "from 0 to 90 days") public String description; public GetFixedDepositProductsProductIdPeriodType periodType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fromPeriod; - @ApiModelProperty(example = "90") + @Schema(example = "90") public Integer toPeriod; - @ApiModelProperty(example = "4.5") + @Schema(example = "4.5") public Double annualInterestRate; public GetFixedDepositProductsProductIdCurrency currency; } - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer id; - @ApiModelProperty(example = "[2014, 1, 1]") + @Schema(example = "[2014, 1, 1]") public LocalDate fromDate; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer savingsProductId; - @ApiModelProperty(example = "Fixed deposit product") + @Schema(example = "Fixed deposit product") public String savingsProductName; public Set chartSlabs; public Set periodTypes; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Fixed deposit product") + @Schema(example = "Fixed deposit product") public String name; - @ApiModelProperty(example = "FD01") + @Schema(example = "FD01") public String shortName; - @ApiModelProperty(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") + @Schema(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") public String description; public GetFixedDepositProductsProductIdCurrency currency; public GetFixedDepositProductsProductIdInterestCompoundingPeriodType interestCompoundingPeriodType; @@ -557,26 +556,26 @@ final class FixedDepositProductsApiResourceSwagger { public GetFixedDepositProductsProductIdAccountingMappings accountingMappings; public Set feeToIncomeAccountMappings; public Set penaltyToIncomeAccountMappings; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "1.75") + @Schema(example = "1.75") public Double preClosurePenalInterest; public GetFixedDepositProductsProductIdPreClosurePenalInterestOnType preClosurePenalInterestOnType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTerm; public GetFixedDepositProductsProductIdMinDepositTermType minDepositTermType; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer maxDepositTerm; public GetFixedDepositProductsProductIdMaxDepositTermType maxDepositTermType; public GetFixedDepositProductsProductIdActiveChart activeChart; } - @ApiModel(value = "DeleteFixedDepositProductsProductIdResponse") + @Schema(description = "DeleteFixedDepositProductsProductIdResponse") public static final class DeleteFixedDepositProductsProductIdResponse { private DeleteFixedDepositProductsProductIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java index 0c1cb2def..6d36fc509 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -65,9 +64,7 @@ import org.springframework.stereotype.Component; @Path("/recurringdepositaccounts/{recurringDepositAccountId}/transactions") @Component @Scope("singleton") -@Api(tags = { "Recurring Deposit Account Transactions" }) -@SwaggerDefinition(tags = { - @Tag(name = "Recurring Deposit Account Transactions", description = "Transactions possible on a recurring deposit account.") }) +@Tag(name = "Recurring Deposit Account Transactions", description = "Transactions possible on a recurring deposit account.") public class RecurringDepositAccountTransactionsApiResource { private final PlatformSecurityContext context; @@ -108,20 +105,20 @@ public class RecurringDepositAccountTransactionsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Recurring Deposit Account Transaction Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Recurring Deposit Account Transaction Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Requests:\n" + "\n" + "recurringdepositaccounts/1/transactions/template?command=deposit\n" + "\n" + "recurringdepositaccounts/1/transactions/template?command=withdrawal") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountTransactionsApiResourceSwagger.GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountTransactionsApiResourceSwagger.GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTemplateResponse.class))) }) public String retrieveTemplate( - @PathParam("recurringDepositAccountId") @ApiParam(value = "recurringDepositAccountId") final Long recurringDepositAccountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo) { + @PathParam("recurringDepositAccountId") @Parameter(description = "recurringDepositAccountId") final Long recurringDepositAccountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); /*** - * Check @Param commandParam value for deposit or withdrawal + * Check @Param commandParam description for deposit or withdrawal */ if (!(is(commandParam, "deposit") || is(commandParam, "withdrawal"))) { throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "deposit", "withdrawal" }); @@ -152,13 +149,14 @@ public class RecurringDepositAccountTransactionsApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Recurring Deposit Account Transaction", httpMethod = "GET", notes = "Retrieves Recurring Deposit Account Transaction\n\n" + @Operation(summary = "Retrieve Recurring Deposit Account Transaction", description = "Retrieves Recurring Deposit Account Transaction\n\n" + "Example Requests:\n" + "\n" + "recurringdepositaccounts/1/transactions/1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountTransactionsApiResourceSwagger.GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountTransactionsApiResourceSwagger.GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse.class))) }) public String retrieveOne( - @PathParam("recurringDepositAccountId") @ApiParam(value = "recurringDepositAccountId") final Long recurringDepositAccountId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + @PathParam("recurringDepositAccountId") @Parameter(description = "recurringDepositAccountId") final Long recurringDepositAccountId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); SavingsAccountTransactionData transactionData = this.savingsAccountReadPlatformService @@ -175,17 +173,16 @@ public class RecurringDepositAccountTransactionsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Deposit Transaction | Withdrawal Transaction", httpMethod = "POST", notes = "Deposit Transaction:\n\n" + @Operation(summary = "Deposit Transaction | Withdrawal Transaction", description = "Deposit Transaction:\n\n" + "Used for a deposit transaction\n\n" + "Withdrawal Transaction:\n\n" + "Used for a Withdrawal Transaction\n\n" + "Showing request/response for Deposit Transaction") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse.class))) }) public String transaction( - @PathParam("recurringDepositAccountId") @ApiParam(value = "recurringDepositAccountId") final Long recurringDepositAccountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @PathParam("recurringDepositAccountId") @Parameter(description = "recurringDepositAccountId") final Long recurringDepositAccountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -211,18 +208,17 @@ public class RecurringDepositAccountTransactionsApiResource { @Path("{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Adjust Transaction | Undo transaction", httpMethod = "POST", notes = "Adjust Transaction:\n\n" + @Operation(summary = "Adjust Transaction | Undo transaction", description = "Adjust Transaction:\n\n" + "This command modifies the given transaction.\n\n" + "Undo transaction:\n\n" + "This command reverses the given transaction.\n\n" + "Showing request/response for 'Adjust Transaction'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountTransactionsApiResourceSwagger.PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse.class))) }) public String handleTransactionCommands( - @PathParam("recurringDepositAccountId") @ApiParam(value = "recurringDepositAccountId") final Long recurringDepositAccountId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @PathParam("recurringDepositAccountId") @Parameter(description = "recurringDepositAccountId") final Long recurringDepositAccountId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String jsonApiRequest = apiRequestBodyAsJson; if (StringUtils.isBlank(jsonApiRequest)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResourceSwagger.java index f3ce1ee04..918986970 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.math.BigDecimal; import java.time.LocalDate; import java.util.List; @@ -31,7 +30,7 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private RecurringDepositAccountTransactionsApiResourceSwagger() {} - @ApiModel(value = "GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTemplateResponse") + @Schema(description = "GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTemplateResponse") public static final class GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTemplateResponse { private GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTemplateResponse() {} @@ -40,33 +39,33 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private GetRecurringTransactionType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsAccountTransactionType.deposit") + @Schema(example = "savingsAccountTransactionType.deposit") public String code; - @ApiModelProperty(example = "Deposit") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Deposit") + public String description; + @Schema(example = "true") public Boolean deposit; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawal; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean interestPosting; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean feeDeduction; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean initiateTransfer; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approveTransfer; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawTransfer; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejectTransfer; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overdraftInterest; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean writtenoff; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean overdraftFee; } @@ -74,41 +73,41 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private GetRecurringCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer decimalPlaces; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; public GetRecurringTransactionType transactionType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountId; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public String accountNo; - @ApiModelProperty(example = "[2014, 6, 25]") + @Schema(example = "[2014, 6, 25]") public LocalDate date; public GetRecurringCurrency currency; - @ApiModelProperty(example = "100000.000000") + @Schema(example = "100000.000000") public BigDecimal amount; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean reversed; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List paymentTypeOptions; } - @ApiModel(value = "GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse") + @Schema(description = "GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse") public static final class GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse { private GetRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse() {} @@ -117,19 +116,19 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private GetRecurringTransactionsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -137,19 +136,19 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private GetRecurringTransactionsTransactionType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "savingsAccountTransactionType.withdrawal") + @Schema(example = "savingsAccountTransactionType.withdrawal") public String code; - @ApiModelProperty(example = "Withdrawal") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Withdrawal") + public String description; + @Schema(example = "false") public Boolean deposit; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean withdrawal; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean interestPosting; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean feeDeduction; } @@ -161,74 +160,74 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private GetRecurringPaymentType() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "cash") + @Schema(example = "cash") public String name; } - @ApiModelProperty(example = "62") + @Schema(example = "62") public Integer id; public GetRecurringPaymentType paymentType; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer accountNumber; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer checkNumber; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer routingCode; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer receiptNumber; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer bankNumber; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; public GetRecurringTransactionsTransactionType transactionType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountId; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public String accountNo; - @ApiModelProperty(example = "[2013, 8, 7]") + @Schema(example = "[2013, 8, 7]") public LocalDate date; public GetRecurringTransactionsCurrency currency; public GetRecurringPaymentDetailData paymentDetailData; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer runningBalance; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean reversed; } - @ApiModel(value = "PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest") + @Schema(description = "PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest") public static final class PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest { private PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "27 May 2013") + @Schema(example = "27 May 2013") public String transactionDate; - @ApiModelProperty(example = "500") + @Schema(example = "500") public Double transactionAmount; - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer paymentTypeId; - @ApiModelProperty(example = "acc123") + @Schema(example = "acc123") public String accountNumber; - @ApiModelProperty(example = "che123") + @Schema(example = "che123") public String checkNumber; - @ApiModelProperty(example = "rou123") + @Schema(example = "rou123") public String routingCode; - @ApiModelProperty(example = "rec123") + @Schema(example = "rec123") public String receiptNumber; - @ApiModelProperty(example = "ban123") + @Schema(example = "ban123") public String bankNumber; } - @ApiModel(value = "PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse") + @Schema(description = "PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse") public static final class PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse { private PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse() {} @@ -237,41 +236,41 @@ final class RecurringDepositAccountTransactionsApiResourceSwagger { private PostRecurringChanges() {} - @ApiModelProperty(example = "acc123") + @Schema(example = "acc123") public String accountNumber; - @ApiModelProperty(example = "che123") + @Schema(example = "che123") public String checkNumber; - @ApiModelProperty(example = "rou123") + @Schema(example = "rou123") public String routingCode; - @ApiModelProperty(example = "rec123") + @Schema(example = "rec123") public String receiptNumber; - @ApiModelProperty(example = "ban123") + @Schema(example = "ban123") public String bankNumber; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "47") + @Schema(example = "47") public Integer resourceId; public PostRecurringChanges changes; } - @ApiModel(value = "PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse") + @Schema(description = "PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse") public static final class PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse { private PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsTransactionIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "48") + @Schema(example = "48") public Integer resourceId; public PostRecurringDepositAccountsRecurringDepositAccountIdTransactionsResponse.PostRecurringChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java index 6d0f06c06..6323c2404 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java @@ -21,15 +21,15 @@ package org.apache.fineract.portfolio.savings.api; import com.google.gson.JsonElement; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -85,9 +85,7 @@ import org.springframework.util.CollectionUtils; @Path("/recurringdepositaccounts") @Component @Scope("singleton") -@Api(tags = { "Recurring Deposit Account" }) -@SwaggerDefinition(tags = { - @Tag(name = "Recurring Deposit Account", description = "Recurring Deposit accounts are instances of a praticular recurring deposit product created. An application process around the creation of accounts is also supported.") }) +@Tag(name = "Recurring Deposit Account", description = "Recurring Deposit accounts are instances of a praticular recurring deposit product created. An application process around the creation of accounts is also supported.") public class RecurringDepositAccountsApiResource { private final DepositAccountReadPlatformService depositAccountReadPlatformService; @@ -126,15 +124,15 @@ public class RecurringDepositAccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve recurring Deposit Account Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for recurring deposit applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve recurring Deposit Account Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for recurring deposit applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n\n" + "Example Requests:\n" + "\n" + "recurringdepositaccounts/template?clientId=1\n" + "\n" + "\n" + "recurringdepositaccounts/template?clientId=1&productId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.GetRecurringDepositAccountsTemplateResponse.class) }) - public String template(@QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.GetRecurringDepositAccountsTemplateResponse.class))) }) + public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); @@ -150,15 +148,15 @@ public class RecurringDepositAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Recurring deposit applications/accounts", httpMethod = "GET", notes = "Lists Recurring deposit applications/accounts\n\n" + @Operation(summary = "List Recurring deposit applications/accounts", description = "Lists Recurring deposit applications/accounts\n\n" + "Example Requests:\n" + "\n" + "recurringdepositaccounts\n" + "\n" + "\n" + "recurringdepositaccounts?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.GetRecurringDepositAccountsResponse.class, responseContainer = "List") }) - public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @ApiParam(value = "paged") final Boolean paged, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.GetRecurringDepositAccountsResponse.class)))) }) + public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @Parameter(description = "paged") final Boolean paged, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); final PaginationParameters paginationParameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder); @@ -181,15 +179,14 @@ public class RecurringDepositAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Submit new recurring deposit application", httpMethod = "POST", notes = "Submits new recurring deposit application\n\n" + @Operation(summary = "Submit new recurring deposit application", description = "Submits new recurring deposit application\n\n" + "Mandatory Fields: clientId or groupId, productId, submittedOnDate, depositAmount, depositPeriod, depositPeriodFrequencyId\n\n" + "Optional Fields: accountNo, externalId, fieldOfficerId,linkAccountId(if provided initial deposit amount will be collected from this account),transferInterestToSavings(By enabling this flag all interest postings will be transferred to linked saving account )\n\n" + "Inherited from Product (if not provided): interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, lockinPeriodFrequency, lockinPeriodFrequencyType, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, charts, withHoldTax") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsResponse.class) }) - public String submitApplication(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsResponse.class))) }) + public String submitApplication(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createRecurringDepositAccount().withJson(apiRequestBodyAsJson) .build(); @@ -203,13 +200,13 @@ public class RecurringDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a recurring deposit application/account", httpMethod = "GET", notes = "Retrieves a recurring deposit application/account\n\n" + @Operation(summary = "Retrieve a recurring deposit application/account", description = "Retrieves a recurring deposit application/account\n\n" + "Example Requests :\n" + "\n" + "recurringdepositaccounts/1\n" + "\n" + "\n" + "recurringdepositaccounts/1?associations=all") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.GetRecurringDepositAccountsAccountIdResponse.class) }) - public String retrieveOne(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @DefaultValue("all") @QueryParam("chargeStatus") @ApiParam(value = "chargeStatus") final String chargeStatus, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.GetRecurringDepositAccountsAccountIdResponse.class))) }) + public String retrieveOne(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); @@ -280,13 +277,12 @@ public class RecurringDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Modify a recurring deposit application", httpMethod = "PUT", notes = "Recurring deposit application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositAccountsApiResourceSwagger.PutRecurringDepositAccountsAccountIdRequest.class) }) + @Operation(summary = "Modify a recurring deposit application", description = "Recurring deposit application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.PutRecurringDepositAccountsAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.PutRecurringDepositAccountsAccountIdResponse.class) }) - public String update(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.PutRecurringDepositAccountsAccountIdResponse.class))) }) + public String update(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateRecurringDepositAccount(accountId) .withJson(apiRequestBodyAsJson).build(); @@ -300,7 +296,7 @@ public class RecurringDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve recurring deposit application | Undo approval recurring deposit application | Reject recurring deposit application | Withdraw recurring deposit application | Activate a recurring deposit account | Update the recommended deposit amount for a recurring deposit account | Close a recurring deposit account | Premature Close a recurring deposit account | Calculate Premature amount on Recurring deposit account | Calculate Interest on recurring Deposit Account | Post Interest on recurring Deposit Account", httpMethod = "POST", notes = "Approve recurring deposit application:\n\n" + @Operation(summary = "Approve recurring deposit application | Undo approval recurring deposit application | Reject recurring deposit application | Withdraw recurring deposit application | Activate a recurring deposit account | Update the recommended deposit amount for a recurring deposit account | Close a recurring deposit account | Premature Close a recurring deposit account | Calculate Premature amount on Recurring deposit account | Calculate Interest on recurring Deposit Account | Post Interest on recurring Deposit Account", description = "Approve recurring deposit application:\n\n" + "Approves recurring deposit application so long as its in 'Submitted and pending approval' state.\n\n" + "Undo approval recurring deposit application:\n\n" + "Will move 'approved' recurring deposit application back to 'Submitted and pending approval' state.\n\n" @@ -324,13 +320,12 @@ public class RecurringDepositAccountsApiResource { + "Post Interest on recurring Deposit Account:\n\n" + "Calculates and Posts interest earned on a recurring deposit account based on todays date and whether an interest posting or crediting event is due.\n\n" + "Showing request/response for 'Post Interest on recurring Deposit Account'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsAccountIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsAccountIdResponse.class) }) - public String handleCommands(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.PostRecurringDepositAccountsAccountIdResponse.class))) }) + public String handleCommands(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String jsonApiRequest = apiRequestBodyAsJson; if (StringUtils.isBlank(jsonApiRequest)) { @@ -398,10 +393,10 @@ public class RecurringDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a recurring deposit application", httpMethod = "DELETE", notes = "At present we support hard delete of recurring deposit application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the recurring deposit account.") + @Operation(summary = "Delete a recurring deposit application", description = "At present we support hard delete of recurring deposit application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the recurring deposit account.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositAccountsApiResourceSwagger.DeleteRecurringDepositAccountsResponse.class) }) - public String delete(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositAccountsApiResourceSwagger.DeleteRecurringDepositAccountsResponse.class))) }) + public String delete(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteRecurringDepositAccount(accountId).build(); @@ -414,8 +409,8 @@ public class RecurringDepositAccountsApiResource { @Path("{accountId}/template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String accountClosureTemplate(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo) { + public String accountClosureTemplate(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); DepositAccountData account = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResourceSwagger.java index eff026f4f..35e9e85db 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class RecurringDepositAccountsApiResourceSwagger { private RecurringDepositAccountsApiResourceSwagger() {} - @ApiModel(value = "GetRecurringDepositAccountsTemplateResponse") + @Schema(description = "GetRecurringDepositAccountsTemplateResponse") public static final class GetRecurringDepositAccountsTemplateResponse { private GetRecurringDepositAccountsTemplateResponse() {} @@ -39,20 +38,20 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringProductOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "small business") + @Schema(example = "small business") public String clientName; public Set productOptions; } - @ApiModel(value = "GetRecurringDepositAccountsResponse") + @Schema(description = "GetRecurringDepositAccountsResponse") public static final class GetRecurringDepositAccountsResponse { private GetRecurringDepositAccountsResponse() {} @@ -61,29 +60,29 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean prematureClosed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean transferInProgress; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean transferOnHold; } @@ -91,13 +90,13 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsTimeline() {} - @ApiModelProperty(example = "[2014, 3, 1]") + @Schema(example = "[2014, 3, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; } @@ -105,19 +104,19 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -125,48 +124,48 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetRecurringDepositAccountsInterestPostingPeriodType { private GetRecurringDepositAccountsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetRecurringDepositAccountsInterestCalculationType { private GetRecurringDepositAccountsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetRecurringDepositAccountsInterestCalculationDaysInYearType { private GetRecurringDepositAccountsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetRecurringDepositAccountsSummary { @@ -174,7 +173,7 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsSummary() {} public GetRecurringDepositAccountsCurrency currency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float accountBalance; } @@ -182,63 +181,63 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsMinDepositTermType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.months") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetRecurringDepositAccountsMaxDepositTermType { private GetRecurringDepositAccountsMaxDepositTermType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.years") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.years") public String code; - @ApiModelProperty(example = "Years") - public String value; + @Schema(example = "Years") + public String description; } static final class GetRecurringDepositAccountsDepositPeriodFrequency { private GetRecurringDepositAccountsDepositPeriodFrequency() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "deposit.period.savingsPeriodFrequencyType.months") + @Schema(example = "deposit.period.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetRecurringDepositAccountsRecurringDepositFrequencyType { private GetRecurringDepositAccountsRecurringDepositFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "recurring.deposit.savingsPeriodFrequencyType.months") + @Schema(example = "recurring.deposit.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Sangamesh N") + @Schema(example = "Sangamesh N") public String clientName; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer savingsProductId; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetRecurringDepositAccountsStatus status; public GetRecurringDepositAccountsTimeline timeline; @@ -248,77 +247,77 @@ final class RecurringDepositAccountsApiResourceSwagger { public GetRecurringDepositAccountsInterestCalculationType interestCalculationType; public GetRecurringDepositAccountsInterestCalculationDaysInYearType interestCalculationDaysInYearType; public GetRecurringDepositAccountsSummary summary; - @ApiModelProperty(example = "1150") + @Schema(example = "1150") public Float depositAmount; - @ApiModelProperty(example = "252.59") + @Schema(example = "252.59") public Float maturityAmount; - @ApiModelProperty(example = "[2014, 4, 3]") + @Schema(example = "[2014, 4, 3]") public LocalDate maturityDate; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer recurringDepositAmount; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurringDepositFrequency; public GetRecurringDepositAccountsRecurringDepositFrequencyType recurringDepositFrequencyType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer minDepositTerm; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer maxDepositTerm; public GetRecurringDepositAccountsMinDepositTermType minDepositTermType; public GetRecurringDepositAccountsMaxDepositTermType maxDepositTermType; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer depositPeriod; public GetRecurringDepositAccountsDepositPeriodFrequency depositPeriodFrequency; } - @ApiModel(value = "PostRecurringDepositAccountsRequest") + @Schema(description = "PostRecurringDepositAccountsRequest") public static final class PostRecurringDepositAccountsRequest { private PostRecurringDepositAccountsRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "02 June 2014") + @Schema(example = "02 June 2014") public String submittedOnDate; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer depositPeriod; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer depositPeriodFrequencyId; - @ApiModelProperty(example = "10000") + @Schema(example = "10000") public Float depositAmount; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isCalendarInherited; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer recurringFrequency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurringFrequencyType; - @ApiModelProperty(example = "2000") + @Schema(example = "2000") public Long mandatoryRecommendedDepositAmount; } - @ApiModel(value = "PostRecurringDepositAccountsResponse") + @Schema(description = "PostRecurringDepositAccountsResponse") public static final class PostRecurringDepositAccountsResponse { private PostRecurringDepositAccountsResponse() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetRecurringDepositAccountsAccountIdResponse") + @Schema(description = "GetRecurringDepositAccountsAccountIdResponse") public static final class GetRecurringDepositAccountsAccountIdResponse { private GetRecurringDepositAccountsAccountIdResponse() {} @@ -335,40 +334,40 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsPeriodType() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.days") + @Schema(example = "interestChartPeriodType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetRecurringDepositAccountsAccountChartCurrency { private GetRecurringDepositAccountsAccountChartCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; public GetRecurringDepositAccountsPeriodType periodType; - @ApiModelProperty(example = "181") + @Schema(example = "181") public Integer fromPeriod; - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer toPeriod; - @ApiModelProperty(example = "5.5") + @Schema(example = "5.5") public Double annualInterestRate; public GetRecurringDepositAccountsAccountChartCurrency currency; } @@ -377,41 +376,41 @@ final class RecurringDepositAccountsApiResourceSwagger { private GetRecurringDepositAccountsPeriodTypes() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.days") + @Schema(example = "interestChartPeriodType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "[2013, 10, 2]") + @Schema(example = "[2013, 10, 2]") public LocalDate fromDate; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer accountId; - @ApiModelProperty(example = "RD000023") + @Schema(example = "RD000023") public Long accountNumber; public Set chartSlabs; public Set periodTypes; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "RD000023") + @Schema(example = "RD000023") public Long accountNo; - @ApiModelProperty(example = "RD-23") + @Schema(example = "RD-23") public String externalId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Sangamesh N") + @Schema(example = "Sangamesh N") public String clientName; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer savingsProductId; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsStatus status; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsTimeline timeline; @@ -420,40 +419,40 @@ final class RecurringDepositAccountsApiResourceSwagger { public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsInterestPostingPeriodType interestPostingPeriodType; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsInterestCalculationType interestCalculationType; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsInterestCalculationDaysInYearType interestCalculationDaysInYearType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer minDepositTerm; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer maxDepositTerm; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsMinDepositTermType minDepositTermType; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsMaxDepositTermType maxDepositTermType; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer recurringDepositAmount; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurringDepositFrequency; - @ApiModelProperty(example = "[2014, 4, 2]") + @Schema(example = "[2014, 4, 2]") public LocalDate expectedFirstDepositOnDate; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsRecurringDepositFrequencyType recurringDepositFrequencyType; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer depositPeriod; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsDepositPeriodFrequency depositPeriodFrequency; public GetRecurringDepositAccountsResponse.GetRecurringDepositAccountsSummary summary; public GetRecurringDepositAccountsAccountChart accountChart; } - @ApiModel(value = "PutRecurringDepositAccountsAccountIdRequest") + @Schema(description = "PutRecurringDepositAccountsAccountIdRequest") public static final class PutRecurringDepositAccountsAccountIdRequest { private PutRecurringDepositAccountsAccountIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "6000") + @Schema(example = "6000") public Integer depositAmount; } - @ApiModel(value = "PutRecurringDepositAccountsAccountIdResponse") + @Schema(description = "PutRecurringDepositAccountsAccountIdResponse") public static final class PutRecurringDepositAccountsAccountIdResponse { private PutRecurringDepositAccountsAccountIdResponse() {} @@ -462,54 +461,54 @@ final class RecurringDepositAccountsApiResourceSwagger { private PutRecurringDepositAccountsChanges() {} - @ApiModelProperty(example = "6000") + @Schema(example = "6000") public Integer depositAmount; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutRecurringDepositAccountsChanges changes; } - @ApiModel(value = "PostRecurringDepositAccountsAccountIdRequest") + @Schema(description = "PostRecurringDepositAccountsAccountIdRequest") public static final class PostRecurringDepositAccountsAccountIdRequest { private PostRecurringDepositAccountsAccountIdRequest() {} } - @ApiModel(value = "PostRecurringDepositAccountsAccountIdResponse") + @Schema(description = "PostRecurringDepositAccountsAccountIdResponse") public static final class PostRecurringDepositAccountsAccountIdResponse { private PostRecurringDepositAccountsAccountIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "DeleteRecurringDepositAccountsResponse") + @Schema(description = "DeleteRecurringDepositAccountsResponse") public static final class DeleteRecurringDepositAccountsResponse { private DeleteRecurringDepositAccountsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java index 2c14c877a..6bbadf767 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -88,13 +88,11 @@ import org.springframework.util.CollectionUtils; @Path("/recurringdepositproducts") @Component @Scope("singleton") -@Api(tags = { "Recurring Deposit Product" }) -@SwaggerDefinition(tags = { - @Tag(name = "Recurring Deposit Product", description = "Recurring Deposits are a special kind of Term Deposits offered by MFI's. The Recurring Deposit Products (aka RD) product offerings are modeled using this API.\n" - + "\n" - + "Recurring Deposits help people with regular incomes to deposit a fixed amount every month (specified recurring frequency) into their Recurring Deposit account.\n" - + "\n" - + "When creating recurring deposit accounts, the details from the recurring deposit product are used to auto fill details of the recurring deposit account application process.") }) +@Tag(name = "Recurring Deposit Product", description = "Recurring Deposits are a special kind of Term Deposits offered by MFI's. The Recurring Deposit Products (aka RD) product offerings are modeled using this API.\n" + + "\n" + + "Recurring Deposits help people with regular incomes to deposit a fixed amount every month (specified recurring frequency) into their Recurring Deposit account.\n" + + "\n" + + "When creating recurring deposit accounts, the details from the recurring deposit product are used to auto fill details of the recurring deposit account application process.") public class RecurringDepositProductsApiResource { private final DepositProductReadPlatformService depositProductReadPlatformService; @@ -149,15 +147,14 @@ public class RecurringDepositProductsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Recurring Deposit Product", httpMethod = "POST", notes = "Creates a Recurring Deposit Product\n\n" + @Operation(summary = "Create a Recurring Deposit Product", description = "Creates a Recurring Deposit Product\n\n" + "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minDepositTerm, minDepositTermTypeId, recurringDepositFrequency, recurringDepositFrequencyTypeId, accountingRule, depositAmount\n\n" + "Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId\n\n" + "Optional Fields: lockinPeriodFrequency, lockinPeriodFrequencyType, maxDepositTerm, maxDepositTermTypeId, inMultiplesOfDepositTerm, inMultiplesOfDepositTermTypeId, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, charts, minDepositAmount, maxDepositAmount, withHoldTax, taxGroupId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositProductsApiResourceSwagger.PostRecurringDepositProductsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.PostRecurringDepositProductsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositProductsApiResourceSwagger.PostRecurringDepositProductsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.PostRecurringDepositProductsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createRecurringDepositProduct().withJson(apiRequestBodyAsJson) .build(); @@ -171,13 +168,12 @@ public class RecurringDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Recurring Deposit Product", httpMethod = "PUT", notes = "Updates a Recurring Deposit Product") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RecurringDepositProductsApiResourceSwagger.PutRecurringDepositProductsRequest.class) }) + @Operation(summary = "Update a Recurring Deposit Product", description = "Updates a Recurring Deposit Product") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.PutRecurringDepositProductsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositProductsApiResourceSwagger.PutRecurringDepositProductsResponse.class) }) - public String update(@PathParam("productId") @ApiParam(value = "productId") final Long productId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.PutRecurringDepositProductsResponse.class))) }) + public String update(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateRecurringDepositProduct(productId) .withJson(apiRequestBodyAsJson).build(); @@ -191,10 +187,10 @@ public class RecurringDepositProductsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Recuring Deposit Products", httpMethod = "GET", notes = "Lists Recuring Deposit Products\n\n" - + "Example Requests:\n" + "\n" + "recurringdepositproducts\n" + "\n" + "\n" + "recurringdepositproducts?fields=name") + @Operation(summary = "List Recuring Deposit Products", description = "Lists Recuring Deposit Products\n\n" + "Example Requests:\n" + + "\n" + "recurringdepositproducts\n" + "\n" + "\n" + "recurringdepositproducts?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = RecurringDepositProductsApiResourceSwagger.GetRecurringDepositProductsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.GetRecurringDepositProductsResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -212,12 +208,13 @@ public class RecurringDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Recurring Deposit Product", httpMethod = "GET", notes = "Retrieves a Recurring Deposit Product\n\n" + @Operation(summary = "Retrieve a Recurring Deposit Product", description = "Retrieves a Recurring Deposit Product\n\n" + "Example Requests:\n" + "\n" + "recurringdepositproducts/1\n" + "\n" + "\n" + "recurringdepositproducts/1?template=true\n" + "\n" + "\n" + "recurringdepositproducts/1?fields=name,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositProductsApiResourceSwagger.GetRecurringDepositProductsProductIdResponse.class) }) - public String retrieveOne(@PathParam("productId") @ApiParam(value = "productId") final Long productId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.GetRecurringDepositProductsProductIdResponse.class))) }) + public String retrieveOne(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -353,10 +350,10 @@ public class RecurringDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Recurring Deposit Product", httpMethod = "DELETE", notes = "Deletes a Recurring Deposit Product") + @Operation(summary = "Delete a Recurring Deposit Product", description = "Deletes a Recurring Deposit Product") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = RecurringDepositProductsApiResourceSwagger.DeleteRecurringDepositProductsProductIdResponse.class) }) - public String delete(@PathParam("productId") @ApiParam(value = "productId") final Long productId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = RecurringDepositProductsApiResourceSwagger.DeleteRecurringDepositProductsProductIdResponse.class))) }) + public String delete(@PathParam("productId") @Parameter(description = "productId") final Long productId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteRecurringDepositProduct(productId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResourceSwagger.java index 4b9bcbe6c..8a1a59326 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class RecurringDepositProductsApiResourceSwagger { private RecurringDepositProductsApiResourceSwagger() {} - @ApiModel(value = "PostRecurringDepositProductsRequest") + @Schema(description = "PostRecurringDepositProductsRequest") public static final class PostRecurringDepositProductsRequest { private PostRecurringDepositProductsRequest() {} @@ -43,103 +42,103 @@ final class RecurringDepositProductsApiResourceSwagger { private PostRecurringDepositProductsChartSlabs() {} - @ApiModelProperty(example = "from 0 to 90 days") + @Schema(example = "from 0 to 90 days") public String description; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer periodType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fromPeriod; - @ApiModelProperty(example = "90") + @Schema(example = "90") public Integer toPeriod; - @ApiModelProperty(example = "4.5") + @Schema(example = "4.5") public Double annualInterestRate; } - @ApiModelProperty(example = "01 Jan 2014") + @Schema(example = "01 Jan 2014") public String fromDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; public Set chartSlabs; } - @ApiModelProperty(example = "Recurring deposit product") + @Schema(example = "Recurring deposit product") public String name; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String shortName; - @ApiModelProperty(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") + @Schema(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") public String description; - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer digitsAfterDecimal; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCompoundingPeriodType; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer interestPostingPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCalculationType; - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer interestCalculationDaysInYearType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountingRule; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurringDepositFrequency; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer recurringDepositFrequencyTypeId; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "1.75") + @Schema(example = "1.75") public Double preClosurePenalInterest; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer preClosurePenalInterestOnTypeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTerm; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTermTypeId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer maxDepositTerm; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer maxDepositTermTypeId; - @ApiModelProperty(example = "10000") + @Schema(example = "10000") public Long depositAmount; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Long minDepositAmount; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long maxDepositAmount; public Set charts; } - @ApiModel(value = "PostRecurringDepositProductsResponse") + @Schema(description = "PostRecurringDepositProductsResponse") public static final class PostRecurringDepositProductsResponse { private PostRecurringDepositProductsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutRecurringDepositProductsRequest") + @Schema(description = "PutRecurringDepositProductsRequest") public static final class PutRecurringDepositProductsRequest { private PutRecurringDepositProductsRequest() {} - @ApiModelProperty(example = "Recurring deposit product new offerings") + @Schema(example = "Recurring deposit product new offerings") public String description; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer minDepositTerm; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTermTypeId; } - @ApiModel(value = "PutRecurringDepositProductsResponse") + @Schema(description = "PutRecurringDepositProductsResponse") public static final class PutRecurringDepositProductsResponse { private PutRecurringDepositProductsResponse() {} @@ -148,18 +147,18 @@ final class RecurringDepositProductsApiResourceSwagger { private PutRecurringDepositProductsChanges() {} - @ApiModelProperty(example = "Recurring deposit product new offerings") + @Schema(example = "Recurring deposit product new offerings") public String description; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer minDepositTerm; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutRecurringDepositProductsChanges changes; } - @ApiModel(value = "GetRecurringDepositProductsResponse") + @Schema(description = "GetRecurringDepositProductsResponse") public static final class GetRecurringDepositProductsResponse { private GetRecurringDepositProductsResponse() {} @@ -168,19 +167,19 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -188,119 +187,119 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsMinDepositTermType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.months") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetRecurringDepositProductsMaxDepositTermType { private GetRecurringDepositProductsMaxDepositTermType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.years") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.years") public String code; - @ApiModelProperty(example = "Years") - public String value; + @Schema(example = "Years") + public String description; } static final class GetRecurringDepositProductsInterestCompoundingPeriodType { private GetRecurringDepositProductsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetRecurringDepositProductsInterestPostingPeriodType { private GetRecurringDepositProductsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetRecurringDepositProductsInterestCalculationType { private GetRecurringDepositProductsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetRecurringDepositProductsInterestCalculationDaysInYearType { private GetRecurringDepositProductsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetRecurringDepositProductsAccountingRule { private GetRecurringDepositProductsAccountingRule() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountingRuleType.none") + @Schema(example = "accountingRuleType.none") public String code; - @ApiModelProperty(example = "NONE") - public String value; + @Schema(example = "NONE") + public String description; } static final class GetRecurringDepositProductsRecurringDepositFrequencyType { private GetRecurringDepositProductsRecurringDepositFrequencyType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "recurring.deposit.savingsPeriodFrequencyType.months") + @Schema(example = "recurring.deposit.savingsPeriodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String name; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String shortName; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String description; public GetRecurringDepositProductsCurrency currency; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurringDepositFrequency; public GetRecurringDepositProductsRecurringDepositFrequencyType recurringDepositFrequencyType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer minDepositTerm; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer maxDepositTerm; public GetRecurringDepositProductsMinDepositTermType minDepositTermType; public GetRecurringDepositProductsMaxDepositTermType maxDepositTermType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double nominalAnnualInterestRate; public GetRecurringDepositProductsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetRecurringDepositProductsInterestPostingPeriodType interestPostingPeriodType; @@ -309,7 +308,7 @@ final class RecurringDepositProductsApiResourceSwagger { public GetRecurringDepositProductsAccountingRule accountingRule; } - @ApiModel(value = "GetRecurringDepositProductsProductIdResponse") + @Schema(description = "GetRecurringDepositProductsProductIdResponse") public static final class GetRecurringDepositProductsProductIdResponse { private GetRecurringDepositProductsProductIdResponse() {} @@ -318,17 +317,17 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -336,12 +335,12 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") public String code; - @ApiModelProperty(example = "Daily") - public String value; + @Schema(example = "Daily") + public String description; } static final class GetRecurringDepositProductsProductIdAccountingMappings { @@ -352,11 +351,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdSavingsReferenceAccount() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "savings ref") + @Schema(example = "savings ref") public String name; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer glCode; } @@ -364,11 +363,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdIncomeFromFeeAccount() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "income from savings fee") + @Schema(example = "income from savings fee") public String name; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer glCode; } @@ -376,11 +375,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdIncomeFromPenaltyAccount() {} - @ApiModelProperty(example = "17") + @Schema(example = "17") public Integer id; - @ApiModelProperty(example = "income from sav penalties") + @Schema(example = "income from sav penalties") public String name; - @ApiModelProperty(example = "25") + @Schema(example = "25") public Integer glCode; } @@ -388,11 +387,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdInterestOnSavingsAccount() {} - @ApiModelProperty(example = "15") + @Schema(example = "15") public Integer id; - @ApiModelProperty(example = "interest on savings") + @Schema(example = "interest on savings") public String name; - @ApiModelProperty(example = "23") + @Schema(example = "23") public Integer glCode; } @@ -400,11 +399,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdSavingsControlAccount() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; - @ApiModelProperty(example = "savings ref tool kit") + @Schema(example = "savings ref tool kit") public String name; - @ApiModelProperty(example = "21") + @Schema(example = "21") public Integer glCode; } @@ -412,11 +411,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdTransfersInSuspenseAccount() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer id; - @ApiModelProperty(example = "saving transfers") + @Schema(example = "saving transfers") public String name; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Integer glCode; } @@ -436,13 +435,13 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdFeeToIncomeAccountMappingsCharge() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "sav charge") + @Schema(example = "sav charge") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } @@ -450,11 +449,11 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdFeeToIncomeAccountMappingsIncomeAccount() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "income from savings fee") + @Schema(example = "income from savings fee") public String name; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer glCode; } @@ -470,13 +469,13 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdPenaltyToIncomeAccountMappingsCharge() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "sav 2") + @Schema(example = "sav 2") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; } @@ -488,36 +487,36 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdPreClosurePenalInterestOnType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "preClosurePenalInterestOnType.wholeTerm") + @Schema(example = "preClosurePenalInterestOnType.wholeTerm") public String code; - @ApiModelProperty(example = "Whole term") - public String value; + @Schema(example = "Whole term") + public String description; } static final class GetRecurringDepositProductsProductIdMinDepositTermType { private GetRecurringDepositProductsProductIdMinDepositTermType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.weeks") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.weeks") public String code; - @ApiModelProperty(example = "Weeks") - public String value; + @Schema(example = "Weeks") + public String description; } static final class GetRecurringDepositProductsProductIdMaxDepositTermType { private GetRecurringDepositProductsProductIdMaxDepositTermType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "deposit.term.savingsPeriodFrequencyType.years") + @Schema(example = "deposit.term.savingsPeriodFrequencyType.years") public String code; - @ApiModelProperty(example = "Years") - public String value; + @Schema(example = "Years") + public String description; } static final class GetRecurringDepositProductsProductIdActiveChart { @@ -532,47 +531,47 @@ final class RecurringDepositProductsApiResourceSwagger { private GetRecurringDepositProductsProductIdPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestChartPeriodType.weeks") + @Schema(example = "interestChartPeriodType.weeks") public String code; - @ApiModelProperty(example = "Weeks") - public String value; + @Schema(example = "Weeks") + public String description; } - @ApiModelProperty(example = "18") + @Schema(example = "18") public Integer id; - @ApiModelProperty(example = "from 0 to 90 days") + @Schema(example = "from 0 to 90 days") public String description; public GetRecurringDepositProductsProductIdPeriodType periodType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fromPeriod; - @ApiModelProperty(example = "90") + @Schema(example = "90") public Integer toPeriod; - @ApiModelProperty(example = "4.5") + @Schema(example = "4.5") public Double annualInterestRate; public GetRecurringDepositProductsProductIdCurrency currency; } - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer id; - @ApiModelProperty(example = "[2014, 1, 1]") + @Schema(example = "[2014, 1, 1]") public LocalDate fromDate; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer savingsProductId; - @ApiModelProperty(example = "Recurring deposit product") + @Schema(example = "Recurring deposit product") public String savingsProductName; public Set chartSlabs; public Set periodTypes; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Recurring deposit product") + @Schema(example = "Recurring deposit product") public String name; - @ApiModelProperty(example = "RD01") + @Schema(example = "RD01") public String shortName; - @ApiModelProperty(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") + @Schema(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") public String description; public GetRecurringDepositProductsProductIdCurrency currency; public GetRecurringDepositProductsProductIdInterestCompoundingPeriodType interestCompoundingPeriodType; @@ -582,29 +581,29 @@ final class RecurringDepositProductsApiResourceSwagger { public GetRecurringDepositProductsProductIdAccountingMappings accountingMappings; public Set feeToIncomeAccountMappings; public Set penaltyToIncomeAccountMappings; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer recurringDepositFrequency; public GetRecurringDepositProductsResponse.GetRecurringDepositProductsRecurringDepositFrequencyType recurringDepositFrequencyType; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean preClosurePenalApplicable; - @ApiModelProperty(example = "1.75") + @Schema(example = "1.75") public Double preClosurePenalInterest; public GetRecurringDepositProductsProductIdPreClosurePenalInterestOnType preClosurePenalInterestOnType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer minDepositTerm; public GetRecurringDepositProductsProductIdMinDepositTermType minDepositTermType; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer maxDepositTerm; public GetRecurringDepositProductsProductIdMaxDepositTermType maxDepositTermType; public GetRecurringDepositProductsProductIdActiveChart activeChart; } - @ApiModel(value = "DeleteRecurringDepositProductsProductIdResponse") + @Schema(description = "DeleteRecurringDepositProductsProductIdResponse") public static final class DeleteRecurringDepositProductsProductIdResponse { private DeleteRecurringDepositProductsProductIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java index 77bb155a2..500dbe74c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java @@ -23,15 +23,15 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_WAIVE_CHARGE; import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -67,11 +67,9 @@ import org.springframework.stereotype.Component; @Path("/savingsaccounts/{savingsAccountId}/charges") @Component @Scope("singleton") -@Api(tags = { "Savings Charges" }) -@SwaggerDefinition(tags = { - @Tag(name = "Savings Charges", description = "Its typical for MFIs to add maintenance and operating charges. They can be either Fees or Penalties.\n" - + "\n" - + "Savings Charges are instances of Charges and represent either fees and penalties for savings products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Savings account) are described here") }) +@Tag(name = "Savings Charges", description = "Its typical for MFIs to add maintenance and operating charges. They can be either Fees or Penalties.\n" + + "\n" + + "Savings Charges are instances of Charges and represent either fees and penalties for savings products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Savings account) are described here") public class SavingsAccountChargesApiResource { private final PlatformSecurityContext context; @@ -103,15 +101,15 @@ public class SavingsAccountChargesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Savings Charges", httpMethod = "GET", notes = "Lists Savings Charges\n\n" + "Example Requests:\n" + "\n" + @Operation(summary = "List Savings Charges", description = "Lists Savings Charges\n\n" + "Example Requests:\n" + "\n" + "savingsaccounts/1/charges\n" + "\n" + "savingsaccounts/1/charges?chargeStatus=all\n" + "\n" + "savingsaccounts/1/charges?chargeStatus=inactive\n" + "\n" + "savingsaccounts/1/charges?chargeStatus=active\n" + "\n" + "savingsaccounts/1/charges?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = SavingsAccountChargesApiResourceSwagger.GetSavingsAccountsSavingsAccountIdChargesResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.GetSavingsAccountsSavingsAccountIdChargesResponse.class)))) }) public String retrieveAllSavingsAccountCharges( - @PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, - @DefaultValue("all") @QueryParam("chargeStatus") @ApiParam(value = "chargeStatus") final String chargeStatus, + @PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, + @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME); @@ -132,11 +130,12 @@ public class SavingsAccountChargesApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Savings Charges Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "savingsaccounts/1/charges/template") + @Operation(summary = "Retrieve Savings Charges Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + + "savingsaccounts/1/charges/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountChargesApiResourceSwagger.GetSavingsAccountsSavingsAccountIdChargesTemplateResponse.class) }) - public String retrieveTemplate(@PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.GetSavingsAccountsSavingsAccountIdChargesTemplateResponse.class))) }) + public String retrieveTemplate(@PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME); @@ -154,14 +153,13 @@ public class SavingsAccountChargesApiResource { @Path("{savingsAccountChargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Savings account Charge", httpMethod = "GET", notes = "Retrieves a Savings account Charge\n\n" - + "Example Requests:\n" + "\n" + "/savingsaccounts/1/charges/5\n" + "\n" + "\n" - + "/savingsaccounts/1/charges/5?fields=name,amountOrPercentage") + @Operation(summary = "Retrieve a Savings account Charge", description = "Retrieves a Savings account Charge\n\n" + "Example Requests:\n" + + "\n" + "/savingsaccounts/1/charges/5\n" + "\n" + "\n" + "/savingsaccounts/1/charges/5?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountChargesApiResourceSwagger.GetSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.GetSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class))) }) public String retrieveSavingsAccountCharge( - @PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, - @PathParam("savingsAccountChargeId") @ApiParam(value = "savingsAccountChargeId") final Long savingsAccountChargeId, + @PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, + @PathParam("savingsAccountChargeId") @Parameter(description = "savingsAccountChargeId") final Long savingsAccountChargeId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME); @@ -177,15 +175,15 @@ public class SavingsAccountChargesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Savings account Charge", httpMethod = "POST", notes = "Creates a Savings account Charge\n\n" + @Operation(summary = "Create a Savings account Charge", description = "Creates a Savings account Charge\n\n" + "Mandatory Fields for Savings account Charges: chargeId, amount\n\n" + "chargeId, amount, dueDate, dateFormat, locale\n\n" + "chargeId, amount, feeOnMonthDay, monthDayFormat, locale") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesResponse.class) }) - public String addSavingsAccountCharge(@PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesResponse.class))) }) + public String addSavingsAccountCharge( + @PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingsAccountCharge(savingsAccountId) .withJson(apiRequestBodyAsJson).build(); @@ -199,15 +197,14 @@ public class SavingsAccountChargesApiResource { @Path("{savingsAccountChargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Savings account Charge", httpMethod = "PUT", notes = "Currently Savings account Charges may be updated only if the Savings account is not yet approved.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsAccountChargesApiResourceSwagger.PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest.class) }) + @Operation(summary = "Update a Savings account Charge", description = "Currently Savings account Charges may be updated only if the Savings account is not yet approved.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountChargesApiResourceSwagger.PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class))) }) public String updateSavingsAccountCharge( - @PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, - @PathParam("savingsAccountChargeId") @ApiParam(value = "savingsAccountChargeId") final Long savingsAccountChargeId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, + @PathParam("savingsAccountChargeId") @Parameter(description = "savingsAccountChargeId") final Long savingsAccountChargeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() .updateSavingsAccountCharge(savingsAccountId, savingsAccountChargeId).withJson(apiRequestBodyAsJson).build(); @@ -221,21 +218,20 @@ public class SavingsAccountChargesApiResource { @Path("{savingsAccountChargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Pay a Savings account Charge | Waive off a Savings account Charge | Inactivate a Savings account Charge", httpMethod = "POST", notes = "Pay a Savings account Charge:\n\n" + @Operation(summary = "Pay a Savings account Charge | Waive off a Savings account Charge | Inactivate a Savings account Charge", description = "Pay a Savings account Charge:\n\n" + "An active charge will be paid when savings account is active and having sufficient balance.\n\n" + "Waive off a Savings account Charge:\n\n" + "Outstanding charge amount will be waived off.\n\n" + "Inactivate a Savings account Charge:\n\n" + "A charge will be allowed to inactivate when savings account is active and not having any dues as of today. If charge is overpaid, corresponding charge payment transactions will be reversed.\n\n" + "Showing request/response for 'Pay a Savings account Charge'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class))) }) public String payOrWaiveSavingsAccountCharge( - @PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, - @PathParam("savingsAccountChargeId") @ApiParam(value = "savingsAccountChargeId") final Long savingsAccountChargeId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, + @PathParam("savingsAccountChargeId") @Parameter(description = "savingsAccountChargeId") final Long savingsAccountChargeId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String json = ""; if (is(commandParam, COMMAND_WAIVE_CHARGE)) { @@ -271,12 +267,12 @@ public class SavingsAccountChargesApiResource { @Path("{savingsAccountChargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Savings account Charge", httpMethod = "DELETE", notes = "Note: Currently, A Savings account Charge may only be removed from Savings that are not yet approved.") + @Operation(summary = "Delete a Savings account Charge", description = "Note: Currently, A Savings account Charge may only be removed from Savings that are not yet approved.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountChargesApiResourceSwagger.DeleteSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountChargesApiResourceSwagger.DeleteSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse.class))) }) public String deleteSavingsAccountCharge( - @PathParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Long savingsAccountId, - @PathParam("savingsAccountChargeId") @ApiParam(value = "savingsAccountChargeId") final Long savingsAccountChargeId) { + @PathParam("savingsAccountId") @Parameter(description = "savingsAccountId") final Long savingsAccountId, + @PathParam("savingsAccountChargeId") @Parameter(description = "savingsAccountChargeId") final Long savingsAccountChargeId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() .deleteSavingsAccountCharge(savingsAccountId, savingsAccountChargeId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResourceSwagger.java index 5f3cc657b..f8f817c2c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,24 +28,24 @@ final class SavingsAccountChargesApiResourceSwagger { private SavingsAccountChargesApiResourceSwagger() {} - @ApiModel(value = "GetSavingsAccountsSavingsAccountIdChargesResponse") + @Schema(description = "GetSavingsAccountsSavingsAccountIdChargesResponse") public static final class GetSavingsAccountsSavingsAccountIdChargesResponse { private GetSavingsAccountsSavingsAccountIdChargesResponse() {} static final class GetChargesCurrencyResponse { - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -54,58 +53,58 @@ final class SavingsAccountChargesApiResourceSwagger { private GetChargesChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetChargesChargeTimeType { private GetChargesChargeTimeType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer chargeId; - @ApiModelProperty(example = "57") + @Schema(example = "57") public Integer accountId; - @ApiModelProperty(example = "Savings account maintenance fee") + @Schema(example = "Savings account maintenance fee") public String name; public GetChargesChargeTimeType chargeTimeType; public GetChargesChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetChargesCurrencyResponse currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOutstanding; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOrPercentage; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = "GetSavingsAccountsSavingsAccountIdChargesTemplateResponse") + @Schema(description = "GetSavingsAccountsSavingsAccountIdChargesTemplateResponse") public static final class GetSavingsAccountsSavingsAccountIdChargesTemplateResponse { private GetSavingsAccountsSavingsAccountIdChargesTemplateResponse() {} @@ -118,135 +117,135 @@ final class SavingsAccountChargesApiResourceSwagger { private GetSavingsChargesChargeTimeType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetChargesAppliesTo { private GetChargesAppliesTo() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.savings") + @Schema(example = "chargeAppliesTo.savings") public String code; - @ApiModelProperty(example = "Savings") - public String value; + @Schema(example = "Savings") + public String description; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Passbook Fee") + @Schema(example = "Passbook Fee") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; public GetSavingsAccountsSavingsAccountIdChargesResponse.GetChargesCurrencyResponse currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; public GetSavingsChargesChargeTimeType chargeTimeType; public GetChargesAppliesTo chargesAppliesTo; public GetSavingsAccountsSavingsAccountIdChargesResponse.GetChargesChargeCalculationType chargeCalculationType; } - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; public Set chargeOptions; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = "GetSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") + @Schema(description = "GetSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") public static final class GetSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse { private GetSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeId; - @ApiModelProperty(example = "Passbook fee") + @Schema(example = "Passbook fee") public String name; public GetSavingsAccountsSavingsAccountIdChargesResponse.GetChargesChargeTimeType chargeTimeType; public GetSavingsAccountsSavingsAccountIdChargesResponse.GetChargesChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetSavingsAccountsSavingsAccountIdChargesResponse.GetChargesCurrencyResponse currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOutstanding; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOrPercentage; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = "PostSavingsAccountsSavingsAccountIdChargesRequest") + @Schema(description = "PostSavingsAccountsSavingsAccountIdChargesRequest") public static final class PostSavingsAccountsSavingsAccountIdChargesRequest { private PostSavingsAccountsSavingsAccountIdChargesRequest() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer chargeId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "29 April 2013") + @Schema(example = "29 April 2013") public String dueDate; } - @ApiModel(value = "PostSavingsAccountsSavingsAccountIdChargesResponse") + @Schema(description = "PostSavingsAccountsSavingsAccountIdChargesResponse") public static final class PostSavingsAccountsSavingsAccountIdChargesResponse { private PostSavingsAccountsSavingsAccountIdChargesResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer resourceId; } - @ApiModel(value = "PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest") + @Schema(description = "PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest") public static final class PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest { private PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "60") + @Schema(example = "60") public Float amount; - @ApiModelProperty(example = "27 March 2013") + @Schema(example = "27 March 2013") public String dueDate; } - @ApiModel(value = "PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") + @Schema(description = "PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") public static final class PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse { private PutSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse() {} @@ -255,69 +254,69 @@ final class SavingsAccountChargesApiResourceSwagger { private PutSavingsChanges() {} - @ApiModelProperty(example = "27 March 2013") + @Schema(example = "27 March 2013") public String dueDate; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "60.0") + @Schema(example = "60.0") public Float amount; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer resourceId; public PutSavingsChanges changes; } - @ApiModel(value = "PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest") + @Schema(description = "PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest") public static final class PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest { private PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdRequest() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "60") + @Schema(example = "60") public Float amount; - @ApiModelProperty(example = "12 September 2013") + @Schema(example = "12 September 2013") public String dueDate; } - @ApiModel(value = "PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") + @Schema(description = "PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") public static final class PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse { private PostSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } - @ApiModel(value = "DeleteSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") + @Schema(description = "DeleteSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse") public static final class DeleteSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse { private DeleteSavingsAccountsSavingsAccountIdChargesSavingsAccountChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java index 2753833c0..739001c09 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java @@ -20,15 +20,14 @@ package org.apache.fineract.portfolio.savings.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -79,9 +78,7 @@ import org.springframework.util.CollectionUtils; @Path("/savingsaccounts") @Component @Scope("singleton") -@Api(tags = { "Savings Account" }) -@SwaggerDefinition(tags = { - @Tag(name = "Savings Account", description = "Savings accounts are instances of a particular savings product created for an individual or group. An application process around the creation of accounts is also supported.") }) +@Tag(name = "Savings Account", description = "Savings accounts are instances of a particular savings product created for an individual or group. An application process around the creation of accounts is also supported.") public class SavingsAccountsApiResource { private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; @@ -115,15 +112,15 @@ public class SavingsAccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Savings Account Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Savings Account Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n\n" + "Example Requests:\n" + "\n" + "savingsaccounts/template?clientId=1\n" + "\n" + "\n" + "savingsaccounts/template?clientId=1&productId=1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.GetSavingsAccountsTemplateResponse.class) }) - public String template(@QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("groupId") @ApiParam(value = "groupId") final Long groupId, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.GetSavingsAccountsTemplateResponse.class))) }) + public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -139,18 +136,18 @@ public class SavingsAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List savings applications/accounts", httpMethod = "GET", notes = "Lists savings applications/accounts\n\n" + @Operation(summary = "List savings applications/accounts", description = "Lists savings applications/accounts\n\n" + "Example Requests:\n" + "\n" + "savingsaccounts\n" + "\n" + "\n" + "savingsaccounts?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.GetSavingsAccountsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.GetSavingsAccountsResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, // @QueryParam("underHierarchy") final String hierarchy, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -165,16 +162,15 @@ public class SavingsAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Submit new savings application", httpMethod = "POST", notes = "Submits new savings application\n\n" + @Operation(summary = "Submit new savings application", description = "Submits new savings application\n\n" + "Mandatory Fields: clientId or groupId, productId, submittedOnDate\n\n" + "Optional Fields: accountNo, externalId, fieldOfficerId\n\n" + "Inherited from Product (if not provided): nominalAnnualInterestRate, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minRequiredOpeningBalance, lockinPeriodFrequency, lockinPeriodFrequencyType, withdrawalFeeForTransfers, allowOverdraft, overdraftLimit, withHoldTax\n\n" + "Additional Mandatory Field if Entity-Datatable Check is enabled for the entity of type Savings: datatables") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsAccountsApiResourceSwagger.PostSavingsAccountsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.PostSavingsAccountsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.PostSavingsAccountsResponse.class) }) - public String submitApplication(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.PostSavingsAccountsResponse.class))) }) + public String submitApplication(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingsAccount().withJson(apiRequestBodyAsJson).build(); @@ -200,13 +196,13 @@ public class SavingsAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a savings application/account", httpMethod = "GET", notes = "Retrieves a savings application/account\n\n" + @Operation(summary = "Retrieve a savings application/account", description = "Retrieves a savings application/account\n\n" + "Example Requests :\n" + "\n" + "savingsaccounts/1\n" + "\n" + "\n" + "savingsaccounts/1?associations=all") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.GetSavingsAccountsAccountIdResponse.class) }) - public String retrieveOne(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @ApiParam(value = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @DefaultValue("all") @QueryParam("chargeStatus") @ApiParam(value = "chargeStatus") final String chargeStatus, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.GetSavingsAccountsAccountIdResponse.class))) }) + public String retrieveOne(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -274,18 +270,17 @@ public class SavingsAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Modify a savings application | Modify savings account withhold tax applicability", httpMethod = "PUT", notes = "Modify a savings application:\n\n" + @Operation(summary = "Modify a savings application | Modify savings account withhold tax applicability", description = "Modify a savings application:\n\n" + "Savings application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc\n\n" + "Modify savings account withhold tax applicability:\n\n" + "Savings application's withhold tax can be modified when in 'Active' state. Once the application is activated, can modify the account withhold tax to post tax or vice-versa" + "Showing request/response for 'Modify a savings application'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsAccountsApiResourceSwagger.PutSavingsAccountsAccountIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.PutSavingsAccountsAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.PutSavingsAccountsAccountIdResponse.class) }) - public String update(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson, - @QueryParam("command") @ApiParam(value = "command") final String commandParam) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.PutSavingsAccountsAccountIdResponse.class))) }) + public String update(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson, + @QueryParam("command") @Parameter(description = "command") final String commandParam) { if (is(commandParam, "updateWithHoldTax")) { final CommandWrapper commandRequest = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson).updateWithHoldTax(accountId) @@ -388,7 +383,7 @@ public class SavingsAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Approve savings application | Undo approval savings application | Assign Savings Officer | Unassign Savings Officer | Reject savings application | Withdraw savings application | Activate a savings account | Close a savings account | Calculate Interest on Savings Account | Post Interest on Savings Account | Block Savings Account | Unblock Savings Account | Block Savings Account Credit transactions | Unblock Savings Account Credit transactions | Block Savings Account Debit transactions | Unblock Savings Account debit transactions", httpMethod = "POST", notes = "Approve savings application:\n\n" + @Operation(summary = "Approve savings application | Undo approval savings application | Assign Savings Officer | Unassign Savings Officer | Reject savings application | Withdraw savings application | Activate a savings account | Close a savings account | Calculate Interest on Savings Account | Post Interest on Savings Account | Block Savings Account | Unblock Savings Account | Block Savings Account Credit transactions | Unblock Savings Account Credit transactions | Block Savings Account Debit transactions | Unblock Savings Account debit transactions", description = "Approve savings application:\n\n" + "Approves savings application so long as its in 'Submitted and pending approval' state.\n\n" + "Undo approval savings application:\n\n" + "Will move 'approved' savings application back to 'Submitted and pending approval' state.\n\n" + "Assign Savings Officer:\n\n" @@ -402,7 +397,7 @@ public class SavingsAccountsApiResource { + "Close a savings account:\n\n" + "Results in an Activated savings application being converted into an 'closed' savings account.\n" + "\n" + "closedOnDate is closure date of savings account\n" + "\n" - + "withdrawBalance is a boolean value, true value of this field performs a withdrawal transaction with account's running balance.\n\n" + + "withdrawBalance is a boolean description, true value of this field performs a withdrawal transaction with account's running balance.\n\n" + "Mandatory Fields: dateFormat,locale,closedOnDate\n\n" + "Optional Fields: note, withdrawBalance, paymentTypeId, accountNumber, checkNumber, routingCode, receiptNumber, bankNumber\n\n" + "Calculate Interest on Savings Account:\n\n" @@ -420,13 +415,12 @@ public class SavingsAccountsApiResource { + "Unblock Savings Account debit transactions:\n\n" + "It unblocks the Saving account's debit operations. Now all types of debits can be transacted from Savings account\n\n" + "Showing request/response for 'Unassign Savings Officer'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsAccountsApiResourceSwagger.PostSavingsAccountsAccountIdRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.PostSavingsAccountsAccountIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.PostSavingsAccountsAccountIdResponse.class) }) - public String handleCommands(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.PostSavingsAccountsAccountIdResponse.class))) }) + public String handleCommands(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { String jsonApiRequest = apiRequestBodyAsJson; if (StringUtils.isBlank(jsonApiRequest)) { @@ -512,10 +506,10 @@ public class SavingsAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a savings application", httpMethod = "DELETE", notes = "At present we support hard delete of savings application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the savings account.") + @Operation(summary = "Delete a savings application", description = "At present we support hard delete of savings application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the savings account.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsAccountsApiResourceSwagger.DeleteSavingsAccountsAccountIdResponse.class) }) - public String delete(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsAccountsApiResourceSwagger.DeleteSavingsAccountsAccountIdResponse.class))) }) + public String delete(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSavingsAccount(accountId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResourceSwagger.java index 420c792a7..8b3a6bebf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class SavingsAccountsApiResourceSwagger { private SavingsAccountsApiResourceSwagger() {} - @ApiModel(value = "GetSavingsAccountsTemplateResponse") + @Schema(description = "GetSavingsAccountsTemplateResponse") public static final class GetSavingsAccountsTemplateResponse { private GetSavingsAccountsTemplateResponse() {} @@ -39,20 +38,20 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsProductOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "small business") + @Schema(example = "small business") public String clientName; public Set productOptions; } - @ApiModel(value = "GetSavingsAccountsResponse") + @Schema(description = "GetSavingsAccountsResponse") public static final class GetSavingsAccountsResponse { private GetSavingsAccountsResponse() {} @@ -65,23 +64,23 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } @@ -90,7 +89,7 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsTimeline() {} - @ApiModelProperty(example = "[2013, 3, 1]") + @Schema(example = "[2013, 3, 1]") public LocalDate submittedOnDate; } @@ -98,17 +97,17 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -116,48 +115,48 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") public String code; - @ApiModelProperty(example = "Daily") - public String value; + @Schema(example = "Daily") + public String description; } static final class GetSavingsInterestPostingPeriodType { private GetSavingsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetSavingsInterestCalculationType { private GetSavingsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetSavingsInterestCalculationDaysInYearType { private GetSavingsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetSavingsSummary { @@ -165,28 +164,28 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsSummary() {} public GetSavingsCurrency currency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer accountBalance; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public String accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "small business") + @Schema(example = "small business") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsProductId; - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetSavingsStatus status; public GetSavingsTimeline timeline; public GetSavingsCurrency currency; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Double nominalAnnualInterestRate; public GetSavingsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetSavingsInterestPostingPeriodType interestPostingPeriodType; @@ -195,44 +194,44 @@ final class SavingsAccountsApiResourceSwagger { public GetSavingsSummary summary; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "PostSavingsAccountsRequest") + @Schema(description = "PostSavingsAccountsRequest") public static final class PostSavingsAccountsRequest { private PostSavingsAccountsRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "01 March 2011") + @Schema(example = "01 March 2011") public String submittedOnDate; } - @ApiModel(value = "PostSavingsAccountsResponse") + @Schema(description = "PostSavingsAccountsResponse") public static final class PostSavingsAccountsResponse { private PostSavingsAccountsResponse() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "GetSavingsAccountsAccountIdResponse") + @Schema(description = "GetSavingsAccountsAccountIdResponse") public static final class GetSavingsAccountsAccountIdResponse { private GetSavingsAccountsAccountIdResponse() {} @@ -242,30 +241,30 @@ final class SavingsAccountsApiResourceSwagger { private GetSavingsAccountsSummary() {} public GetSavingsAccountsResponse.GetSavingsPageItems.GetSavingsCurrency currency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer accountBalance; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer availableBalance; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public String accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "small business") + @Schema(example = "small business") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsProductId; - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetSavingsAccountsResponse.GetSavingsPageItems.GetSavingsStatus status; public GetSavingsAccountsResponse.GetSavingsPageItems.GetSavingsTimeline timeline; public GetSavingsAccountsResponse.GetSavingsPageItems.GetSavingsCurrency currency; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Double nominalAnnualInterestRate; public GetSavingsAccountsResponse.GetSavingsPageItems.GetSavingsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetSavingsAccountsResponse.GetSavingsPageItems.GetSavingsInterestPostingPeriodType interestPostingPeriodType; @@ -274,18 +273,18 @@ final class SavingsAccountsApiResourceSwagger { public GetSavingsAccountsSummary summary; } - @ApiModel(value = "PutSavingsAccountsAccountIdRequest") + @Schema(description = "PutSavingsAccountsAccountIdRequest") public static final class PutSavingsAccountsAccountIdRequest { private PutSavingsAccountsAccountIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "5.9999999999") + @Schema(example = "5.9999999999") public Double nominalAnnualInterestRate; } - @ApiModel(value = "PutSavingsAccountsAccountIdResponse") + @Schema(description = "PutSavingsAccountsAccountIdResponse") public static final class PutSavingsAccountsAccountIdResponse { private PutSavingsAccountsAccountIdResponse() {} @@ -294,37 +293,37 @@ final class SavingsAccountsApiResourceSwagger { private PutSavingsAccountsChanges() {} - @ApiModelProperty(example = "5.9999999999") + @Schema(example = "5.9999999999") public Double nominalAnnualInterestRate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutSavingsAccountsChanges changes; } - @ApiModel(value = "PostSavingsAccountsAccountIdRequest") + @Schema(description = "PostSavingsAccountsAccountIdRequest") public static final class PostSavingsAccountsAccountIdRequest { private PostSavingsAccountsAccountIdRequest() {} - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "05 September 2014") + @Schema(example = "05 September 2014") public String unassignedDate; } - @ApiModel(value = "PostSavingsAccountsAccountIdResponse") + @Schema(description = "PostSavingsAccountsAccountIdResponse") public static final class PostSavingsAccountsAccountIdResponse { private PostSavingsAccountsAccountIdResponse() {} @@ -334,25 +333,25 @@ final class SavingsAccountsApiResourceSwagger { private PostSavingsAccountsAccountIdChanges() {} } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer clientId; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer resourceId; public PostSavingsAccountsAccountIdChanges changes; } - @ApiModel(value = "DeleteSavingsAccountsAccountIdResponse") + @Schema(description = "DeleteSavingsAccountsAccountIdResponse") public static final class DeleteSavingsAccountsAccountIdResponse { private DeleteSavingsAccountsAccountIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java index d9dbc389f..ab8d4c25c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -83,10 +83,9 @@ import org.springframework.util.CollectionUtils; @Path("/savingsproducts") @Component @Scope("singleton") -@Api(tags = { "Savings Product" }) -@SwaggerDefinition(tags = { @Tag(name = "Savings Product", description = "An MFIs savings product offerings are modeled using this API." - + "\n" - + "When creating savings accounts, the details from the savings product are used to auto fill details of the savings account application process.") }) + +@Tag(name = "Savings Product", description = "An MFIs savings product offerings are modeled using this API." + "\n" + + "When creating savings accounts, the details from the savings product are used to auto fill details of the savings account application process.") public class SavingsProductsApiResource { private final SavingsProductReadPlatformService savingProductReadPlatformService; @@ -130,15 +129,14 @@ public class SavingsProductsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a Savings Product", httpMethod = "POST", notes = "Creates a Savings Product\n\n" + @Operation(summary = "Create a Savings Product", description = "Creates a Savings Product\n\n" + "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, nominalAnnualInterestRate, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType,accountingRule\n\n" + "Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId\n\n" + "Optional Fields: minRequiredOpeningBalance, lockinPeriodFrequency, lockinPeriodFrequencyType, withdrawalFeeForTransfers, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, allowOverdraft, overdraftLimit, minBalanceForInterestCalculation,withHoldTax,taxGroupId") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsProductsApiResourceSwagger.PostSavingsProductsRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PostSavingsProductsRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsProductsApiResourceSwagger.PostSavingsProductsResponse.class) }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PostSavingsProductsResponse.class))) }) + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingProduct().withJson(apiRequestBodyAsJson).build(); @@ -151,13 +149,12 @@ public class SavingsProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Savings Product", httpMethod = "PUT", notes = "Updates a Savings Product") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SavingsProductsApiResourceSwagger.PutSavingsProductsProductIdRequest.class) }) + @Operation(summary = "Update a Savings Product", description = "Updates a Savings Product") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PutSavingsProductsProductIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsProductsApiResourceSwagger.PutSavingsProductsProductIdResponse.class) }) - public String update(@PathParam("productId") @ApiParam(value = "productId") final Long productId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PutSavingsProductsProductIdResponse.class))) }) + public String update(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSavingProduct(productId).withJson(apiRequestBodyAsJson) .build(); @@ -171,10 +168,10 @@ public class SavingsProductsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Savings Products", httpMethod = "GET", notes = "Lists Savings Products\n\n" + "Example Requests:\n" + "\n" + @Operation(summary = "List Savings Products", description = "Lists Savings Products\n\n" + "Example Requests:\n" + "\n" + "savingsproducts\n" + "\n" + "savingsproducts?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = SavingsProductsApiResourceSwagger.GetSavingsProductsResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.GetSavingsProductsResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME); @@ -189,12 +186,12 @@ public class SavingsProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Savings Product", httpMethod = "GET", notes = "Retrieves a Savings Product\n\n" - + "Example Requests:\n" + "\n" + "savingsproducts/1\n" + "\n" + "savingsproducts/1?template=true\n" + "\n" - + "savingsproducts/1?fields=name,description") + @Operation(summary = "Retrieve a Savings Product", description = "Retrieves a Savings Product\n\n" + "Example Requests:\n" + "\n" + + "savingsproducts/1\n" + "\n" + "savingsproducts/1?template=true\n" + "\n" + "savingsproducts/1?fields=name,description") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsProductsApiResourceSwagger.GetSavingsProductsProductIdResponse.class) }) - public String retrieveOne(@PathParam("productId") @ApiParam(value = "productId") final Long productId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.GetSavingsProductsProductIdResponse.class))) }) + public String retrieveOne(@PathParam("productId") @Parameter(description = "productId") final Long productId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME); @@ -231,10 +228,10 @@ public class SavingsProductsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Savings Product Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "savingsproducts/template") + @Operation(summary = "Retrieve Savings Product Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "savingsproducts/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsProductsApiResourceSwagger.GetSavingsProductsTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.GetSavingsProductsTemplateResponse.class))) }) public String retrieveTemplate(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME); @@ -320,10 +317,10 @@ public class SavingsProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Savings Product", httpMethod = "DELETE", notes = "Deletes a Savings Product") + @Operation(summary = "Delete a Savings Product", description = "Deletes a Savings Product") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SavingsProductsApiResourceSwagger.DeleteSavingsProductsProductIdResponse.class) }) - public String delete(@PathParam("productId") @ApiParam(value = "productId") final Long productId) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.DeleteSavingsProductsProductIdResponse.class))) }) + public String delete(@PathParam("productId") @Parameter(description = "productId") final Long productId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSavingProduct(productId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResourceSwagger.java index e64fd2907..5f8a7ff7f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.math.BigDecimal; import java.util.List; import java.util.Set; @@ -31,7 +30,7 @@ final class SavingsProductsApiResourceSwagger { private SavingsProductsApiResourceSwagger() {} - @ApiModel(value = "PostSavingsProductsRequest") + @Schema(description = "PostSavingsProductsRequest") public static final class PostSavingsProductsRequest { private PostSavingsProductsRequest() {} @@ -40,62 +39,62 @@ final class SavingsProductsApiResourceSwagger { private PostSavingsCharges() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; } - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String name; - @ApiModelProperty(example = "PBSV") + @Schema(example = "PBSV") public String shortName; - @ApiModelProperty(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") + @Schema(example = "Daily compounding using Daily Balance, 5% per year, 365 days in year") public String description; - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String currencyCode; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer digitsAfterDecimal; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "5.0") + @Schema(example = "5.0") public Double nominalAnnualInterestRate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCompoundingPeriodType; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer interestPostingPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCalculationType; - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer interestCalculationDaysInYearType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountingRule; public Set charges; } - @ApiModel(value = "PostSavingsProductsResponse") + @Schema(description = "PostSavingsProductsResponse") public static final class PostSavingsProductsResponse { private PostSavingsProductsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutSavingsProductsProductIdRequest") + @Schema(description = "PutSavingsProductsProductIdRequest") public static final class PutSavingsProductsProductIdRequest { private PutSavingsProductsProductIdRequest() {} - @ApiModelProperty(example = "Passbook Savings Lite.") + @Schema(example = "Passbook Savings Lite.") public String description; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "5.73") + @Schema(example = "5.73") public Double interestRate; } - @ApiModel(value = "PutSavingsProductsProductIdResponse") + @Schema(description = "PutSavingsProductsProductIdResponse") public static final class PutSavingsProductsProductIdResponse { private PutSavingsProductsProductIdResponse() {} @@ -104,20 +103,20 @@ final class SavingsProductsApiResourceSwagger { private PutSavingsChanges() {} - @ApiModelProperty(example = "Passbook Savings Lite.") + @Schema(example = "Passbook Savings Lite.") public String description; - @ApiModelProperty(example = "5.73") + @Schema(example = "5.73") public Double interestRate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutSavingsChanges changes; } - @ApiModel(value = "GetSavingsProductsResponse") + @Schema(description = "GetSavingsProductsResponse") public static final class GetSavingsProductsResponse { private GetSavingsProductsResponse() {} @@ -126,17 +125,17 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -144,83 +143,83 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") public String code; - @ApiModelProperty(example = "Daily") - public String value; + @Schema(example = "Daily") + public String description; } static final class GetSavingsProductsInterestPostingPeriodType { private GetSavingsProductsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetSavingsProductsInterestCalculationType { private GetSavingsProductsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetSavingsProductsInterestCalculationDaysInYearType { private GetSavingsProductsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetSavingsProductsAccountingRule { private GetSavingsProductsAccountingRule() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountingRuleType.cash") + @Schema(example = "accountingRuleType.cash") public String code; - @ApiModelProperty(example = "CASH BASED") - public String value; + @Schema(example = "CASH BASED") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Savings product") + @Schema(example = "Savings product") public String name; - @ApiModelProperty(example = "sa1") + @Schema(example = "sa1") public String shortName; - @ApiModelProperty(example = "gtasga") + @Schema(example = "gtasga") public String description; public GetSavingsCurrency currency; - @ApiModelProperty(example = "5.000000") + @Schema(example = "5.000000") public BigDecimal nominalAnnualInterestRate; public GetSavingsProductsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetSavingsProductsInterestPostingPeriodType interestPostingPeriodType; public GetSavingsProductsInterestCalculationType interestCalculationType; public GetSavingsProductsInterestCalculationDaysInYearType interestCalculationDaysInYearType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawalFeeForTransfers; public GetSavingsProductsAccountingRule accountingRule; } - @ApiModel(value = "GetSavingsProductsProductIdResponse") + @Schema(description = "GetSavingsProductsProductIdResponse") public static final class GetSavingsProductsProductIdResponse { private GetSavingsProductsProductIdResponse() {} @@ -233,11 +232,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsSavingsReferenceAccount() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "savings ref") + @Schema(example = "savings ref") public String name; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer glCode; } @@ -245,11 +244,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsIncomeFromFeeAccount() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "income from savings fee") + @Schema(example = "income from savings fee") public String name; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer glCode; } @@ -257,11 +256,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsIncomeFromPenaltyAccount() {} - @ApiModelProperty(example = "17") + @Schema(example = "17") public Integer id; - @ApiModelProperty(example = "income from sav penalties") + @Schema(example = "income from sav penalties") public String name; - @ApiModelProperty(example = "25") + @Schema(example = "25") public Integer glCode; } @@ -269,11 +268,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsInterestOnSavingsAccount() {} - @ApiModelProperty(example = "15") + @Schema(example = "15") public Integer id; - @ApiModelProperty(example = "interest on savings") + @Schema(example = "interest on savings") public String name; - @ApiModelProperty(example = "23") + @Schema(example = "23") public Integer glCode; } @@ -281,11 +280,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsSavingsControlAccount() {} - @ApiModelProperty(example = "13") + @Schema(example = "13") public Integer id; - @ApiModelProperty(example = "savings ref tool kit") + @Schema(example = "savings ref tool kit") public String name; - @ApiModelProperty(example = "21") + @Schema(example = "21") public Integer glCode; } @@ -293,11 +292,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsTransfersInSuspenseAccount() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer id; - @ApiModelProperty(example = "saving transfers") + @Schema(example = "saving transfers") public String name; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Integer glCode; } @@ -317,9 +316,9 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsPaymentType() {} - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer id; - @ApiModelProperty(example = "check") + @Schema(example = "check") public String name; } @@ -327,11 +326,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsFundSourceAccount() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "savings ref") + @Schema(example = "savings ref") public String name; - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer glCode; } @@ -347,13 +346,13 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsFeeToIncomeAccountMappingsCharge() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "sav charge") + @Schema(example = "sav charge") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } @@ -361,11 +360,11 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsFeeToIncomeAccountMappingsIncomeAccount() {} - @ApiModelProperty(example = "16") + @Schema(example = "16") public Integer id; - @ApiModelProperty(example = "income from savings fee") + @Schema(example = "income from savings fee") public String name; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer glCode; } @@ -381,13 +380,13 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsPenaltyToIncomeAccountMappingsCharge() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer id; - @ApiModelProperty(example = "sav 2") + @Schema(example = "sav 2") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; } @@ -395,33 +394,33 @@ final class SavingsProductsApiResourceSwagger { public GetSavingsProductsAccountingMappings.GetSavingsProductsIncomeFromPenaltyAccount incomeAccount; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savings product") + @Schema(example = "savings product") public String name; - @ApiModelProperty(example = "sa1") + @Schema(example = "sa1") public String shortName; - @ApiModelProperty(example = "gtasga") + @Schema(example = "gtasga") public String description; public GetSavingsProductsResponse.GetSavingsCurrency currency; - @ApiModelProperty(example = "5") + @Schema(example = "5") public BigDecimal nominalAnnualInterestRate; public GetSavingsProductsResponse.GetSavingsProductsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetSavingsProductsResponse.GetSavingsProductsInterestPostingPeriodType interestPostingPeriodType; public GetSavingsProductsResponse.GetSavingsProductsInterestCalculationType interestCalculationType; public GetSavingsProductsResponse.GetSavingsProductsInterestCalculationDaysInYearType interestCalculationDaysInYearType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawalFeeForTransfers; public GetSavingsProductsResponse.GetSavingsProductsAccountingRule accountingRule; public GetSavingsProductsAccountingMappings accountingMappings; public Set paymentChannelToFundSourceMappings; public Set feeToIncomeAccountMappings; public Set penaltyToIncomeAccountMappings; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public List charges; } - @ApiModel(value = "GetSavingsProductsTemplateResponse") + @Schema(description = "GetSavingsProductsTemplateResponse") public static final class GetSavingsProductsTemplateResponse { private GetSavingsProductsTemplateResponse() {} @@ -430,47 +429,47 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsTemplateAccountingRule() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountingRuleType.none") + @Schema(example = "accountingRuleType.none") public String code; - @ApiModelProperty(example = "NONE") - public String value; + @Schema(example = "NONE") + public String description; } static final class GetSavingsProductsLockinPeriodFrequencyTypeOptions { private GetSavingsProductsLockinPeriodFrequencyTypeOptions() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "savings.lockin.savingsPeriodFrequencyType.days") + @Schema(example = "savings.lockin.savingsPeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public String value; + @Schema(example = "Days") + public String description; } static final class GetSavingsProductsWithdrawalFeeTypeOptions { private GetSavingsProductsWithdrawalFeeTypeOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsWithdrawalFeesType.flat") + @Schema(example = "savingsWithdrawalFeesType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetSavingsProductsPaymentTypeOptions { private GetSavingsProductsPaymentTypeOptions() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer id; - @ApiModelProperty(example = "Wire Transfer") + @Schema(example = "Wire Transfer") public String name; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer position; } @@ -486,47 +485,47 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsLiabilityType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.liability") + @Schema(example = "accountType.liability") public String code; - @ApiModelProperty(example = "LIABILITY") - public String value; + @Schema(example = "LIABILITY") + public String description; } static final class GetSavingsProductsLiabilityUsage { private GetSavingsProductsLiabilityUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public String value; + @Schema(example = "DETAIL") + public String description; } static final class GetSavingsProductsLiabilityTagId { private GetSavingsProductsLiabilityTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; } - @ApiModelProperty(example = "15") + @Schema(example = "15") public Integer id; - @ApiModelProperty(example = "Savings Control") + @Schema(example = "Savings Control") public String name; - @ApiModelProperty(example = "50001") + @Schema(example = "50001") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetSavingsProductsLiabilityType type; public GetSavingsProductsLiabilityUsage usage; - @ApiModelProperty(example = "Savings Control") + @Schema(example = "Savings Control") public String nameDecorated; public GetSavingsProductsLiabilityTagId tagId; } @@ -539,12 +538,12 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsAssetLiabilityType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountType.asset") + @Schema(example = "accountType.asset") public String code; - @ApiModelProperty(example = "ASSET") - public String value; + @Schema(example = "ASSET") + public String description; } static final class GetSavingsAssetTagId { @@ -552,15 +551,15 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsAssetTagId() {} } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Cash") + @Schema(example = "Cash") public String name; - @ApiModelProperty(example = "100001") + @Schema(example = "100001") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetSavingsAssetLiabilityType type; public GetSavingsProductsLiabilityAccountOptions.GetSavingsProductsLiabilityUsage usage; @@ -575,23 +574,23 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsExpenseType() {} - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer id; - @ApiModelProperty(example = "accountType.expense") + @Schema(example = "accountType.expense") public String code; - @ApiModelProperty(example = "EXPENSE") - public String value; + @Schema(example = "EXPENSE") + public String description; } - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer id; - @ApiModelProperty(example = "Write Off Expenses") + @Schema(example = "Write Off Expenses") public String name; - @ApiModelProperty(example = "60001") + @Schema(example = "60001") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetSavingsProductsExpenseType type; public GetSavingsProductsLiabilityAccountOptions.GetSavingsProductsLiabilityUsage usage; @@ -606,23 +605,23 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsProductsIncomeType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "accountType.income") + @Schema(example = "accountType.income") public String code; - @ApiModelProperty(example = "INCOME") - public String value; + @Schema(example = "INCOME") + public String description; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "income from interest") + @Schema(example = "income from interest") public String name; - @ApiModelProperty(example = "40001") + @Schema(example = "40001") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetSavingsProductsIncomeType type; public GetSavingsProductsLiabilityAccountOptions.GetSavingsProductsLiabilityUsage usage; @@ -644,64 +643,64 @@ final class SavingsProductsApiResourceSwagger { private GetSavingsChargeTimeType() {} - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetSavingsProductsChargeAppliesTo { private GetSavingsProductsChargeAppliesTo() {} - @ApiModelProperty(example = "chargeAppliesTo.savings") + @Schema(example = "chargeAppliesTo.savings") public String code; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Savings") - public String value; + @Schema(example = "Savings") + public String description; } static final class GetSavingsChargeCalculationType { private GetSavingsChargeCalculationType() {} - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetSavingsChargePaymentMode { private GetSavingsChargePaymentMode() {} - @ApiModelProperty(example = "chargepaymentmode.regular") + @Schema(example = "chargepaymentmode.regular") public String code; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.regular") - public String value; + @Schema(example = "chargepaymentmode.regular") + public String description; } - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "200") + @Schema(example = "200") public Long amount; public GetSavingsProductsChargeAppliesTo chargeAppliesTo; public GetSavingsChargeCalculationType chargeCalculationType; public GetSavingsChargePaymentMode chargePaymentMode; public GetSavingsChargeTimeType chargeTimeType; public GetSavingsProductsResponse.GetSavingsCurrency currency; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "Savings charge 1") + @Schema(example = "Savings charge 1") public String name; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } @@ -724,12 +723,12 @@ final class SavingsProductsApiResourceSwagger { public Set chargeOptions; } - @ApiModel(value = "DeleteSavingsProductsProductIdResponse") + @Schema(description = "DeleteSavingsProductsProductIdResponse") public static final class DeleteSavingsProductsProductIdResponse { private DeleteSavingsProductsProductIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java index 8ce2ab11b..c401ad5ee 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.portfolio.search.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import java.util.Set; import javax.ws.rs.Consumes; @@ -56,9 +55,7 @@ import org.springframework.stereotype.Component; @Path("/search") @Component @Scope("singleton") -@Api(tags = { "Search API" }) -@SwaggerDefinition(tags = { - @Tag(name = "Search API", description = "Search API allows to search scoped resources clients, loans and groups on specified fields.") }) +@Tag(name = "Search API", description = "Search API allows to search scoped resources clients, loans and groups on specified fields.") public class SearchApiResource { private final Set searchResponseParameters = SearchResponseParameters.getAllValues(); @@ -84,9 +81,9 @@ public class SearchApiResource { @Path("/template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrive Adhoc Search query template", httpMethod = "GET", notes = "Mandatory Fields\n" + "\n" - + "search?query=000000001\n") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SearchApiResourceSwagger.GetSearchResponse.class) }) + @Operation(summary = "Retrive Adhoc Search query template", description = "Mandatory Fields\n" + "\n" + "search?query=000000001\n") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SearchApiResourceSwagger.GetSearchResponse.class))) }) public String retrieveAdHocSearchQueryTemplate(@Context final UriInfo uriInfo) { final AdHocSearchQueryData templateData = this.searchReadPlatformService.retrieveAdHocQueryTemplate(); @@ -98,12 +95,13 @@ public class SearchApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Search Resources", notes = "Example Requests:\n" + "\n" + "search?query=000000001\n" + "\n" + "\n" + @Operation(summary = "Search Resources", description = "Example Requests:\n" + "\n" + "search?query=000000001\n" + "\n" + "\n" + "search?query=Petra&resource=clients,groups\n" + "\n" + "\n" + "search?query=Petra&resource=clients,groups&exactMatch=true") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SearchApiResourceSwagger.GetSearchResponse.class) }) - public String searchData(@Context final UriInfo uriInfo, @QueryParam("query") @ApiParam(value = "query") final String query, - @QueryParam("resource") @ApiParam(value = "resource") final String resource, - @DefaultValue("false") @QueryParam("exactMatch") @ApiParam(value = "exactMatch") Boolean exactMatch) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SearchApiResourceSwagger.GetSearchResponse.class))) }) + public String searchData(@Context final UriInfo uriInfo, @QueryParam("query") @Parameter(description = "query") final String query, + @QueryParam("resource") @Parameter(description = "resource") final String resource, + @DefaultValue("false") @QueryParam("exactMatch") @Parameter(description = "exactMatch") Boolean exactMatch) { final SearchConditions searchConditions = new SearchConditions(query, resource, exactMatch); @@ -117,16 +115,16 @@ public class SearchApiResource { @Path("/advance") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Adhoc query search", notes = "AdHocQuery search has more search options, it is a POST request, it uses request body to send search parameters\n" + @Operation(summary = "Adhoc query search", description = "AdHocQuery search has more search options, it is a POST request, it uses request body to send search parameters\n" + "\n" + "\n" + "Mandatory fields:" + "entities" + "\n" + "\n" + "Optional fields:" + "loanStatus, loanProducts, offices, loanDateOption, loanFromDate, loanToDate, \n" + "includeOutStandingAmountPercentage, outStandingAmountPercentageCondition, \n" + "minOutStandingAmountPercentage and maxOutStandingAmountPercentage OR outStandingAmountPercentage, \n" + "includeOutstandingAmount, outstandingAmountCondition, \n" + "minOutstandingAmount and maxOutstandingAmount OR outstandingAmount") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SearchApiResourceSwagger.PostAdhocQuerySearchRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SearchApiResourceSwagger.PostAdhocQuerySearchResponse.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SearchApiResourceSwagger.PostAdhocQuerySearchRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SearchApiResourceSwagger.PostAdhocQuerySearchResponse.class))) }) public String advancedSearch(@Context final UriInfo uriInfo, final String json) { final AdHocQuerySearchConditions searchConditions = this.fromApiJsonDeserializer.retrieveSearchConditions(json); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResourceSwagger.java index c0bd4b674..c16978e2e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.search.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.joda.time.LocalDate; @@ -32,77 +31,77 @@ final class SearchApiResourceSwagger { } - @ApiModel(value = "GetSearchResponse") + @Schema(description = "GetSearchResponse") public static final class GetSearchResponse { private GetSearchResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long entityId; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long entityAccountNo; - @ApiModelProperty(example = "ID_JKZGEXF") + @Schema(example = "ID_JKZGEXF") public String entityExternalId; - @ApiModelProperty(example = "Group_Name_HVCU5") + @Schema(example = "Group_Name_HVCU5") public String entityName; - @ApiModelProperty(example = "GROUP") + @Schema(example = "GROUP") public String entityType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long parentId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String parentName; public EnumOptionData entityStatus; } - @ApiModel(value = "PostAdhocQuerySearchRequest") + @Schema(description = "PostAdhocQuerySearchRequest") public static final class PostAdhocQuerySearchRequest { private PostAdhocQuerySearchRequest() { } - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "approvalDate") + @Schema(example = "approvalDate") public String loanDateOption; - @ApiModelProperty(example = "2013-01-01") + @Schema(example = "2013-01-01") public LocalDate loanFromDate; - @ApiModelProperty(example = "2014-01-27") + @Schema(example = "2014-01-27") public LocalDate loanToDate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean includeOutStandingAmountPercentage; - @ApiModelProperty(example = "<=") + @Schema(example = "<=") public String outStandingAmountPercentageCondition; - @ApiModelProperty(example = "80") + @Schema(example = "80") public Long outStandingAmountPercentage; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean includeOutstandingAmount; - @ApiModelProperty(example = "between") + @Schema(example = "between") public String outstandingAmountCondition; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Long minOutstandingAmount; - @ApiModelProperty(example = "10000") + @Schema(example = "10000") public Long maxOutstandingAmount; } - @ApiModel(value = "PostAdhocQuerySearchResponse") + @Schema(description = "PostAdhocQuerySearchResponse") public static final class PostAdhocQuerySearchResponse { private PostAdhocQuerySearchResponse() { } - @ApiModelProperty(example = "HFC") + @Schema(example = "HFC") public String officeName; - @ApiModelProperty(example = "01 BC3M") + @Schema(example = "01 BC3M") public String loanProductName; - @ApiModelProperty(example = " 5692.41") + @Schema(example = " 5692.41") public Long loanOutStanding; - @ApiModelProperty(example = "76.4") + @Schema(example = "76.4") public Long percentage; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java index 068a3aacd..b3d4e4993 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.portfolio.self.account.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.math.BigDecimal; import java.util.Collection; import java.util.Map; @@ -61,8 +62,8 @@ import org.springframework.stereotype.Component; @Path("/self/accounttransfers") @Component @Scope("singleton") -@Api(tags = { "Self Account Transfer" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Account transfer", description = "") }) + +@Tag(name = "Self Account transfer", description = "") public class SelfAccountTransferApiResource { private final PlatformSecurityContext context; @@ -99,11 +100,12 @@ public class SelfAccountTransferApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Account Transfer Template", httpMethod = "GET", notes = "Returns list of loan/savings accounts that can be used for account transfer\n" + @Operation(summary = "Retrieve Account Transfer Template", description = "Returns list of loan/savings accounts that can be used for account transfer\n" + "\n" + "\n" + "Example Requests:\n" + "\n" + "self/accounttransfers/template\n") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = SelfAccountTransferApiResourceSwagger.GetAccountTransferTemplateResponse.class) }) - public String template(@DefaultValue("") @QueryParam("type") @ApiParam("type") final String type, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfAccountTransferApiResourceSwagger.GetAccountTransferTemplateResponse.class)))) }) + public String template(@DefaultValue("") @QueryParam("type") @Parameter(name = "type") final String type, + @Context final UriInfo uriInfo) { AppUser user = this.context.authenticatedUser(); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -121,11 +123,12 @@ public class SelfAccountTransferApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create new Transfer", httpMethod = "POST", notes = "Ability to create new transfer of monetary funds from one account to another.\n" + @Operation(summary = "Create new Transfer", description = "Ability to create new transfer of monetary funds from one account to another.\n" + "\n" + "\n" + "Example Requests:\n" + "\n" + " self/accounttransfers/\n") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = SelfAccountTransferApiResourceSwagger.PostNewTransferResponse.class) }) - public String create(@DefaultValue("") @QueryParam("type") @ApiParam("type") final String type, final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfAccountTransferApiResourceSwagger.PostNewTransferResponse.class)))) }) + public String create(@DefaultValue("") @QueryParam("type") @Parameter(name = "type") final String type, + final String apiRequestBodyAsJson) { Map params = this.dataValidator.validateCreate(type, apiRequestBodyAsJson); if (type.equals("tpt")) { checkForLimits(params); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResourceSwagger.java index f723c4041..cdda461cf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.account.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -30,7 +29,7 @@ final class SelfAccountTransferApiResourceSwagger { private SelfAccountTransferApiResourceSwagger() {} - @ApiModel(value = "GetAccountTransferTemplateResponse") + @Schema(description = "GetAccountTransferTemplateResponse") public static final class GetAccountTransferTemplateResponse { private GetAccountTransferTemplateResponse() {} @@ -39,12 +38,12 @@ final class SelfAccountTransferApiResourceSwagger { private GetAccountOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } public Set accountTypeOptions; @@ -53,18 +52,18 @@ final class SelfAccountTransferApiResourceSwagger { private GetFromAccountOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer accountId; - @ApiModelProperty(example = "00000001") + @Schema(example = "00000001") public Integer accountNo; public GetAccountTransferTemplateResponse.GetAccountOptions accountType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "ABC") + @Schema(example = "ABC") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "HEAD OFFICE") + @Schema(example = "HEAD OFFICE") public String officeName; } @@ -75,18 +74,18 @@ final class SelfAccountTransferApiResourceSwagger { private GetToAccountOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer accountId; - @ApiModelProperty(example = "00000001") + @Schema(example = "00000001") public Integer accountNo; public GetAccountTransferTemplateResponse.GetAccountOptions accountType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "ABC") + @Schema(example = "ABC") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "HEAD OFFICE") + @Schema(example = "HEAD OFFICE") public String officeName; } @@ -94,48 +93,48 @@ final class SelfAccountTransferApiResourceSwagger { public Set toAccountTypeOptions; } - @ApiModel(value = "PostNewTransferRequest") + @Schema(description = "PostNewTransferRequest") public static final class PostNewTransferRequest { private PostNewTransferRequest() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer fromAccountType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer fromAccountId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer toClientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toAccountType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer toAccountId; - @ApiModelProperty(example = "dd MMMM YYYY") + @Schema(example = "dd MMMM YYYY") public String dateFormat; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "01 August 2011") + @Schema(example = "01 August 2011") public String transferDate; - @ApiModelProperty(example = "112.45") + @Schema(example = "112.45") public Float transferAmount; - @ApiModelProperty(example = "A description of the transfer") + @Schema(example = "A description of the transfer") public String transferDescription; } - @ApiModel(value = "PostNewTransferResponse") + @Schema(description = "PostNewTransferResponse") public static final class PostNewTransferResponse { private PostNewTransferResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java index c45e8078a..bea11e1ea 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.self.account.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -62,8 +62,8 @@ import org.springframework.stereotype.Component; @Path("/self/beneficiaries/tpt") @Component @Scope("singleton") -@Api(tags = { "Self Third Party Transfer" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Third Party Transfer", description = "") }) + +@Tag(name = "Self Third Party Transfer", description = "") public class SelfBeneficiariesTPTApiResource { private final PlatformSecurityContext context; @@ -93,10 +93,10 @@ public class SelfBeneficiariesTPTApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Beneficiary Third Party Transfer Template", httpMethod = "GET", notes = "Returns Account Type enumerations. Self User is expected to know office name and account number to be able to add beneficiary.\n" + @Operation(summary = "Beneficiary Third Party Transfer Template", description = "Returns Account Type enumerations. Self User is expected to know office name and account number to be able to add beneficiary.\n" + "\n" + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt/template") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfBeneficiariesTPTApiResourceSwagger.GetSelfBeneficiariesTPTTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.GetSelfBeneficiariesTPTTemplateResponse.class))) }) public String template(@Context final UriInfo uriInfo) { final EnumOptionData loanAccountType = AccountTransferEnumerations.accountType(PortfolioAccountType.LOAN); @@ -113,17 +113,16 @@ public class SelfBeneficiariesTPTApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Add TPT Beneficiary", httpMethod = "POST", notes = "Api to add third party beneficiary linked to current user.\n" - + "\n" + "Parameter Definitions\n" + "\n" + "name : Nick name for beneficiary, should be unique for an self service user\n" - + "\n" + "officeName : Office Name of beneficiary(not id)\n" + "\n" + "accountNumber : Account Number of beneficiary(not id)\n" - + "\n" + "transferLimit : Each transfer initiated to this account will not exceed this amount\n" + "\n" + "Example Requests:\n" - + "\n" + "/self/beneficiaries/tpt\n\n" + "Mandatory Fields: name, officeName, accountNumber, accountType\n\n" + @Operation(summary = "Add TPT Beneficiary", description = "Api to add third party beneficiary linked to current user.\n" + "\n" + + "Parameter Definitions\n" + "\n" + "name : Nick name for beneficiary, should be unique for an self service user\n" + "\n" + + "officeName : Office Name of beneficiary(not id)\n" + "\n" + "accountNumber : Account Number of beneficiary(not id)\n" + "\n" + + "transferLimit : Each transfer initiated to this account will not exceed this amount\n" + "\n" + "Example Requests:\n" + "\n" + + "/self/beneficiaries/tpt\n\n" + "Mandatory Fields: name, officeName, accountNumber, accountType\n\n" + "Optional Fields: transferLimit") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfBeneficiariesTPTApiResourceSwagger.PostSelfBeneficiariesTPTRequest.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.PostSelfBeneficiariesTPTRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfBeneficiariesTPTApiResourceSwagger.PostSelfBeneficiariesTPTResponse.class) }) - public String add(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.PostSelfBeneficiariesTPTResponse.class))) }) + public String add(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().addSelfServiceBeneficiaryTPT().withJson(apiRequestBodyAsJson) .build(); @@ -135,14 +134,13 @@ public class SelfBeneficiariesTPTApiResource { @Path("{beneficiaryId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update TPT Beneficiary", httpMethod = "PUT", notes = "Api to update third party beneficiary linked to current user.\n" - + "\n" + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt/{beneficiaryId}\n\n" + "Optional Fields: name, transferLimit") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfBeneficiariesTPTApiResourceSwagger.PutSelfBeneficiariesTPTBeneficiaryIdRequest.class) }) + @Operation(summary = "Update TPT Beneficiary", description = "Api to update third party beneficiary linked to current user.\n" + "\n" + + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt/{beneficiaryId}\n\n" + "Optional Fields: name, transferLimit") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.PutSelfBeneficiariesTPTBeneficiaryIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfBeneficiariesTPTApiResourceSwagger.PutSelfBeneficiariesTPTBeneficiaryIdResponse.class) }) - public String update(@PathParam("beneficiaryId") @ApiParam(value = "beneficiaryId") final Long beneficiaryId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.PutSelfBeneficiariesTPTBeneficiaryIdResponse.class))) }) + public String update(@PathParam("beneficiaryId") @Parameter(description = "beneficiaryId") final Long beneficiaryId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSelfServiceBeneficiaryTPT(beneficiaryId) .withJson(apiRequestBodyAsJson).build(); @@ -154,11 +152,12 @@ public class SelfBeneficiariesTPTApiResource { @Path("{beneficiaryId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete TPT Beneficiary", httpMethod = "DELETE", notes = "Api to delete third party beneficiary linked to current user.\n" - + "\n" + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt/{beneficiaryId}") + @Operation(summary = "Delete TPT Beneficiary", description = "Api to delete third party beneficiary linked to current user.\n" + "\n" + + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt/{beneficiaryId}") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfBeneficiariesTPTApiResourceSwagger.DeleteSelfBeneficiariesTPTBeneficiaryIdResponse.class) }) - public String delete(@PathParam("beneficiaryId") final Long beneficiaryId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.DeleteSelfBeneficiariesTPTBeneficiaryIdResponse.class))) }) + public String delete(@PathParam("beneficiaryId") final Long beneficiaryId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSelfServiceBeneficiaryTPT(beneficiaryId) .withJson(apiRequestBodyAsJson).build(); @@ -169,10 +168,10 @@ public class SelfBeneficiariesTPTApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Get All TPT Beneficiary", httpMethod = "GET", notes = "Api to get all third party beneficiary linked to current user.\n" - + "\n" + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt") + @Operation(summary = "Get All TPT Beneficiary", description = "Api to get all third party beneficiary linked to current user.\n" + "\n" + + "Example Requests:\n" + "\n" + "/self/beneficiaries/tpt") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfBeneficiariesTPTApiResourceSwagger.GetSelfBeneficiariesTPTResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfBeneficiariesTPTApiResourceSwagger.GetSelfBeneficiariesTPTResponse.class)))) }) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(SelfBeneficiariesTPTApiConstants.BENEFICIARY_ENTITY_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResourceSwagger.java index 7ed1ab0e9..279b65f54 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.account.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -29,7 +28,7 @@ final class SelfBeneficiariesTPTApiResourceSwagger { private SelfBeneficiariesTPTApiResourceSwagger() {} - @ApiModel(value = "GetSelfBeneficiariesTPTTemplateResponse") + @Schema(description = "GetSelfBeneficiariesTPTTemplateResponse") public static final class GetSelfBeneficiariesTPTTemplateResponse { private GetSelfBeneficiariesTPTTemplateResponse() {} @@ -38,57 +37,57 @@ final class SelfBeneficiariesTPTApiResourceSwagger { private GetSelfBeneficiariesAccountOptions() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.savings") + @Schema(example = "accountType.savings") public String code; - @ApiModelProperty(example = "Savings Account") - public String value; + @Schema(example = "Savings Account") + public String description; } public Set accountTypeOptions; } - @ApiModel(value = "PostSelfBeneficiariesTPTRequest") + @Schema(description = "PostSelfBeneficiariesTPTRequest") public static final class PostSelfBeneficiariesTPTRequest { private PostSelfBeneficiariesTPTRequest() {} - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "beneficiary nick name") + @Schema(example = "beneficiary nick name") public String name; - @ApiModelProperty(example = "HEAD OFFICE") + @Schema(example = "HEAD OFFICE") public String officeName; - @ApiModelProperty(example = "0000001") + @Schema(example = "0000001") public Long accountNumber; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountType; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer transferLimit; } - @ApiModel(value = "PostSelfBeneficiariesTPTResponse") + @Schema(description = "PostSelfBeneficiariesTPTResponse") public static final class PostSelfBeneficiariesTPTResponse { private PostSelfBeneficiariesTPTResponse() {} - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer resourceId; } - @ApiModel(value = "PutSelfBeneficiariesTPTBeneficiaryIdRequest") + @Schema(description = "PutSelfBeneficiariesTPTBeneficiaryIdRequest") public static final class PutSelfBeneficiariesTPTBeneficiaryIdRequest { private PutSelfBeneficiariesTPTBeneficiaryIdRequest() {} - @ApiModelProperty(example = "beneficiary nick name") + @Schema(example = "beneficiary nick name") public String name; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer transferLimit; } - @ApiModel(value = "PutSelfBeneficiariesTPTBeneficiaryIdResponse") + @Schema(description = "PutSelfBeneficiariesTPTBeneficiaryIdResponse") public static final class PutSelfBeneficiariesTPTBeneficiaryIdResponse { private PutSelfBeneficiariesTPTBeneficiaryIdResponse() {} @@ -97,43 +96,43 @@ final class SelfBeneficiariesTPTApiResourceSwagger { private PutSelfBeneficiariesChanges() {} - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer transferLimit; - @ApiModelProperty(example = "Client22") + @Schema(example = "Client22") public String name; } - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer resourceId; public PutSelfBeneficiariesChanges changes; } - @ApiModel(value = "DeleteSelfBeneficiariesTPTBeneficiaryIdResponse") + @Schema(description = "DeleteSelfBeneficiariesTPTBeneficiaryIdResponse") public static final class DeleteSelfBeneficiariesTPTBeneficiaryIdResponse { private DeleteSelfBeneficiariesTPTBeneficiaryIdResponse() {} - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer resourceId; } - @ApiModel(value = "GetSelfBeneficiariesTPTResponse") + @Schema(description = "GetSelfBeneficiariesTPTResponse") public static final class GetSelfBeneficiariesTPTResponse { private GetSelfBeneficiariesTPTResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Client2Savings") + @Schema(example = "Client2Savings") public String name; - @ApiModelProperty(example = "Test Office") + @Schema(example = "Test Office") public String officeName; - @ApiModelProperty(example = "FN2 LN2") + @Schema(example = "FN2 LN2") public String clientName; public GetSelfBeneficiariesTPTTemplateResponse.GetSelfBeneficiariesAccountOptions accountType; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Long accountNumber; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer transferLimit; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java index 49744f916..a7efcbdbd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java @@ -21,13 +21,13 @@ package org.apache.fineract.portfolio.self.client.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataBodyPart; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 java.io.InputStream; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -60,8 +60,8 @@ import org.springframework.stereotype.Component; @Path("/self/clients") @Component @Scope("singleton") -@Api(tags = { "Self Client" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Client", description = "") }) + +@Tag(name = "Self Client", description = "") public class SelfClientsApiResource { private final PlatformSecurityContext context; @@ -89,18 +89,19 @@ public class SelfClientsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Clients associated to the user", httpMethod = "GET", notes = "The list capability of clients can support pagination and sorting.\n\n" + @Operation(summary = "List Clients associated to the user", description = "The list capability of clients can support pagination and sorting.\n\n" + "Example Requests:\n" + "\n" + "self/clients\n" + "\n" + "self/clients?fields=displayName,officeName\n" + "\n" + "self/clients?offset=10&limit=50\n" + "\n" + "self/clients?orderBy=displayName&sortOrder=DESC") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("displayName") @ApiParam(value = "displayName") final String displayName, - @QueryParam("firstName") @ApiParam(value = "firstName") final String firstname, - @QueryParam("lastName") @ApiParam(value = "lastName") final String lastname, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, - @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) { + @QueryParam("displayName") @Parameter(description = "displayName") final String displayName, + @QueryParam("firstName") @Parameter(description = "firstName") final String firstname, + @QueryParam("lastName") @Parameter(description = "lastName") final String lastname, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) { final String sqlSearch = null; final Long officeId = null; @@ -115,11 +116,12 @@ public class SelfClientsApiResource { @Path("{clientId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client", httpMethod = "GET", notes = "Retrieves a Client\n\n" + "Example Requests:\n" + "\n" - + "self/clients/1\n" + "\n" + "self/clients/1?fields=id,displayName,officeName") + @Operation(summary = "Retrieve a Client", description = "Retrieves a Client\n\n" + "Example Requests:\n" + "\n" + "self/clients/1\n" + + "\n" + "self/clients/1?fields=id,displayName,officeName") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsClientIdResponse.class) }) - public String retrieveOne(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsClientIdResponse.class))) }) + public String retrieveOne(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @Context final UriInfo uriInfo) { this.dataValidator.validateRetrieveOne(uriInfo); @@ -133,12 +135,12 @@ public class SelfClientsApiResource { @Path("{clientId}/accounts") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve client accounts overview", httpMethod = "GET", notes = "An example of how a loan portfolio summary can be provided. This is requested in a specific use case of the community application.\n" + @Operation(summary = "Retrieve client accounts overview", description = "An example of how a loan portfolio summary can be provided. This is requested in a specific use case of the community application.\n" + "It is quite reasonable to add resources like this to simplify User Interface development.\n" + "\n" + "Example Requests:\n" + "\n" + "self/clients/1/accounts\n" + "\n" + "\n" + "self/clients/1/accounts?fields=loanAccounts,savingsAccounts") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsClientIdAccountsResponse.class) }) - public String retrieveAssociatedAccounts(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsClientIdAccountsResponse.class))) }) + public String retrieveAssociatedAccounts(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, @Context final UriInfo uriInfo) { validateAppuserClientsMapping(clientId); @@ -150,13 +152,13 @@ public class SelfClientsApiResource { @Path("{clientId}/images") @Consumes({ MediaType.TEXT_PLAIN, MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) - @ApiOperation(value = "Retrieve Client Image", httpMethod = "GET", notes = "Optional arguments are identical to those of Get Image associated with an Entity (Binary file)\n" + @Operation(summary = "Retrieve Client Image", description = "Optional arguments are identical to those of Get Image associated with an Entity (Binary file)\n" + "\n" + "Example Requests:\n" + "\n" + "self/clients/1/images") - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) - public Response retrieveImage(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("maxWidth") @ApiParam(example = "maxWidth") final Integer maxWidth, - @QueryParam("maxHeight") @ApiParam(example = "maxHeight") final Integer maxHeight, - @QueryParam("output") @ApiParam(example = "output") final String output) { + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) + public Response retrieveImage(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("maxWidth") @Parameter(example = "maxWidth") final Integer maxWidth, + @QueryParam("maxHeight") @Parameter(example = "maxHeight") final Integer maxHeight, + @QueryParam("output") @Parameter(example = "output") final String output) { validateAppuserClientsMapping(clientId); @@ -167,15 +169,15 @@ public class SelfClientsApiResource { @Path("{clientId}/charges") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Client Charges", httpMethod = "GET", notes = "The list capability of client charges supports pagination.\n\n" + @Operation(summary = "List Client Charges", description = "The list capability of client charges supports pagination.\n\n" + "Example Requests:\n" + "\n" + "self/clients/1/charges\n\n" + "self/clients/1/charges?offset=0&limit=5") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsClientIdChargesResponse.class) }) - public String retrieveAllClientCharges(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @DefaultValue(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS_VALUE_ALL) @QueryParam(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS) @ApiParam(value = "chargeStatus") final String chargeStatus, - @QueryParam("pendingPayment") @ApiParam(value = "pendingPayment") final Boolean pendingPayment, @Context final UriInfo uriInfo, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit, - @QueryParam("offset") @ApiParam(value = "offset") final Integer offset) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsClientIdChargesResponse.class))) }) + public String retrieveAllClientCharges(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @DefaultValue(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS_VALUE_ALL) @QueryParam(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS) @Parameter(description = "chargeStatus") final String chargeStatus, + @QueryParam("pendingPayment") @Parameter(description = "pendingPayment") final Boolean pendingPayment, + @Context final UriInfo uriInfo, @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset) { validateAppuserClientsMapping(clientId); @@ -186,12 +188,12 @@ public class SelfClientsApiResource { @Path("{clientId}/charges/{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client Charge", httpMethod = "GET", notes = "Retrieves a Client Charge\n\n" + "Example Requests:\n" - + "\n" + "self/clients/1/charges/1\n" + "\n" + "\n" + "self/clients/1/charges/1?fields=name,id") + @Operation(summary = "Retrieve a Client Charge", description = "Retrieves a Client Charge\n\n" + "Example Requests:\n" + "\n" + + "self/clients/1/charges/1\n" + "\n" + "\n" + "self/clients/1/charges/1?fields=name,id") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsClientIdChargesChargeIdResponse.class) }) - public String retrieveClientCharge(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long chargeId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsClientIdChargesChargeIdResponse.class))) }) + public String retrieveClientCharge(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long chargeId, @Context final UriInfo uriInfo) { this.dataValidator.validateClientCharges(uriInfo); @@ -204,13 +206,13 @@ public class SelfClientsApiResource { @Path("{clientId}/transactions") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Client Transactions", httpMethod = "GET", notes = "The list capability of client transaction can support pagination.\n\n" + @Operation(summary = "List Client Transactions", description = "The list capability of client transaction can support pagination.\n\n" + "Example Requests:\n" + "\n" + "self/clients/189/transactions\n\n" + "self/clients/189/transactions?offset=10&limit=50") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsClientIdTransactionsResponse.class) }) - public String retrieveAllClientTransactions(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @Context final UriInfo uriInfo, @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, - @QueryParam("limit") @ApiParam(value = "limit") final Integer limit) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsClientIdTransactionsResponse.class))) }) + public String retrieveAllClientTransactions(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @Context final UriInfo uriInfo, @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit) { validateAppuserClientsMapping(clientId); @@ -221,13 +223,13 @@ public class SelfClientsApiResource { @Path("{clientId}/transactions/{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Client Transaction", httpMethod = "GET", notes = "Retrieves a Client Transaction" - + "Example Requests:\n" + "\n" + "self/clients/1/transactions/1\n" + "\n" + "\n" - + "self/clients/1/transactions/1?fields=id,officeName") + @Operation(summary = "Retrieve a Client Transaction", description = "Retrieves a Client Transaction" + "Example Requests:\n" + "\n" + + "self/clients/1/transactions/1\n" + "\n" + "\n" + "self/clients/1/transactions/1?fields=id,officeName") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfClientsApiResourceSwagger.GetSelfClientsClientIdTransactionsTransactionIdResponse.class) }) - public String retrieveClientTransaction(@PathParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfClientsApiResourceSwagger.GetSelfClientsClientIdTransactionsTransactionIdResponse.class))) }) + public String retrieveClientTransaction(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Context final UriInfo uriInfo) { validateAppuserClientsMapping(clientId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResourceSwagger.java index ff207cf6c..948b00222 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.client.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.List; import java.util.Set; @@ -32,7 +31,7 @@ final class SelfClientsApiResourceSwagger { private SelfClientsApiResourceSwagger() {} - @ApiModel(value = "GetSelfClientsResponse") + @Schema(description = "GetSelfClientsResponse") public static final class GetSelfClientsResponse { private GetSelfClientsResponse() {} @@ -45,39 +44,39 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "clientStatusType.active") + @Schema(example = "clientStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; + @Schema(example = "Active") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; public GetSelfClientsStatus status; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "[2013, 3, 1]") + @Schema(example = "[2013, 3, 1]") public LocalDate activationDate; - @ApiModelProperty(example = "Small shop") + @Schema(example = "Small shop") public String fullname; - @ApiModelProperty(example = "Small shop") + @Schema(example = "Small shop") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetSelfClientsClientIdResponse") + @Schema(description = "GetSelfClientsClientIdResponse") public static final class GetSelfClientsClientIdResponse { private GetSelfClientsClientIdResponse() {} @@ -86,54 +85,54 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsTimeline() {} - @ApiModelProperty(example = "[2013, 1, 1]") + @Schema(example = "[2013, 1, 1]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; - @ApiModelProperty(example = "[2013, 1, 1]") + @Schema(example = "[2013, 1, 1]") public LocalDate activatedOnDate; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String activatedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String activatedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String activatedByLastname; } - @ApiModelProperty(example = "27") + @Schema(example = "27") public Integer id; - @ApiModelProperty(example = "000000027") + @Schema(example = "000000027") public Long accountNo; public GetSelfClientsResponse.GetSelfClientsPageItems.GetSelfClientsStatus status; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "[2013, 1, 1]") + @Schema(example = "[2013, 1, 1]") public LocalDate activationDate; - @ApiModelProperty(example = "savings") + @Schema(example = "savings") public String firstname; - @ApiModelProperty(example = "test") + @Schema(example = "test") public String lastname; - @ApiModelProperty(example = "savings test") + @Schema(example = "savings test") public String displayName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetSelfClientsTimeline timeline; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer savingsProductId; - @ApiModelProperty(example = "account overdraft") + @Schema(example = "account overdraft") public String savingsProductName; - @ApiModelProperty(example = "") + @Schema(example = "") public List groups; } - @ApiModel(value = "GetSelfClientsClientIdAccountsResponse") + @Schema(description = "GetSelfClientsClientIdAccountsResponse") public static final class GetSelfClientsClientIdAccountsResponse { private GetSelfClientsClientIdAccountsResponse() {} @@ -146,27 +145,27 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsLoanAccountsStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "loanStatusType.active") + @Schema(example = "loanStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Active") + public String description; + @Schema(example = "false") public Boolean pendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } @@ -174,27 +173,27 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsLoanAccountsType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "loanType.individual") + @Schema(example = "loanType.individual") public String code; - @ApiModelProperty(example = "Individual") - public String value; + @Schema(example = "Individual") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "456") + @Schema(example = "456") public Integer externalId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "TestOne") + @Schema(example = "TestOne") public String productName; public GetSelfClientsLoanAccountsStatus status; public GetSelfClientsLoanAccountsType loanType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanCycle; } @@ -206,17 +205,17 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsSavingsAccountsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -224,33 +223,33 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsSavingsAccountsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer id; - @ApiModelProperty(example = "000000007") + @Schema(example = "000000007") public Long accountNo; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer productId; - @ApiModelProperty(example = "Other product") + @Schema(example = "Other product") public String productName; public GetSelfClientsSavingsAccountsStatus status; public GetSelfClientsSavingsAccountsCurrency currency; @@ -260,7 +259,7 @@ final class SelfClientsApiResourceSwagger { public Set savingsAccounts; } - @ApiModel(value = "GetSelfClientsClientIdChargesResponse") + @Schema(description = "GetSelfClientsClientIdChargesResponse") public static final class GetSelfClientsClientIdChargesResponse { private GetSelfClientsClientIdChargesResponse() {} @@ -273,103 +272,103 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsChargeTimeType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetSelfClientsChargeCalculationType { private GetSelfClientsChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer chargeId; - @ApiModelProperty(example = "Client Fees 2") + @Schema(example = "Client Fees 2") public String name; public GetSelfClientsChargeTimeType chargeTimeType; - @ApiModelProperty(example = "[2015, 9, 1]") + @Schema(example = "[2015, 9, 1]") public LocalDate dueDate; public GetSelfClientsChargeCalculationType chargeCalculationType; public GetSelfClientsClientIdAccountsResponse.GetSelfClientsSavingsAccounts.GetSelfClientsSavingsAccountsCurrency currency; - @ApiModelProperty(example = "550") + @Schema(example = "550") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "550") + @Schema(example = "550") public Float amountOutstanding; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isPaid; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isWaived; } - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetSelfClientsClientIdChargesChargeIdResponse") + @Schema(description = "GetSelfClientsClientIdChargesChargeIdResponse") public static final class GetSelfClientsClientIdChargesChargeIdResponse { private GetSelfClientsClientIdChargesChargeIdResponse() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Integer chargeId; - @ApiModelProperty(example = "Client Fee 1") + @Schema(example = "Client Fee 1") public String name; public GetSelfClientsClientIdChargesResponse.GetSelfClientsChargesPageItems.GetSelfClientsChargeTimeType chargeTimeType; - @ApiModelProperty(example = "[2015, 8, 17]") + @Schema(example = "[2015, 8, 17]") public LocalDate dueDate; public GetSelfClientsClientIdChargesResponse.GetSelfClientsChargesPageItems.GetSelfClientsChargeCalculationType chargeCalculationType; public GetSelfClientsClientIdAccountsResponse.GetSelfClientsSavingsAccounts.GetSelfClientsSavingsAccountsCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountOutstanding; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isActive; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isPaid; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isWaived; } - @ApiModel(value = "GetSelfClientsClientIdTransactionsResponse") + @Schema(description = "GetSelfClientsClientIdTransactionsResponse") public static final class GetSelfClientsClientIdTransactionsResponse { private GetSelfClientsClientIdTransactionsResponse() {} @@ -382,57 +381,57 @@ final class SelfClientsApiResourceSwagger { private GetSelfClientsClientIdTransactionsType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "clientTransactionType.payCharge") + @Schema(example = "clientTransactionType.payCharge") public String code; - @ApiModelProperty(example = "PAY_CHARGE") - public String value; + @Schema(example = "PAY_CHARGE") + public String description; } - @ApiModelProperty(example = "226") + @Schema(example = "226") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetSelfClientsClientIdTransactionsType type; - @ApiModelProperty(example = "[2015, 9, 2]") + @Schema(example = "[2015, 9, 2]") public LocalDate date; public GetSelfClientsClientIdAccountsResponse.GetSelfClientsSavingsAccounts.GetSelfClientsSavingsAccountsCurrency currency; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Double amount; - @ApiModelProperty(example = "[2015, 9, 2]") + @Schema(example = "[2015, 9, 2]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean reversed; } - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer totalFilteredRecords; public Set pageItems; } - @ApiModel(value = "GetSelfClientsClientIdTransactionsTransactionIdResponse") + @Schema(description = "GetSelfClientsClientIdTransactionsTransactionIdResponse") public static final class GetSelfClientsClientIdTransactionsTransactionIdResponse { private GetSelfClientsClientIdTransactionsTransactionIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; public GetSelfClientsClientIdTransactionsResponse.GetSelfClientsClientIdTransactionsPageItems.GetSelfClientsClientIdTransactionsType type; - @ApiModelProperty(example = "[2015, 8, 17]") + @Schema(example = "[2015, 8, 17]") public LocalDate date; public GetSelfClientsClientIdAccountsResponse.GetSelfClientsSavingsAccounts.GetSelfClientsSavingsAccountsCurrency currency; - @ApiModelProperty(example = "60.000000") + @Schema(example = "60.000000") public Float amount; - @ApiModelProperty(example = "[2015, 8, 19]") + @Schema(example = "[2015, 8, 19]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean reversed; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java index c8b380a0b..a601b003f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.self.loanaccount.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.HashMap; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -61,8 +61,8 @@ import org.springframework.stereotype.Component; @Path("/self/loans") @Component @Scope("singleton") -@Api(tags = { "Self Loans" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Loans", description = "") }) + +@Tag(name = "Self Loans", description = "") public class SelfLoansApiResource { private final PlatformSecurityContext context; @@ -94,11 +94,12 @@ public class SelfLoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Loan", httpMethod = "GET", notes = "Retrieves a Loan\n\n" + "Example Requests:\n" + "\n" - + "self/loans/1\n" + "\n" + "\n" + "self/loans/1?fields=id,principal,annualInterestRate\n" + "\n" + "\n" + @Operation(summary = "Retrieve a Loan", description = "Retrieves a Loan\n\n" + "Example Requests:\n" + "\n" + "self/loans/1\n" + "\n" + + "\n" + "self/loans/1?fields=id,principal,annualInterestRate\n" + "\n" + "\n" + "self/loans/1?fields=id,principal,annualInterestRate&associations=repaymentSchedule,transactions") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdResponse.class) }) - public String retrieveLoan(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdResponse.class))) }) + public String retrieveLoan(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, @Context final UriInfo uriInfo) { this.dataValidator.validateRetrieveLoan(uriInfo); @@ -112,12 +113,13 @@ public class SelfLoansApiResource { @Path("{loanId}/transactions/{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Loan Transaction Details", httpMethod = "GET", notes = "Retrieves a Loan Transaction Details" - + "Example Request:\n" + "\n" + "self/loans/5/transactions/3") + @Operation(summary = "Retrieve a Loan Transaction Details", description = "Retrieves a Loan Transaction Details" + "Example Request:\n" + + "\n" + "self/loans/5/transactions/3") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdTransactionsTransactionIdResponse.class) }) - public String retrieveTransaction(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdTransactionsTransactionIdResponse.class))) }) + public String retrieveTransaction(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Context final UriInfo uriInfo) { this.dataValidator.validateRetrieveTransaction(uriInfo); @@ -130,11 +132,11 @@ public class SelfLoansApiResource { @Path("{loanId}/charges") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Loan Charges", httpMethod = "GET", notes = "Lists loan Charges\n\n" + "Example Requests:\n" + "\n" + @Operation(summary = "List Loan Charges", description = "Lists loan Charges\n\n" + "Example Requests:\n" + "\n" + "self/loans/1/charges\n" + "\n" + "\n" + "self/loans/1/charges?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdChargesResponse.class, responseContainer = "List") }) - public String retrieveAllLoanCharges(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdChargesResponse.class)))) }) + public String retrieveAllLoanCharges(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, @Context final UriInfo uriInfo) { validateAppuserLoanMapping(loanId); @@ -146,12 +148,12 @@ public class SelfLoansApiResource { @Path("{loanId}/charges/{chargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Loan Charge", httpMethod = "GET", notes = "Retrieves a Loan Charge\n\n" + "Example Requests:\n" + "\n" + @Operation(summary = "Retrieve a Loan Charge", description = "Retrieves a Loan Charge\n\n" + "Example Requests:\n" + "\n" + "self/loans/1/charges/1\n" + "\n" + "\n" + "self/loans/1/charges/1?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdChargesResponse.class) }) - public String retrieveLoanCharge(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @PathParam("chargeId") @ApiParam(value = "chargeId") final Long loanChargeId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.GetSelfLoansLoanIdChargesResponse.class))) }) + public String retrieveLoanCharge(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @PathParam("chargeId") @Parameter(description = "chargeId") final Long loanChargeId, @Context final UriInfo uriInfo) { validateAppuserLoanMapping(loanId); @@ -162,15 +164,17 @@ public class SelfLoansApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Loan Details Template", httpMethod = "GET", notes = "Retrieves Loan Details Template\n\n" + @Operation(summary = "Retrieve Loan Details Template", description = "Retrieves Loan Details Template\n\n" + "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n\n" + "Example Requests:\n" + "\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n\n" + "Example Requests:\n" + "\n" + "self/loans/template?templateType=individual&clientId=1\n" + "\n" + "\n" + "self/loans/template?templateType=individual&clientId=1&productId=1") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.GetSelfLoansTemplateResponse.class) }) - public String template(@QueryParam("clientId") @ApiParam(value = "clientId") final Long clientId, - @QueryParam("productId") @ApiParam(value = "productId") final Long productId, - @QueryParam("templateType") @ApiParam(value = "templateType") final String templateType, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.GetSelfLoansTemplateResponse.class))) }) + public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, + @Context final UriInfo uriInfo) { if (clientId != null) { validateAppuserClientsMapping(clientId); @@ -193,7 +197,7 @@ public class SelfLoansApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Calculate Loan Repayment Schedule | Submit a new Loan Application", httpMethod = "POST", notes = "Calculate Loan Repayment Schedule:\n\n" + @Operation(summary = "Calculate Loan Repayment Schedule | Submit a new Loan Application", description = "Calculate Loan Repayment Schedule:\n\n" + "Calculates Loan Repayment Schedule\n\n" + "Mandatory Fields: productId, principal, loanTermFrequency, loanTermFrequencyType, numberOfRepayments, repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, amortizationType, interestType, interestCalculationPeriodType, expectedDisbursementDate, transactionProcessingStrategyId\n\n" + "Submit a new Loan Application:\n\n" @@ -203,12 +207,12 @@ public class SelfLoansApiResource { + "Additional Mandatory Field if Entity-Datatable Check is enabled for the entity of type loan: datatables\n\n" + "Optional Fields: graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, linkAccountId, allowPartialPeriodInterestCalcualtion, fixedEmiAmount, maxOutstandingLoanBalance, disbursementData, graceOnArrearsAgeing, createStandingInstructionAtDisbursement (requires linkedAccountId if set to true)\n\n" + "Showing request/response for 'Submit a new Loan Application'") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfLoansApiResourceSwagger.PostSelfLoansRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.PostSelfLoansResponse.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.PostSelfLoansRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.PostSelfLoansResponse.class))) }) public String calculateLoanScheduleOrSubmitLoanApplication( - @QueryParam("command") @ApiParam(value = "command") final String commandParam, @Context final UriInfo uriInfo, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { HashMap attr = this.dataValidator.validateLoanApplication(apiRequestBodyAsJson); final Long clientId = (Long) attr.get("clientId"); @@ -221,12 +225,12 @@ public class SelfLoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Loan Application", httpMethod = "PUT", notes = "Loan application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfLoansApiResourceSwagger.PutSelfLoansLoanIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.PutSelfLoansLoanIdResponse.class) }) - public String modifyLoanApplication(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Loan Application", description = "Loan application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.PutSelfLoansLoanIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.PutSelfLoansLoanIdResponse.class))) }) + public String modifyLoanApplication(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { HashMap attr = this.dataValidator.validateModifyLoanApplication(apiRequestBodyAsJson); validateAppuserLoanMapping(loanId); @@ -242,14 +246,14 @@ public class SelfLoansApiResource { @Path("{loanId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Applicant Withdraws from Loan Application", httpMethod = "POST", notes = "Applicant Withdraws from Loan Application\n\n" + @Operation(summary = "Applicant Withdraws from Loan Application", description = "Applicant Withdraws from Loan Application\n\n" + "Mandatory Fields: withdrawnOnDate") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfLoansApiResourceSwagger.PostSelfLoansLoanIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfLoansApiResourceSwagger.PostSelfLoansLoanIdResponse.class) }) - public String stateTransitions(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.PostSelfLoansLoanIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfLoansApiResourceSwagger.PostSelfLoansLoanIdResponse.class))) }) + public String stateTransitions(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { if (!is(commandParam, "withdrawnByApplicant")) { throw new UnrecognizedQueryParamException("command", commandParam); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResourceSwagger.java index db783273f..b15a02214 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.loanaccount.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class SelfLoansApiResourceSwagger { private SelfLoansApiResourceSwagger() {} - @ApiModel(value = "GetSelfLoansLoanIdResponse") + @Schema(description = "GetSelfLoansLoanIdResponse") public static final class GetSelfLoansLoanIdResponse { private GetSelfLoansLoanIdResponse() {} @@ -39,27 +38,27 @@ final class SelfLoansApiResourceSwagger { private GetLoansLoanIdStatus() {} - @ApiModelProperty(example = "300") + @Schema(example = "300") public Integer id; - @ApiModelProperty(example = "loanStatusType.active") + @Schema(example = "loanStatusType.active") public String code; - @ApiModelProperty(example = "Active") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Active") + public String description; + @Schema(example = "false") public Boolean pendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } @@ -67,29 +66,29 @@ final class SelfLoansApiResourceSwagger { private GetLoansLoanIdLoanType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "loanType.individual") + @Schema(example = "loanType.individual") public String code; - @ApiModelProperty(example = "Individual") - public String value; + @Schema(example = "Individual") + public String description; } static final class GetLoansLoanIdCurrency { private GetLoansLoanIdCurrency() {} - @ApiModelProperty(example = "UGX") + @Schema(example = "UGX") public String code; - @ApiModelProperty(example = "Uganda Shilling") + @Schema(example = "Uganda Shilling") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "USh") + @Schema(example = "USh") public String displaySymbol; - @ApiModelProperty(example = "currency.UGX") + @Schema(example = "currency.UGX") public String nameCode; - @ApiModelProperty(example = "Uganda Shilling (USh)") + @Schema(example = "Uganda Shilling (USh)") public String displayLabel; } @@ -97,105 +96,105 @@ final class SelfLoansApiResourceSwagger { private GetLoansLoanIdTermPeriodFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "termFrequency.periodFrequencyType.months") + @Schema(example = "termFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetLoansLoanIdRepaymentFrequencyType { private GetLoansLoanIdRepaymentFrequencyType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "repaymentFrequency.periodFrequencyType.months") + @Schema(example = "repaymentFrequency.periodFrequencyType.months") public String code; - @ApiModelProperty(example = "Months") - public String value; + @Schema(example = "Months") + public String description; } static final class GetLoansLoanIdInterestRateFrequencyType { private GetLoansLoanIdInterestRateFrequencyType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "interestRateFrequency.periodFrequencyType.years") + @Schema(example = "interestRateFrequency.periodFrequencyType.years") public String code; - @ApiModelProperty(example = "Per year") - public String value; + @Schema(example = "Per year") + public String description; } static final class GetLoansLoanIdAmortizationType { private GetLoansLoanIdAmortizationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "amortizationType.equal.installments") + @Schema(example = "amortizationType.equal.installments") public String code; - @ApiModelProperty(example = "Equal installments") - public String value; + @Schema(example = "Equal installments") + public String description; } static final class GetLoansLoanIdInterestType { private GetLoansLoanIdInterestType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestType.flat") + @Schema(example = "interestType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetLoansLoanIdInterestCalculationPeriodType { private GetLoansLoanIdInterestCalculationPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "interestCalculationPeriodType.same.as.repayment.period") + @Schema(example = "interestCalculationPeriodType.same.as.repayment.period") public String code; - @ApiModelProperty(example = "Same as repayment period") - public String value; + @Schema(example = "Same as repayment period") + public String description; } static final class GetLoansLoanIdTimeline { private GetLoansLoanIdTimeline() {} - @ApiModelProperty(example = "[2012, 4, 3]") + @Schema(example = "[2012, 4, 3]") public LocalDate submittedOnDate; - @ApiModelProperty(example = "admin") + @Schema(example = "admin") public String submittedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String submittedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String submittedByLastname; - @ApiModelProperty(example = "[2012, 4, 3]") + @Schema(example = "[2012, 4, 3]") public LocalDate approvedOnDate; - @ApiModelProperty(example = "admin") + @Schema(example = "admin") public String approvedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String approvedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String approvedByLastname; - @ApiModelProperty(example = "[2012, 4, 10]") + @Schema(example = "[2012, 4, 10]") public LocalDate expectedDisbursementDate; - @ApiModelProperty(example = "[2012, 4, 10]") + @Schema(example = "[2012, 4, 10]") public LocalDate actualDisbursementDate; - @ApiModelProperty(example = "admin") + @Schema(example = "admin") public String disbursedByUsername; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String disbursedByFirstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String disbursedByLastname; - @ApiModelProperty(example = "[2012, 4, 10]") + @Schema(example = "[2012, 4, 10]") public LocalDate expectedMaturityDate; } @@ -212,9 +211,9 @@ final class SelfLoansApiResourceSwagger { private GetLoansLoanIdLinkedAccount() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; } @@ -222,13 +221,13 @@ final class SelfLoansApiResourceSwagger { private GetLoansLoanIdDisbursementDetails() {} - @ApiModelProperty(example = "71") + @Schema(example = "71") public Integer id; - @ApiModelProperty(example = "[2013, 11, 1]") + @Schema(example = "[2013, 11, 1]") public LocalDate expectedDisbursementDate; - @ApiModelProperty(example = "22000.000000") + @Schema(example = "22000.000000") public Float principal; - @ApiModelProperty(example = "22000.000000") + @Schema(example = "22000.000000") public Float approvedPrincipal; } @@ -240,65 +239,65 @@ final class SelfLoansApiResourceSwagger { private GetLoansLoanIdChargeTimeType() {} - @ApiModelProperty(example = "9") + @Schema(example = "9") public Integer id; - @ApiModelProperty(example = "chargeTimeType.overdueInstallment") + @Schema(example = "chargeTimeType.overdueInstallment") public String code; - @ApiModelProperty(example = "overdue fees") - public String value; + @Schema(example = "overdue fees") + public String description; } static final class GetLoansLoanIdChargeCalculationType { private GetLoansLoanIdChargeCalculationType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.percent.of.amount") + @Schema(example = "chargeCalculationType.percent.of.amount") public String code; - @ApiModelProperty(example = "% Amount") - public String value; + @Schema(example = "% Amount") + public String description; } static final class GetLoansLoanIdChargePaymentMode { private GetLoansLoanIdChargePaymentMode() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.regular") + @Schema(example = "chargepaymentmode.regular") public String code; - @ApiModelProperty(example = "Regular") - public String value; + @Schema(example = "Regular") + public String description; } static final class GetLoansLoanIdFeeFrequency { private GetLoansLoanIdFeeFrequency() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "feeFrequencyperiodFrequencyType.weeks") + @Schema(example = "feeFrequencyperiodFrequencyType.weeks") public String code; - @ApiModelProperty(example = "Weeks") - public String value; + @Schema(example = "Weeks") + public String description; } static final class GetLoanCurrency { private GetLoanCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -306,169 +305,169 @@ final class SelfLoansApiResourceSwagger { private GetLoanChargeTemplateChargeAppliesTo() {} - @ApiModelProperty(example = "1 ") + @Schema(example = "1 ") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.loan") + @Schema(example = "chargeAppliesTo.loan") public String code; - @ApiModelProperty(example = "Loan") - public String value; + @Schema(example = "Loan") + public String description; } - @ApiModelProperty(example = "20") + @Schema(example = "20") public Integer id; - @ApiModelProperty(example = "overdraft penality") + @Schema(example = "overdraft penality") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean penalty; public GetLoanCurrency currency; - @ApiModelProperty(example = "3.000000") + @Schema(example = "3.000000") public Float amount; public GetLoansLoanIdChargeTimeType chargeTimeType; public GetLoanChargeTemplateChargeAppliesTo chargeAppliesTo; public GetLoansLoanIdChargeCalculationType chargeCalculationType; public GetLoansLoanIdChargePaymentMode chargePaymentMode; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer feeInterval; public GetLoansLoanIdFeeFrequency feeFrequency; } public GetLoansLoanIdCurrency currency; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long principalDisbursed; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long principalPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long principalWrittenOff; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long principalOutstanding; - @ApiModelProperty(example = "833333.3") + @Schema(example = "833333.3") public Double principalOverdue; - @ApiModelProperty(example = "240000") + @Schema(example = "240000") public Long interestCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long interestPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long interestWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long interestWrittenOff; - @ApiModelProperty(example = "240000") + @Schema(example = "240000") public Long interestOutstanding; - @ApiModelProperty(example = "200000") + @Schema(example = "200000") public Long interestOverdue; - @ApiModelProperty(example = "18000") + @Schema(example = "18000") public Long feeChargesCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesDueAtDisbursementCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long feeChargesWrittenOff; - @ApiModelProperty(example = "18000") + @Schema(example = "18000") public Long feeChargesOutstanding; - @ApiModelProperty(example = "15000") + @Schema(example = "15000") public Long feeChargesOverdue; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesCharged; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesWrittenOff; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesOutstanding; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long penaltyChargesOverdue; - @ApiModelProperty(example = "1258000") + @Schema(example = "1258000") public Long totalExpectedRepayment; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalRepayment; - @ApiModelProperty(example = "258000") + @Schema(example = "258000") public Long totalExpectedCostOfLoan; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalCostOfLoan; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long totalWrittenOff; - @ApiModelProperty(example = "1258000") + @Schema(example = "1258000") public Long totalOutstanding; - @ApiModelProperty(example = "1048333.3") + @Schema(example = "1048333.3") public Double totalOverdue; - @ApiModelProperty(example = "[2012, 5, 10]") + @Schema(example = "[2012, 5, 10]") public LocalDate overdueSinceDate; public GetLoansLoanIdLinkedAccount linkedAccount; public Set disbursementDetails; - @ApiModelProperty(example = "1100.000000") + @Schema(example = "1100.000000") public Float fixedEmiAmount; - @ApiModelProperty(example = "35000") + @Schema(example = "35000") public Long maxOutstandingLoanBalance; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean canDisburse; public Set emiAmountVariations; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean inArrears; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isNPA; public Set overdueCharges; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; public GetLoansLoanIdStatus status; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Kampala first Client") + @Schema(example = "Kampala first Client") public String clientName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientOfficeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanProductId; - @ApiModelProperty(example = "Kampala Product (with cash accounting)") + @Schema(example = "Kampala Product (with cash accounting)") public String loanProductName; - @ApiModelProperty(example = "Typical Kampala loan product with cash accounting enabled for testing.") + @Schema(example = "Typical Kampala loan product with cash accounting enabled for testing.") public String loanProductDescription; - @ApiModelProperty(example = "22") + @Schema(example = "22") public Integer loanPurposeId; - @ApiModelProperty(example = "option.HousingImprovement") + @Schema(example = "option.HousingImprovement") public String loanPurposeName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer loanOfficerId; - @ApiModelProperty(example = "LoanOfficer, Kampala") + @Schema(example = "LoanOfficer, Kampala") public String loanOfficerName; public GetLoansLoanIdLoanType loanType; public GetLoansLoanIdCurrency currency; - @ApiModelProperty(example = "1000000") + @Schema(example = "1000000") public Long principal; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer termFrequency; public GetLoansLoanIdTermPeriodFrequencyType termPeriodFrequencyType; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; public GetLoansLoanIdRepaymentFrequencyType repaymentFrequencyType; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer interestRatePerPeriod; public GetLoansLoanIdInterestRateFrequencyType interestRateFrequencyType; - @ApiModelProperty(example = "24") + @Schema(example = "24") public Integer annualInterestRate; public GetLoansLoanIdAmortizationType amortizationType; public GetLoansLoanIdInterestType interestType; public GetLoansLoanIdInterestCalculationPeriodType interestCalculationPeriodType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer transactionProcessingStrategyId; public GetLoansLoanIdTimeline timeline; public GetLoansLoanIdSummary summary; } - @ApiModel(value = "GetSelfLoansLoanIdTransactionsTransactionIdResponse") + @Schema(description = "GetSelfLoansLoanIdTransactionsTransactionIdResponse") public static final class GetSelfLoansLoanIdTransactionsTransactionIdResponse { private GetSelfLoansLoanIdTransactionsTransactionIdResponse() {} @@ -477,45 +476,45 @@ final class SelfLoansApiResourceSwagger { private GetSelfLoansLoanIdTransactionsType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "loanTransactionType.repayment") + @Schema(example = "loanTransactionType.repayment") public String code; - @ApiModelProperty(example = "Repayment") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Repayment") + public String description; + @Schema(example = "false") public Boolean disbursement; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean repaymentAtDisbursement; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean repayment; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean contra; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waiveInterest; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waiveCharges; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean writeOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean recoveryRepayment; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; public GetSelfLoansLoanIdTransactionsType type; - @ApiModelProperty(example = "[2012, 5, 14]") + @Schema(example = "[2012, 5, 14]") public LocalDate date; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean manuallyReversed; public GetSelfLoansLoanIdResponse.GetLoansLoanIdSummary.GetLoansLoanIdOverdueCharges.GetLoanCurrency currency; - @ApiModelProperty(example = "559.88") + @Schema(example = "559.88") public Float amount; - @ApiModelProperty(example = "559.88") + @Schema(example = "559.88") public Float interestPortion; } - @ApiModel(value = "GetSelfLoansLoanIdChargesResponse") + @Schema(description = "GetSelfLoansLoanIdChargesResponse") public static final class GetSelfLoansLoanIdChargesResponse { private GetSelfLoansLoanIdChargesResponse() {} @@ -524,56 +523,56 @@ final class SelfLoansApiResourceSwagger { private GetSelfLoansChargeTimeType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeTimeType.disbursement") + @Schema(example = "chargeTimeType.disbursement") public String code; - @ApiModelProperty(example = "Disbursement") - public String value; + @Schema(example = "Disbursement") + public String description; } static final class GetSelfLoansChargeCalculationType { private GetSelfLoansChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeId; - @ApiModelProperty(example = "Loan Processing fee") + @Schema(example = "Loan Processing fee") public String name; public GetSelfLoansChargeTimeType chargeTimeType; public GetSelfLoansChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetSelfLoansLoanIdResponse.GetLoansLoanIdSummary.GetLoansLoanIdOverdueCharges.GetLoanCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Float amountWrittenOff; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOutstanding; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Float amountOrPercentage; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = "GetSelfLoansTemplateResponse") + @Schema(description = "GetSelfLoansTemplateResponse") public static final class GetSelfLoansTemplateResponse { private GetSelfLoansTemplateResponse() {} @@ -582,7 +581,7 @@ final class SelfLoansApiResourceSwagger { private GetSelfLoansTimeline() {} - @ApiModelProperty(example = "[2013, 3, 8]") + @Schema(example = "[2013, 3, 8]") public LocalDate expectedDisbursementDate; } @@ -590,23 +589,23 @@ final class SelfLoansApiResourceSwagger { private GetSelfLoansProductOptions() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Kampala Product (with cash accounting)") + @Schema(example = "Kampala Product (with cash accounting)") public String name; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "Kampala first Client") + @Schema(example = "Kampala first Client") public String clientName; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer clientOfficeId; public GetSelfLoansTimeline timeline; public Set productOptions; } - @ApiModel(value = "PostSelfLoansRequest") + @Schema(description = "PostSelfLoansRequest") public static final class PostSelfLoansRequest { private PostSelfLoansRequest() {} @@ -615,11 +614,11 @@ final class SelfLoansApiResourceSwagger { private PostSelfLoansDisbursementData() {} - @ApiModelProperty(example = "01 November 2013") + @Schema(example = "01 November 2013") public String expectedDisbursementDate; - @ApiModelProperty(example = "22000") + @Schema(example = "22000") public Long principal; - @ApiModelProperty(example = "22000") + @Schema(example = "22000") public Long approvedPrincipal; } @@ -631,118 +630,118 @@ final class SelfLoansApiResourceSwagger { private PostSelfLoansData() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "01 December 2016 00:00") + @Schema(example = "01 December 2016 00:00") public String Activation_Date; - @ApiModelProperty(example = "dd MMMM yyyy HH:mm") + @Schema(example = "dd MMMM yyyy HH:mm") public String dateFormat; } - @ApiModelProperty(example = "Date Loan Field") + @Schema(example = "Date Loan Field") public String registeredTableName; public PostSelfLoansData data; } - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "en_GB") + @Schema(example = "en_GB") public String locale; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "10,000.00") + @Schema(example = "10,000.00") public Double principal; - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer loanTermFrequency; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer loanTermFrequencyType; - @ApiModelProperty(example = "individual") + @Schema(example = "individual") public String loanType; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer repaymentFrequencyType; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer interestRatePerPeriod; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amortizationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer interestCalculationPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transactionProcessingStrategyId; - @ApiModelProperty(example = "10 Jun 2013") + @Schema(example = "10 Jun 2013") public String expectedDisbursementDate; - @ApiModelProperty(example = "10 Jun 2013") + @Schema(example = "10 Jun 2013") public String submittedOnDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer linkAccountId; - @ApiModelProperty(example = "1100") + @Schema(example = "1100") public Integer fixedEmiAmount; - @ApiModelProperty(example = "35000") + @Schema(example = "35000") public Long maxOutstandingLoanBalance; public Set disbursementData; public Set datatables; } - @ApiModel(value = "PostSelfLoansResponse") + @Schema(description = "PostSelfLoansResponse") public static final class PostSelfLoansResponse { private PostSelfLoansResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutSelfLoansLoanIdRequest") + @Schema(description = "PutSelfLoansLoanIdRequest") public static final class PutSelfLoansLoanIdRequest { private PutSelfLoansLoanIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer productId; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Long principal; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer loanTermFrequency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer loanTermFrequencyType; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer numberOfRepayments; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer repaymentEvery; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer repaymentFrequencyType; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer interestRatePerPeriod; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer interestCalculationPeriodType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer amortizationType; - @ApiModelProperty(example = "04 March 2014") + @Schema(example = "04 March 2014") public String expectedDisbursementDate; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer transactionProcessingStrategyId; } - @ApiModel(value = "PutSelfLoansLoanIdResponse") + @Schema(description = "PutSelfLoansLoanIdResponse") public static final class PutSelfLoansLoanIdResponse { private PutSelfLoansLoanIdResponse() {} @@ -751,39 +750,39 @@ final class SelfLoansApiResourceSwagger { private PutSelfLoansChanges() {} - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Long principal; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer loanId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutSelfLoansChanges changes; } - @ApiModel(value = "PostSelfLoansLoanIdRequest") + @Schema(description = "PostSelfLoansLoanIdRequest") public static final class PostSelfLoansLoanIdRequest { private PostSelfLoansLoanIdRequest() {} - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "20 September 2011") + @Schema(example = "20 September 2011") public String withdrawnOnDate; - @ApiModelProperty(example = "Reason loan applicant withdrew from application.") + @Schema(example = "Reason loan applicant withdrew from application.") public String note; } - @ApiModel(value = "PostSelfLoansLoanIdResponse") + @Schema(description = "PostSelfLoansLoanIdResponse") public static final class PostSelfLoansLoanIdResponse { private PostSelfLoansLoanIdResponse() {} @@ -796,48 +795,48 @@ final class SelfLoansApiResourceSwagger { private PostSelfLoansLoanIdStatus() {} - @ApiModelProperty(example = "400") + @Schema(example = "400") public Integer id; - @ApiModelProperty(example = "loanStatusType.withdrawn.by.client") + @Schema(example = "loanStatusType.withdrawn.by.client") public String code; - @ApiModelProperty(example = "Withdrawn by applicant") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Withdrawn by applicant") + public String description; + @Schema(example = "false") public Boolean pendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean waitingForDisbursal; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedObligationsMet; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedWrittenOff; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closedRescheduled; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean overpaid; } public PostSelfLoansLoanIdStatus status; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "20 September 2011") + @Schema(example = "20 September 2011") public String withdrawnOnDate; - @ApiModelProperty(example = "20 September 2011") + @Schema(example = "20 September 2011") public String closedOnDate; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer loanId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer resourceId; public PostSelfLoansLoanIdChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java index 047980ebc..857505546 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java @@ -19,13 +19,13 @@ package org.apache.fineract.portfolio.self.pockets.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -50,8 +50,8 @@ import org.springframework.stereotype.Component; @Path("/self/pockets") @Component @Scope("singleton") -@Api(tags = { "Pocket" }) -@SwaggerDefinition(tags = { @Tag(name = "Pocket", description = "") }) + +@Tag(name = "Pocket", description = "") public class PocketApiResource { private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @@ -72,11 +72,11 @@ public class PocketApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Link/delink accounts to/from pocket", httpMethod = "POST", notes = "Pockets behave as favourites. An user can link his/her Loan, Savings and Share accounts to pocket for faster access. In a similar way linked accounts can be delinked from the pocket.\n\n" + @Operation(summary = "Link/delink accounts to/from pocket", description = "Pockets behave as favourites. An user can link his/her Loan, Savings and Share accounts to pocket for faster access. In a similar way linked accounts can be delinked from the pocket.\n\n" + "Example Requests:\n" + "\n" + "self/pockets?command=linkAccounts\n" + "\n" + "self/pockets?command=delinkAccounts") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = PocketApiResourceSwagger.PostLinkDelinkAccountsToFromPocketResponse.class) }) - public String handleCommands(@QueryParam("command") @ApiParam(value = "command") final String commandParam, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PocketApiResourceSwagger.PostLinkDelinkAccountsToFromPocketResponse.class))) }) + public String handleCommands(@QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -101,9 +101,10 @@ public class PocketApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve accounts linked to pocket", httpMethod = "GET", notes = "All linked loan\n\n" + "Example Requests:\n" - + "\n" + "\n" + "self/pockets") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = PocketApiResourceSwagger.GetAccountsLinkedToPocketResponse.class) }) + @Operation(summary = "Retrieve accounts linked to pocket", description = "All linked loan\n\n" + "Example Requests:\n" + "\n" + "\n" + + "self/pockets") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = PocketApiResourceSwagger.GetAccountsLinkedToPocketResponse.class))) }) public String retrieveAll() { return this.toApiJsonSerializer.serialize(this.pocketAccountMappingReadPlatformService.retrieveAll()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResourceSwagger.java index 32480f737..4c6ca8b1a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.pockets.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -30,7 +29,7 @@ final class PocketApiResourceSwagger { private PocketApiResourceSwagger() {} - @ApiModel(value = "PostLinkDelinkAccountsToFromPocketRequest") + @Schema(description = "PostLinkDelinkAccountsToFromPocketRequest") public static final class PostLinkDelinkAccountsToFromPocketRequest { private PostLinkDelinkAccountsToFromPocketRequest() {} @@ -39,25 +38,25 @@ final class PocketApiResourceSwagger { private GetPocketAccountDetail() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer accountId; - @ApiModelProperty(example = "LOAN") + @Schema(example = "LOAN") public String accountType; } public Set accountDetail; } - @ApiModel(value = "PostLinkDelinkAccountsToFromPocketResponse") + @Schema(description = "PostLinkDelinkAccountsToFromPocketResponse") public static final class PostLinkDelinkAccountsToFromPocketResponse { private PostLinkDelinkAccountsToFromPocketResponse() {} - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer resourceId; } - @ApiModel(value = "GetAccountsLinkedToPocketResponse") + @Schema(description = "GetAccountsLinkedToPocketResponse") public static final class GetAccountsLinkedToPocketResponse { private GetAccountsLinkedToPocketResponse() {} @@ -66,15 +65,15 @@ final class PocketApiResourceSwagger { private GetPocketLoanAccounts() {} - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer pocketId; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer accountId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer accountType; - @ApiModelProperty(example = "000000011") + @Schema(example = "000000011") public Integer accountNumber; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer id; } @@ -82,15 +81,15 @@ final class PocketApiResourceSwagger { private GetPocketSavingAccounts() {} - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer pocketId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer accountId; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer accountType; - @ApiModelProperty(example = "000000002") + @Schema(example = "000000002") public Integer accountNumber; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java index 8d1ed8621..684a69fbe 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java @@ -19,9 +19,7 @@ package org.apache.fineract.portfolio.self.products.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -41,92 +39,82 @@ import org.springframework.stereotype.Component; @Path("/self/loanproducts") @Component @Scope("singleton") -@Api(tags = { "Self Loan Products" }) -@SwaggerDefinition(tags = { - @Tag(name = "Self Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.\n" - + "\n" + "Field Descriptions\n" + "name\n" + "Name associated with loan product on system.\n" + "shortName\n" - + "Short name associated with a loan product. \n" - + "An abbreviated version of the name, used in reports or menus where space is limited, such as Collection Sheets.\n" - + "description\n" + "For providing helpful description of product offering.\n" + "fundId\n" - + "For associating a loan product with a given fund by default.\n" + "includeInBorrowerCycle\n" - + "It is a flag, Used to denote whether the loans should include in loan cycle counter or not.\n" + "useBorrowerCycle\n" - + "It is a flag, Used to denote whether the loans should depend on \n" + "borrower loan cycle counter or not.\n" - + "currencyCode\n" + "A three letter ISO code of currency.\n" + "digitsAfterDecimal\n" - + "Override the currency default value for digitsAfterDecimal.\n" + "inMultiplesOf\n" - + "Override the default value for rounding currency to multiples of value provided.\n" + "installmentAmountInMultiplesOf\n" - + "Override the default value for rounding instalment amount to multiples of value provided.\n" + "principal\n" - + "The loan amount to be disbursed to through loan.\n" + "numberOfRepayments\n" + "Number of installments to repay.\n" - + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + "e.g. 10 (repayments) Every 12 Weeks\n" - + "repaymentEvery\n" + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" - + "e.g. 10 (repayments) Every 12 Weeks\n" + "repaymentFrequencyType\n" - + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + "e.g. 10 (repayments) Every 12 Weeks \n" - + "Example Values: 0=Days, 1=Weeks, 2=Months\n" + "interestRatePerPeriod\n" + "Interest Rate.\n" - + "Used like: interestRatePerPeriod % interestRateFrequencyType - interestType\n" - + "e.g. 12.0000% Per year - Declining Balance\n" + "interestRateFrequencyType\n" - + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" - + "e.g. 12.0000% Per year - Declining Balance \n" + "Example Values: 2=Per month, 3=Per year\n" + "amortizationType\n" - + "Example Values: 0=Equal principle payments, 1=Equal installments\n" + "interestType\n" - + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" - + "e.g. 12.0000% Per year - Declining Balance \n" + "Example Values: 0=Declining Balance, 1=Flat\n" - + "interestCalculationPeriodType\n" + "Example Values: 0=Daily, 1=Same as repayment period\n" - + "allowPartialPeriodInterestCalcualtion\n" - + "This value will be supported along with interestCalculationPeriodType as Same as repayment period to calculate interest for partial periods. Example: Interest charged from is 5th of April , Principal is 10000 and interest is 1% per month then the interest will be (10000 * 1%)* (25/30) , it calculates for the month first then calculates exact periods between start date and end date(can be a decimal)\n" - + "inArrearsTolerance\n" - + "The amount that can be 'waived' at end of all loan payments because it is too small to worry about.\n" - + "This is also the tolerance amount assessed when determining if a loan is in arrears.\n" - + "principalVariationsForBorrowerCycle,interestRateVariationsForBorrowerCycle,\n" - + "numberOfRepaymentVariationsForBorrowerCycle\n" + "Variations for loan, based on borrower cycle number\n" - + "minimumDaysBetweenDisbursalAndFirstRepayment\n" - + "The minimum number of days allowed between a Loan disbursal and its first repayment.\n" - + "principalThresholdForLastInstalment\n" - + "Field represents percentage of current instalment principal amount for comparing against principal outstanding to add another repayment instalment. If the outstanding principal amount is less then calculated amount, remaining outstanding amount will be added to current instalment. Default value for multi disburse loan is 50% and non-multi disburse loan is 0%\n" - + "canDefineInstallmentAmount\n" + "if provided as true, then fixed instalment amount can be provided from loan account.\n" - + "transactionProcessingStrategyId\n" - + "An enumeration that indicates the type of transaction processing strategy to be used. This relates to functionality that is also known as Payment Application Logic.\n" - + "A number of out of the box approaches exist, some are custom to specific MFIs, some are more general and indicate the order in which payments are processed.\n" - + "\n" - + "Refer to the Payment Application Logic / Transaction Processing Strategy section in the appendix for more detailed overview of each available payment application logic provided out of the box.\n" - + "\n" + "List of current approaches:\n" + "1 = Mifos style (Similar to Old Mifos)\n" - + "2 = Heavensfamily (Custom MFI approach)\n" + "3 = Creocore (Custom MFI approach)\n" + "4 = RBI (India)\n" - + "5 = Principal Interest Penalties Fees Order\n" + "6 = Interest Principal Penalties Fees Order\n" - + "7 = Early Payment Strategy\n" + "graceOnPrincipalPayment\n" - + "Optional: Integer - represents the number of repayment periods that grace should apply to the principal component of a repayment period.\n" - + "graceOnInterestPayment\n" - + "Optional: Integer - represents the number of repayment periods that grace should apply to the interest component of a repayment period. Interest is still calculated but offset to later repayment periods.\n" - + "graceOnInterestCharged\n" - + "Optional: Integer - represents the number of repayment periods that should be interest-free.\n" - + "graceOnArrearsAgeing\n" - + "Optional: Integer - Used in Arrears calculation to only take into account loans that are more than graceOnArrearsAgeing days overdue.\n" - + "overdueDaysForNPA\n" - + "Optional: Integer - represents the maximum number of days a Loan may be overdue before being classified as a NPA (non performing asset)\n" - + "accountMovesOutOfNPAOnlyOnArrearsCompletion\n" - + "Optional: Boolean - if provided as true, Loan Account moves out of NPA state only when all arrears are cleared\n" - + "accountingRule\n" - + "Specifies if accounting is enabled for the particular product and the type of the accounting rule to be used Example Values:1=NONE, 2=CASH_BASED, 3=ACCRUAL_PERIODIC, 4=ACCRUAL_UPFRONT\n" - + "isInterestRecalculationEnabled\n" - + "It is a flag, Used to denote whether interest recalculation is enabled or disabled for the particular product\n" - + "daysInYearType\n" + "Specifies the number of days in a year. \n" - + "Example Values:1=ACTUAL(Actual number of days in year), 360=360 DAYS, 364=364 DAYS(52 WEEKS), 365=365 DAYS\n" - + "daysInMonthType\n" + "Specifies the number of days in a month. \n" - + "Example Values:1=ACTUAL(Actual number of days in month), 30=30 DAYS\n" + "interestRecalculationCompoundingMethod\n" - + "Specifies which amount portion should be added to principal for interest recalculation. \n" - + "Example Values:0=NONE(Only on principal), 1=INTEREST(Principal+Interest), 2=FEE(Principal+Fee), 3=FEE And INTEREST (Principal+Fee+Interest)\n" - + "rescheduleStrategyMethod\n" + "Specifies what action should perform on loan repayment schedule for advance payments. \n" - + "Example Values:1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount\n" - + "recalculationCompoundingFrequencyType\n" - + "Specifies effective date from which the compounding of interest or fee amounts will be considered in recalculation on late payment.\n" - + "Example Values:1=Same as repayment period, 2=Daily, 3=Weekly, 4=Monthly\n" - + "recalculationCompoundingFrequencyInterval\n" + "Specifies compounding frequency interval for interest recalculation.\n" - + "recalculationCompoundingFrequencyDate\n" + "Specifies compounding frequency start date for interest recalculation.\n" - + "recalculationRestFrequencyType\n" - + "Specifies effective date from which the late or advanced payment amounts will be considered in recalculation.\n" - + "Example Values:1=Same as repayment period, 2=Daily, 3=Weekly, 4=Monthly\n" + "recalculationRestFrequencyInterval\n" - + "Specifies rest frequency interval for interest recalculation.\n" + "recalculationRestFrequencyDate\n" - + "Specifies rest frequency start date for interest recalculation.\n" + "preClosureInterestCalculationStrategy\n" - + "Specifies applicable days for interest calculation on pre closure of a loan.\n" - + "Example Values:1=Calculate till pre closure date, 2=Calculate till rest frequency date\n" - + "isArrearsBasedOnOriginalSchedule\n" + "If Specified as true, arrears will be identified based on original schedule.\n" - + "allowAttributeOverrides\n" + "Specifies if select attributes may be overridden for individual loan accounts.") }) +@Tag(name = "Self Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.\n" + + "\n" + "Field Descriptions\n" + "name\n" + "Name associated with loan product on system.\n" + "shortName\n" + + "Short name associated with a loan product. \n" + + "An abbreviated version of the name, used in reports or menus where space is limited, such as Collection Sheets.\n" + + "description\n" + "For providing helpful description of product offering.\n" + "fundId\n" + + "For associating a loan product with a given fund by default.\n" + "includeInBorrowerCycle\n" + + "It is a flag, Used to denote whether the loans should include in loan cycle counter or not.\n" + "useBorrowerCycle\n" + + "It is a flag, Used to denote whether the loans should depend on \n" + "borrower loan cycle counter or not.\n" + "currencyCode\n" + + "A three letter ISO code of currency.\n" + "digitsAfterDecimal\n" + + "Override the currency default value for digitsAfterDecimal.\n" + "inMultiplesOf\n" + + "Override the default value for rounding currency to multiples of value provided.\n" + "installmentAmountInMultiplesOf\n" + + "Override the default value for rounding instalment amount to multiples of value provided.\n" + "principal\n" + + "The loan amount to be disbursed to through loan.\n" + "numberOfRepayments\n" + "Number of installments to repay.\n" + + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + "e.g. 10 (repayments) Every 12 Weeks\n" + + "repaymentEvery\n" + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + + "e.g. 10 (repayments) Every 12 Weeks\n" + "repaymentFrequencyType\n" + + "Used like: numberOfRepayments Every repaymentEvery repaymentFrequencyType\n" + "e.g. 10 (repayments) Every 12 Weeks \n" + + "Example Values: 0=Days, 1=Weeks, 2=Months\n" + "interestRatePerPeriod\n" + "Interest Rate.\n" + + "Used like: interestRatePerPeriod % interestRateFrequencyType - interestType\n" + "e.g. 12.0000% Per year - Declining Balance\n" + + "interestRateFrequencyType\n" + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" + + "e.g. 12.0000% Per year - Declining Balance \n" + "Example Values: 2=Per month, 3=Per year\n" + "amortizationType\n" + + "Example Values: 0=Equal principle payments, 1=Equal installments\n" + "interestType\n" + + "Used like: interestRatePerPeriod% interestRateFrequencyType - interestType\n" + "e.g. 12.0000% Per year - Declining Balance \n" + + "Example Values: 0=Declining Balance, 1=Flat\n" + "interestCalculationPeriodType\n" + + "Example Values: 0=Daily, 1=Same as repayment period\n" + "allowPartialPeriodInterestCalcualtion\n" + + "This value will be supported along with interestCalculationPeriodType as Same as repayment period to calculate interest for partial periods. Example: Interest charged from is 5th of April , Principal is 10000 and interest is 1% per month then the interest will be (10000 * 1%)* (25/30) , it calculates for the month first then calculates exact periods between start date and end date(can be a decimal)\n" + + "inArrearsTolerance\n" + "The amount that can be 'waived' at end of all loan payments because it is too small to worry about.\n" + + "This is also the tolerance amount assessed when determining if a loan is in arrears.\n" + + "principalVariationsForBorrowerCycle,interestRateVariationsForBorrowerCycle,\n" + "numberOfRepaymentVariationsForBorrowerCycle\n" + + "Variations for loan, based on borrower cycle number\n" + "minimumDaysBetweenDisbursalAndFirstRepayment\n" + + "The minimum number of days allowed between a Loan disbursal and its first repayment.\n" + "principalThresholdForLastInstalment\n" + + "Field represents percentage of current instalment principal amount for comparing against principal outstanding to add another repayment instalment. If the outstanding principal amount is less then calculated amount, remaining outstanding amount will be added to current instalment. Default value for multi disburse loan is 50% and non-multi disburse loan is 0%\n" + + "canDefineInstallmentAmount\n" + "if provided as true, then fixed instalment amount can be provided from loan account.\n" + + "transactionProcessingStrategyId\n" + + "An enumeration that indicates the type of transaction processing strategy to be used. This relates to functionality that is also known as Payment Application Logic.\n" + + "A number of out of the box approaches exist, some are custom to specific MFIs, some are more general and indicate the order in which payments are processed.\n" + + "\n" + + "Refer to the Payment Application Logic / Transaction Processing Strategy section in the appendix for more detailed overview of each available payment application logic provided out of the box.\n" + + "\n" + "List of current approaches:\n" + "1 = Mifos style (Similar to Old Mifos)\n" + "2 = Heavensfamily (Custom MFI approach)\n" + + "3 = Creocore (Custom MFI approach)\n" + "4 = RBI (India)\n" + "5 = Principal Interest Penalties Fees Order\n" + + "6 = Interest Principal Penalties Fees Order\n" + "7 = Early Payment Strategy\n" + "graceOnPrincipalPayment\n" + + "Optional: Integer - represents the number of repayment periods that grace should apply to the principal component of a repayment period.\n" + + "graceOnInterestPayment\n" + + "Optional: Integer - represents the number of repayment periods that grace should apply to the interest component of a repayment period. Interest is still calculated but offset to later repayment periods.\n" + + "graceOnInterestCharged\n" + "Optional: Integer - represents the number of repayment periods that should be interest-free.\n" + + "graceOnArrearsAgeing\n" + + "Optional: Integer - Used in Arrears calculation to only take into account loans that are more than graceOnArrearsAgeing days overdue.\n" + + "overdueDaysForNPA\n" + + "Optional: Integer - represents the maximum number of days a Loan may be overdue before being classified as a NPA (non performing asset)\n" + + "accountMovesOutOfNPAOnlyOnArrearsCompletion\n" + + "Optional: Boolean - if provided as true, Loan Account moves out of NPA state only when all arrears are cleared\n" + + "accountingRule\n" + + "Specifies if accounting is enabled for the particular product and the type of the accounting rule to be used Example Values:1=NONE, 2=CASH_BASED, 3=ACCRUAL_PERIODIC, 4=ACCRUAL_UPFRONT\n" + + "isInterestRecalculationEnabled\n" + + "It is a flag, Used to denote whether interest recalculation is enabled or disabled for the particular product\n" + + "daysInYearType\n" + "Specifies the number of days in a year. \n" + + "Example Values:1=ACTUAL(Actual number of days in year), 360=360 DAYS, 364=364 DAYS(52 WEEKS), 365=365 DAYS\n" + + "daysInMonthType\n" + "Specifies the number of days in a month. \n" + + "Example Values:1=ACTUAL(Actual number of days in month), 30=30 DAYS\n" + "interestRecalculationCompoundingMethod\n" + + "Specifies which amount portion should be added to principal for interest recalculation. \n" + + "Example Values:0=NONE(Only on principal), 1=INTEREST(Principal+Interest), 2=FEE(Principal+Fee), 3=FEE And INTEREST (Principal+Fee+Interest)\n" + + "rescheduleStrategyMethod\n" + "Specifies what action should perform on loan repayment schedule for advance payments. \n" + + "Example Values:1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount\n" + + "recalculationCompoundingFrequencyType\n" + + "Specifies effective date from which the compounding of interest or fee amounts will be considered in recalculation on late payment.\n" + + "Example Values:1=Same as repayment period, 2=Daily, 3=Weekly, 4=Monthly\n" + "recalculationCompoundingFrequencyInterval\n" + + "Specifies compounding frequency interval for interest recalculation.\n" + "recalculationCompoundingFrequencyDate\n" + + "Specifies compounding frequency start date for interest recalculation.\n" + "recalculationRestFrequencyType\n" + + "Specifies effective date from which the late or advanced payment amounts will be considered in recalculation.\n" + + "Example Values:1=Same as repayment period, 2=Daily, 3=Weekly, 4=Monthly\n" + "recalculationRestFrequencyInterval\n" + + "Specifies rest frequency interval for interest recalculation.\n" + "recalculationRestFrequencyDate\n" + + "Specifies rest frequency start date for interest recalculation.\n" + "preClosureInterestCalculationStrategy\n" + + "Specifies applicable days for interest calculation on pre closure of a loan.\n" + + "Example Values:1=Calculate till pre closure date, 2=Calculate till rest frequency date\n" + "isArrearsBasedOnOriginalSchedule\n" + + "If Specified as true, arrears will be identified based on original schedule.\n" + "allowAttributeOverrides\n" + + "Specifies if select attributes may be overridden for individual loan accounts.") public class SelfLoanProductsApiResource { private final LoanProductsApiResource loanProductsApiResource; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java index 9ce4e1074..5eecb309e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java @@ -19,9 +19,7 @@ package org.apache.fineract.portfolio.self.registration.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -38,8 +36,8 @@ import org.springframework.stereotype.Component; @Path("/self/registration") @Component @Scope("singleton") -@Api(tags = { "Self Service Registration" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Service Registration", description = "") }) + +@Tag(name = "Self Service Registration", description = "") public class SelfServiceRegistrationApiResource { private final SelfServiceRegistrationWritePlatformService selfServiceRegistrationWritePlatformService; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java index 0ec3fa7d4..6ce6fea9b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.portfolio.self.runreport; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -43,17 +43,15 @@ import org.springframework.stereotype.Component; @Path("/self/runreports") @Component @Scope("singleton") -@Api(tags = { "Self Run Report " }) -@SwaggerDefinition(tags = { - @Tag(name = "Self Run Report", description = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n" - + "\n" - + "The default output is a JSON formatted \"Generic Resultset\". The Generic Resultset contains Column Heading as well as Data information. However, you can export to CSV format by simply adding \"&exportCSV=true\" to the end of your URL.\n" - + "\n" - + "If Pentaho reports have been pre-defined, they can also be run through this resource. Pentaho reports can return HTML, PDF or CSV formats.\n" - + "\n" - + "The Apache Fineract reference application uses a JQuery plugin called stretchyreporting which, itself, uses this reports resource to provide a pretty flexible reporting User Interface (UI).\n" - + "\n" + "ARGUMENTS\n" - + "R_'parameter names' ... optional, No defaults The number and names of the parameters depend on the specific report and how it has been configured. R_officeId is an example parameter name.Note: the prefix R_ stands for ReportinggenericResultSetoptional, defaults to true If 'true' an optimised JSON format is returned suitable for tabular display of data. If 'false' a simple JSON format is returned. parameterType optional, The only valid value is 'true'. If any other value is provided the argument will be ignored Determines whether the request looks in the list of reports or the list of parameters for its data. Doesn't apply to Pentaho reports.exportCSV optional, The only valid value is 'true'. If any other value is provided the argument will be ignored Output will be delivered as a CSV file instead of JSON. Doesn't apply to Pentaho reports.output-type optional, Defaults to HTML. Valid Values are HTML, XLS, XSLX, CSV and PDF for html, Excel, Excel 2007+, CSV and PDF formats respectively.Only applies to Pentaho reports.locale optional Any valid locale Ex: en_US, en_IN, fr_FR etcOnly applies to Pentaho reports.") }) +@Tag(name = "Self Run Report", description = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n" + + "\n" + + "The default output is a JSON formatted \"Generic Resultset\". The Generic Resultset contains Column Heading as well as Data information. However, you can export to CSV format by simply adding \"&exportCSV=true\" to the end of your URL.\n" + + "\n" + + "If Pentaho reports have been pre-defined, they can also be run through this resource. Pentaho reports can return HTML, PDF or CSV formats.\n" + + "\n" + + "The Apache Fineract reference application uses a JQuery plugin called stretchyreporting which, itself, uses this reports resource to provide a pretty flexible reporting User Interface (UI).\n" + + "\n" + "ARGUMENTS\n" + + "R_'parameter names' ... optional, No defaults The number and names of the parameters depend on the specific report and how it has been configured. R_officeId is an example parameter name.Note: the prefix R_ stands for ReportinggenericResultSetoptional, defaults to true If 'true' an optimised JSON format is returned suitable for tabular display of data. If 'false' a simple JSON format is returned. parameterType optional, The only valid value is 'true'. If any other value is provided the argument will be ignored Determines whether the request looks in the list of reports or the list of parameters for its data. Doesn't apply to Pentaho reports.exportCSV optional, The only valid value is 'true'. If any other value is provided the argument will be ignored Output will be delivered as a CSV file instead of JSON. Doesn't apply to Pentaho reports.output-type optional, Defaults to HTML. Valid Values are HTML, XLS, XSLX, CSV and PDF for html, Excel, Excel 2007+, CSV and PDF formats respectively.Only applies to Pentaho reports.locale optional Any valid locale Ex: en_US, en_IN, fr_FR etcOnly applies to Pentaho reports.") public class SelfRunReportApiResource { private final PlatformSecurityContext context; @@ -69,11 +67,12 @@ public class SelfRunReportApiResource { @Path("{reportName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON, "text/csv", "application/vnd.ms-excel", "application/pdf", "text/html" }) - @ApiOperation(value = "Running A Report", httpMethod = "GET", notes = "" + "Example Requests:\n" + "\n" + "\n" + @Operation(summary = "Running A Report", description = "" + "Example Requests:\n" + "\n" + "\n" + "self/runreports/Client%20Details?R_officeId=1" + "\n" + "\n" + "\n" + "self/runreports/Client%20Details?R_officeId=1&exportCSV=true") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfRunReportApiResourceSwagger.GetRunReportResponse.class) }) - public Response runReport(@PathParam("reportName") @ApiParam(value = "reportName") final String reportName, + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfRunReportApiResourceSwagger.GetRunReportResponse.class))) }) + public Response runReport(@PathParam("reportName") @Parameter(description = "reportName") final String reportName, @Context final UriInfo uriInfo) { this.context.authenticatedUser(); final boolean isSelfServiceUserReport = true; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResourceSwagger.java index e602670d1..9589858ba 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.runreport; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -30,7 +29,7 @@ final class SelfRunReportApiResourceSwagger { private SelfRunReportApiResourceSwagger() {} - @ApiModel(value = "GetRunReportResponse") + @Schema(description = "GetRunReportResponse") public static final class GetRunReportResponse { private GetRunReportResponse() {} @@ -39,15 +38,15 @@ final class SelfRunReportApiResourceSwagger { private GetRunReportColumnHeaders() {} - @ApiModelProperty(example = "Office/Branch") + @Schema(example = "Office/Branch") public String columnName; - @ApiModelProperty(example = "VARCHAR") + @Schema(example = "VARCHAR") public String columnType; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isColumnNullable; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean isColumnPrimaryKey; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public String columnValues; } @@ -56,7 +55,7 @@ final class SelfRunReportApiResourceSwagger { private GetPocketData() {} - @ApiModelProperty(example = "[\"Head Office\", \"000000001\", \"John Doe\" \"2017-03-04\", \"786YYH7\"") + @Schema(example = "[\"Head Office\", \"000000001\", \"John Doe\" \"2017-03-04\", \"786YYH7\"") public String row; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java index 0fee886ff..7d71b6078 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.portfolio.self.savings.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.HashMap; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; @@ -56,8 +57,8 @@ import org.springframework.stereotype.Component; @Path("/self/savingsaccounts") @Component @Scope("singleton") -@Api(tags = { "Self Savings Account" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Savings Account", description = "") }) + +@Tag(name = "Self Savings Account", description = "") public class SelfSavingsApiResource { private final PlatformSecurityContext context; @@ -87,12 +88,12 @@ public class SelfSavingsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a savings account", httpMethod = "GET", notes = "Retrieves a savings account\n\n" - + "Example Requests :\n" + "\n" + "self/savingsaccounts/1\n" + "\n" + "\n" + "self/savingsaccounts/1?associations=transactions") + @Operation(summary = "Retrieve a savings account", description = "Retrieves a savings account\n\n" + "Example Requests :\n" + "\n" + + "self/savingsaccounts/1\n" + "\n" + "\n" + "self/savingsaccounts/1?associations=transactions") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsResponse.class) }) - public String retrieveSavings(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @DefaultValue("all") @QueryParam("chargeStatus") @ApiParam(value = "chargeStatus") final String chargeStatus, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsResponse.class))) }) + public String retrieveSavings(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { this.dataValidator.validateRetrieveSavings(uriInfo); @@ -107,12 +108,13 @@ public class SelfSavingsApiResource { @Path("{accountId}/transactions/{transactionId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Savings Account Transaction", httpMethod = "GET", notes = "Retrieves Savings Account Transaction\n\n" + @Operation(summary = "Retrieve Savings Account Transaction", description = "Retrieves Savings Account Transaction\n\n" + "Example Requests:\n" + "\n" + "self/savingsaccounts/1/transactions/1") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsAccountIdTransactionsTransactionIdResponse.class) }) - public String retrieveSavingsTransaction(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsAccountIdTransactionsTransactionIdResponse.class))) }) + public String retrieveSavingsTransaction(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @PathParam("transactionId") @Parameter(description = "transactionId") final Long transactionId, + @Context final UriInfo uriInfo) { this.dataValidator.validateRetrieveSavingsTransaction(uriInfo); @@ -125,13 +127,13 @@ public class SelfSavingsApiResource { @Path("{accountId}/charges") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Savings Charges", httpMethod = "GET", notes = "Lists Savings Charges\n\n" + "Example Requests:\n" + "\n" + @Operation(summary = "List Savings Charges", description = "Lists Savings Charges\n\n" + "Example Requests:\n" + "\n" + "self/savingsaccounts/1/charges\n" + "\n" + "self/savingsaccounts/1/charges?chargeStatus=inactive\n" + "\n" + "self/savingsaccounts/1/charges?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsAccountIdChargesResponse.class, responseContainer = "List") }) - public String retrieveAllSavingsAccountCharges(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @DefaultValue("all") @QueryParam("chargeStatus") @ApiParam(value = "chargeStatus") final String chargeStatus, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsAccountIdChargesResponse.class)))) }) + public String retrieveAllSavingsAccountCharges(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { validateAppuserSavingsAccountMapping(accountId); @@ -143,13 +145,12 @@ public class SelfSavingsApiResource { @Path("{accountId}/charges/{savingsAccountChargeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Savings account Charge", httpMethod = "GET", notes = "Retrieves a Savings account Charge\n\n" - + "Example Requests:\n" + "\n" + "self/savingsaccounts/1/charges/5\n" + "\n" + "\n" - + "self/savingsaccounts/1/charges/5?fields=name,amountOrPercentage") + @Operation(summary = "Retrieve a Savings account Charge", description = "Retrieves a Savings account Charge\n\n" + "Example Requests:\n" + + "\n" + "self/savingsaccounts/1/charges/5\n" + "\n" + "\n" + "self/savingsaccounts/1/charges/5?fields=name,amountOrPercentage") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsAccountIdChargesSavingsAccountChargeIdResponse.class) }) - public String retrieveSavingsAccountCharge(@PathParam("accountId") @ApiParam(value = "accountId") final Long accountId, - @PathParam("savingsAccountChargeId") @ApiParam(value = "savingsAccountChargeId") final Long savingsAccountChargeId, + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfSavingsApiResourceSwagger.GetSelfSavingsAccountsAccountIdChargesSavingsAccountChargeIdResponse.class))) }) + public String retrieveSavingsAccountCharge(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, + @PathParam("savingsAccountChargeId") @Parameter(description = "savingsAccountChargeId") final Long savingsAccountChargeId, @Context final UriInfo uriInfo) { validateAppuserSavingsAccountMapping(accountId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResourceSwagger.java index b5d1670fb..c5abbd477 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.savings.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; /** @@ -29,7 +28,7 @@ final class SelfSavingsApiResourceSwagger { private SelfSavingsApiResourceSwagger() {} - @ApiModel(value = "GetSelfSavingsAccountsResponse") + @Schema(description = "GetSelfSavingsAccountsResponse") public static final class GetSelfSavingsAccountsResponse { private GetSelfSavingsAccountsResponse() {} @@ -38,23 +37,23 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsStatus() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "savingsAccountStatusType.submitted.and.pending.approval") + @Schema(example = "savingsAccountStatusType.submitted.and.pending.approval") public String code; - @ApiModelProperty(example = "Submitted and pending approval") - public String value; - @ApiModelProperty(example = "true") + @Schema(example = "Submitted and pending approval") + public String description; + @Schema(example = "true") public Boolean submittedAndPendingApproval; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean approved; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean rejected; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean withdrawnByApplicant; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean closed; } @@ -63,7 +62,7 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsTimeline() {} - @ApiModelProperty(example = "[2013, 3, 1]") + @Schema(example = "[2013, 3, 1]") public LocalDate submittedOnDate; } @@ -71,17 +70,17 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -89,48 +88,48 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsInterestCompoundingPeriodType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") + @Schema(example = "savings.interest.period.savingsCompoundingInterestPeriodType.daily") public String code; - @ApiModelProperty(example = "Daily") - public String value; + @Schema(example = "Daily") + public String description; } static final class GetSelfSavingsInterestPostingPeriodType { private GetSelfSavingsInterestPostingPeriodType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") + @Schema(example = "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly") public String code; - @ApiModelProperty(example = "Monthly") - public String value; + @Schema(example = "Monthly") + public String description; } static final class GetSelfSavingsInterestCalculationType { private GetSelfSavingsInterestCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationType.dailybalance") + @Schema(example = "savingsInterestCalculationType.dailybalance") public String code; - @ApiModelProperty(example = "Daily Balance") - public String value; + @Schema(example = "Daily Balance") + public String description; } static final class GetSelfSavingsInterestCalculationDaysInYearType { private GetSelfSavingsInterestCalculationDaysInYearType() {} - @ApiModelProperty(example = "365") + @Schema(example = "365") public Integer id; - @ApiModelProperty(example = "savingsInterestCalculationDaysInYearType.days365") + @Schema(example = "savingsInterestCalculationDaysInYearType.days365") public String code; - @ApiModelProperty(example = "365 Days") - public String value; + @Schema(example = "365 Days") + public String description; } static final class GetSelfSavingsSummary { @@ -138,28 +137,28 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsSummary() {} public GetSelfSavingsCurrency currency; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer accountBalance; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer clientId; - @ApiModelProperty(example = "small business") + @Schema(example = "small business") public String clientName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer savingsProductId; - @ApiModelProperty(example = "Passbook Savings") + @Schema(example = "Passbook Savings") public String savingsProductName; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer fieldOfficerId; public GetSelfSavingsStatus status; public GetSelfSavingsTimeline timeline; public GetSelfSavingsCurrency currency; - @ApiModelProperty(example = "5") + @Schema(example = "5") public Double nominalAnnualInterestRate; public GetSelfSavingsInterestCompoundingPeriodType interestCompoundingPeriodType; public GetSelfSavingsInterestPostingPeriodType interestPostingPeriodType; @@ -168,7 +167,7 @@ final class SelfSavingsApiResourceSwagger { public GetSelfSavingsSummary summary; } - @ApiModel(value = "GetSelfSavingsAccountsAccountIdTransactionsTransactionIdResponse") + @Schema(description = "GetSelfSavingsAccountsAccountIdTransactionsTransactionIdResponse") public static final class GetSelfSavingsAccountsAccountIdTransactionsTransactionIdResponse { private GetSelfSavingsAccountsAccountIdTransactionsTransactionIdResponse() {} @@ -177,19 +176,19 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsTransactionType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "savingsAccountTransactionType.withdrawal") + @Schema(example = "savingsAccountTransactionType.withdrawal") public String code; - @ApiModelProperty(example = "Withdrawal") - public String value; - @ApiModelProperty(example = "false") + @Schema(example = "Withdrawal") + public String description; + @Schema(example = "false") public Boolean deposit; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean withdrawal; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean interestPosting; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean feeDeduction; } @@ -197,19 +196,19 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsTransactionCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer inMultiplesOf; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -221,47 +220,47 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsPaymentType() {} - @ApiModelProperty(example = "11") + @Schema(example = "11") public Integer id; - @ApiModelProperty(example = "cash") + @Schema(example = "cash") public String name; } - @ApiModelProperty(example = "62") + @Schema(example = "62") public Integer id; public GetSelfSavingsPaymentType paymentType; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer accountNumber; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer checkNumber; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer routingCode; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer receiptNumber; - @ApiModelProperty(example = "") + @Schema(example = "") public Integer bankNumber; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; public GetSelfSavingsTransactionType transactionType; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer accountId; - @ApiModelProperty(example = "000000001") + @Schema(example = "000000001") public Long accountNo; - @ApiModelProperty(example = "[2013, 8, 7]") + @Schema(example = "[2013, 8, 7]") public LocalDate date; public GetSelfSavingsTransactionCurrency currency; public GetSelfSavingsPaymentDetailData paymentDetailData; - @ApiModelProperty(example = "5000") + @Schema(example = "5000") public Integer amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer runningBalance; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean reversed; } - @ApiModel(value = "GetSelfSavingsAccountsAccountIdChargesResponse") + @Schema(description = "GetSelfSavingsAccountsAccountIdChargesResponse") public static final class GetSelfSavingsAccountsAccountIdChargesResponse { private GetSelfSavingsAccountsAccountIdChargesResponse() {} @@ -270,88 +269,88 @@ final class SelfSavingsApiResourceSwagger { private GetSelfSavingsChargeTimeType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeTimeType.specifiedDueDate") + @Schema(example = "chargeTimeType.specifiedDueDate") public String code; - @ApiModelProperty(example = "Specified due date") - public String value; + @Schema(example = "Specified due date") + public String description; } static final class GetSelfSavingsChargeCalculationType { private GetSelfSavingsChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer chargeId; - @ApiModelProperty(example = "57") + @Schema(example = "57") public Integer accountId; - @ApiModelProperty(example = "Savings account maintenance fee") + @Schema(example = "Savings account maintenance fee") public String name; public GetSelfSavingsChargeTimeType chargeTimeType; public GetSelfSavingsChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetSelfSavingsAccountsResponse.GetSelfSavingsCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer amountWrittenOff; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amountOutstanding; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amountOrPercentage; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } - @ApiModel(value = "GetSelfSavingsAccountsAccountIdChargesSavingsAccountChargeIdResponse") + @Schema(description = "GetSelfSavingsAccountsAccountIdChargesSavingsAccountChargeIdResponse") public static final class GetSelfSavingsAccountsAccountIdChargesSavingsAccountChargeIdResponse { private GetSelfSavingsAccountsAccountIdChargesSavingsAccountChargeIdResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer chargeId; - @ApiModelProperty(example = "Passbook fee") + @Schema(example = "Passbook fee") public String name; public GetSelfSavingsAccountsAccountIdChargesResponse.GetSelfSavingsChargeTimeType chargeTimeType; public GetSelfSavingsAccountsAccountIdChargesResponse.GetSelfSavingsChargeCalculationType chargeCalculationType; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double percentage; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Double amountPercentageAppliedTo; public GetSelfSavingsAccountsResponse.GetSelfSavingsCurrency currency; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amount; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer amountPaid; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer amountWaived; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer amountWrittenOff; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amountOutstanding; - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer amountOrPercentage; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java index 8b94a6204..f3f4ffbc7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java @@ -18,11 +18,12 @@ */ package org.apache.fineract.portfolio.self.security.api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +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 javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -38,8 +39,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") @Profile("basicauth") @Path("/self/authentication") -@SwaggerDefinition(tags = { - @Tag(name = "Self Authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed") }) +@Tag(name = "Self Authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed") public class SelfAuthenticationApiResource { private final AuthenticationApiResource authenticationApiResource; @@ -52,10 +52,10 @@ public class SelfAuthenticationApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Verify authentication", httpMethod = "POST", notes = "Authenticates the credentials provided and returns the set roles and permissions allowed.\n\n" + @Operation(summary = "Verify authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed.\n\n" + "Please visit this link for more info - https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm#selfbasicauth") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfAuthenticationApiResourceSwagger.PostSelfAuthenticationResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfAuthenticationApiResourceSwagger.PostSelfAuthenticationResponse.class))) }) public String authenticate(final String apiRequestBodyAsJson) { return this.authenticationApiResource.authenticate(apiRequestBodyAsJson); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResourceSwagger.java index 35ae6f061..817733ca6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.security.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import java.util.Set; @@ -30,7 +29,7 @@ final class SelfAuthenticationApiResourceSwagger { private SelfAuthenticationApiResourceSwagger() {} - @ApiModel(value = "PostSelfAuthenticationResponse") + @Schema(description = "PostSelfAuthenticationResponse") public static final class PostSelfAuthenticationResponse { private PostSelfAuthenticationResponse() {} @@ -39,49 +38,49 @@ final class SelfAuthenticationApiResourceSwagger { private GetSelfUserDetailsOrganisationalRole() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "staffOrganisationalRoleType.programDirector") + @Schema(example = "staffOrganisationalRoleType.programDirector") public String code; - @ApiModelProperty(example = "Program Director") - public String value; + @Schema(example = "Program Director") + public String description; } static final class GetSelfUserDetailsRoles { private GetSelfUserDetailsRoles() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Super user") + @Schema(example = "Super user") public String name; - @ApiModelProperty(example = "This role provides all application permissions.") + @Schema(example = "This role provides all application permissions.") public String description; } - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String username; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer userId; - @ApiModelProperty(example = "bWlmb3M6cGFzc3dvcmQ=") + @Schema(example = "bWlmb3M6cGFzc3dvcmQ=") public String base64EncodedAuthenticationKey; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean authenticated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer staffId; - @ApiModelProperty(example = "Director, Program") + @Schema(example = "Director, Program") public String staffDisplayName; public GetSelfUserDetailsOrganisationalRole organisationalRole; public Set roles; - @ApiModelProperty(example = "ALL_FUNCTIONS") + @Schema(example = "ALL_FUNCTIONS") public List permissions; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isSelfServiceUser; - @ApiModelProperty(example = "1, 2, 3") + @Schema(example = "1, 2, 3") public List clients; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java index 22983740e..ed7e6dad7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java @@ -20,15 +20,14 @@ package org.apache.fineract.portfolio.self.security.api; import com.google.gson.reflect.TypeToken; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.lang.reflect.Type; import java.util.Arrays; import java.util.HashSet; @@ -47,8 +46,8 @@ import org.springframework.stereotype.Component; @Path("/self/user") @Component -@Api(tags = { "Self User" }) -@SwaggerDefinition(tags = { @Tag(name = "Self User", description = "") }) + +@Tag(name = "Self User", description = "") public class SelfUserApiResource { private final UsersApiResource usersApiResource; @@ -66,11 +65,11 @@ public class SelfUserApiResource { } @PUT - @ApiOperation(value = "Update User", httpMethod = "PUT", notes = "This API can be used by Self Service user to update their own user information. Currently, \"password\" and \"repeatPassword\" are the only parameters accepted.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfUserApiResourceSwagger.PutSelfUserRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfUserApiResourceSwagger.PutSelfUserResponse.class) }) - public String update(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update User", description = "This API can be used by Self Service user to update their own user information. Currently, \"password\" and \"repeatPassword\" are the only parameters accepted.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfUserApiResourceSwagger.PutSelfUserRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfUserApiResourceSwagger.PutSelfUserResponse.class))) }) + public String update(@Parameter(hidden = true) final String apiRequestBodyAsJson) { if (StringUtils.isBlank(apiRequestBodyAsJson)) { throw new InvalidJsonException(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResourceSwagger.java index a49a4feac..3f3292b86 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.security.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by Chirag Gupta on 12/20/17. @@ -28,18 +27,18 @@ final class SelfUserApiResourceSwagger { private SelfUserApiResourceSwagger() {} - @ApiModel(value = "PutSelfUserRequest") + @Schema(description = "PutSelfUserRequest") public static final class PutSelfUserRequest { private PutSelfUserRequest() {} - @ApiModelProperty(example = "Abcd1234") + @Schema(example = "Abcd1234") public String password; - @ApiModelProperty(example = "Abcd1234") + @Schema(example = "Abcd1234") public String repeatPassword; } - @ApiModel(value = "PutSelfUserResponse") + @Schema(description = "PutSelfUserResponse") public static final class PutSelfUserResponse { private PutSelfUserResponse() {} @@ -48,13 +47,13 @@ final class SelfUserApiResourceSwagger { private PutSelfUserChanges() {} - @ApiModelProperty(example = "6a72a630795be86fe926ce540fc45b6b922fe5ba130f185fe806a26b5e5efcdd") + @Schema(example = "6a72a630795be86fe926ce540fc45b6b922fe5ba130f185fe806a26b5e5efcdd") public String passwordEncoded; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "6") + @Schema(example = "6") public Integer resourceId; public PutSelfUserChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java index 8b81cd543..dda871502 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.portfolio.self.security.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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 javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -40,8 +40,8 @@ import org.springframework.stereotype.Component; @Component @Profile("oauth") @Scope("singleton") -@Api(tags = { "Self User Details" }) -@SwaggerDefinition(tags = { @Tag(name = "Self User Details", description = "") }) + +@Tag(name = "Self User Details", description = "") public class SelfUserDetailsApiResource { private final UserDetailsApiResource userDetailsApiResource; @@ -53,11 +53,12 @@ public class SelfUserDetailsApiResource { @GET @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Fetch authenticated user details", httpMethod = "GET", notes = "Checks the Authentication and returns the set roles and permissions allowed\n\n" + @Operation(summary = "Fetch authenticated user details", description = "Checks the Authentication and returns the set roles and permissions allowed\n\n" + "For more info visit this link - https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm#selfoauth") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = SelfUserDetailsApiResourceSwagger.GetSelfUserDetailsResponse.class) }) - public String fetchAuthenticatedUserData(@QueryParam("access_token") @ApiParam(value = "äccess_token") final String accessToken) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfUserDetailsApiResourceSwagger.GetSelfUserDetailsResponse.class))) }) + public String fetchAuthenticatedUserData( + @QueryParam("access_token") @Parameter(description = "äccess_token") final String accessToken) { return this.userDetailsApiResource.fetchAuthenticatedUserData(accessToken); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResourceSwagger.java index 9d2d3c30c..2ccf0ebbb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.self.security.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import java.util.Set; @@ -30,7 +29,7 @@ final class SelfUserDetailsApiResourceSwagger { private SelfUserDetailsApiResourceSwagger() {} - @ApiModel(value = "GetSelfUserDetailsResponse") + @Schema(description = "GetSelfUserDetailsResponse") public static final class GetSelfUserDetailsResponse { private GetSelfUserDetailsResponse() {} @@ -39,49 +38,49 @@ final class SelfUserDetailsApiResourceSwagger { private GetSelfUserDetailsOrganisationalRole() {} - @ApiModelProperty(example = "100") + @Schema(example = "100") public Integer id; - @ApiModelProperty(example = "staffOrganisationalRoleType.programDirector") + @Schema(example = "staffOrganisationalRoleType.programDirector") public String code; - @ApiModelProperty(example = "Program Director") - public String value; + @Schema(example = "Program Director") + public String description; } static final class GetSelfUserDetailsRoles { private GetSelfUserDetailsRoles() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "Super user") + @Schema(example = "Super user") public String name; - @ApiModelProperty(example = "This role provides all application permissions.") + @Schema(example = "This role provides all application permissions.") public String description; } - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String username; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer userId; - @ApiModelProperty(example = "bWlmb3M6cGFzc3dvcmQ=") + @Schema(example = "bWlmb3M6cGFzc3dvcmQ=") public String base64EncodedAuthenticationKey; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean authenticated; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer staffId; - @ApiModelProperty(example = "Director, Program") + @Schema(example = "Director, Program") public String staffDisplayName; public GetSelfUserDetailsOrganisationalRole organisationalRole; public Set roles; - @ApiModelProperty(example = "ALL_FUNCTIONS") + @Schema(example = "ALL_FUNCTIONS") public List permissions; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isSelfServiceUser; - @ApiModelProperty(example = "[1, 2, 3]") + @Schema(example = "[1, 2, 3]") public List clients; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java index 00186d6df..612e74df5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java @@ -19,13 +19,14 @@ package org.apache.fineract.portfolio.self.shareaccounts.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -65,8 +66,8 @@ import org.springframework.stereotype.Component; @Path("/self/shareaccounts") @Component @Scope("singleton") -@Api(tags = { "Self Share Accounts" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Share Accounts", description = "") }) + +@Tag(name = "Self Share Accounts", description = "") public class SelfShareAccountsApiResource { private final PlatformSecurityContext context; @@ -104,15 +105,15 @@ public class SelfShareAccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Share Account Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + @Operation(summary = "Retrieve Share Account Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "Field Defaults\n" + "\n" + "Allowed Value Lists\n" + "\n" + "\n" + "Arguments\n" + "\n" + "clientId:Integer mandatory\n" + "productId:Integer optionalIf entered, productId, productName and selectedProduct fields are returned.\n" + "Example Requests:\n" + "\n" + "self/shareaccounts/template?clientId=14\n" + "\n" + "self/shareaccounts/template?clientId=14&productId=3\n") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = SelfShareAccountsApiResourceSwagger.GetShareAccountsClientIdProductIdResponse.class) }) - public String template(@QueryParam("clientId") @ApiParam("clientId") final Long clientId, - @QueryParam("productId") @ApiParam("productId") final Long productId, @Context final UriInfo uriInfo) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfShareAccountsApiResourceSwagger.GetShareAccountsClientIdProductIdResponse.class)))) }) + public String template(@QueryParam("clientId") @Parameter(name = "clientId") final Long clientId, + @QueryParam("productId") @Parameter(name = "productId") final Long productId, @Context final UriInfo uriInfo) { validateAppuserClientsMapping(clientId); @@ -136,12 +137,12 @@ public class SelfShareAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Submit new share application", httpMethod = "POST", notes = "Mandatory fields:\n" + "\n" + @Operation(summary = "Submit new share application", description = "Mandatory fields:\n" + "\n" + "clientId, productId, submittedDate, savingsAccountId, requestedShares, applicationDate\n" + "\n" + "\n" + "Optional Fields\n" + "\n" + "accountNo, externalId\n" + "\n" + "\n" + "Inherited from Product (if not provided)\n" + "\n" + "minimumActivePeriod, minimumActivePeriodFrequencyType, lockinPeriodFrequency, lockinPeriodFrequencyType.") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", responseContainer = "List", response = SelfShareAccountsApiResourceSwagger.PostNewShareApplicationResponse.class) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfShareAccountsApiResourceSwagger.PostNewShareApplicationResponse.class)))) }) public String createAccount(final String apiRequestBodyAsJson) { HashMap attr = this.selfShareAccountsDataValidator.validateShareAccountApplication(apiRequestBodyAsJson); final Long clientId = (Long) attr.get(ShareAccountApiConstants.clientid_paramname); @@ -154,13 +155,14 @@ public class SelfShareAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a share application/account", httpMethod = "GET", notes = "\n" + "\n" + "\n" + "Example Requests:\n" - + "\n" + "self/shareaccounts/12\n") + @Operation(summary = "Retrieve a share application/account", description = "\n" + "\n" + "\n" + "Example Requests:\n" + "\n" + + "self/shareaccounts/12\n") // TODO actually write // SelfShareAccountsApiResourceSwagger.GetShareAccountResponse (it currently // does not exist) - // @ApiResponses({@ApiResponse(code = 200, message = "OK", responseContainer - // = "List", response = + // @ApiResponses({@ApiResponse(responseCode = "200", description = "OK", + // responseContainer + // = "List", schema = @Schema(implementation = // SelfShareAccountsApiResourceSwagger.GetShareAccountResponse.class)}) public String retrieveShareAccount(@PathParam("accountId") final Long accountId, @Context final UriInfo uriInfo) { validateAppuserShareAccountMapping(accountId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResourceSwagger.java index 9da47924b..387033062 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResourceSwagger.java @@ -19,8 +19,7 @@ package org.apache.fineract.portfolio.self.shareaccounts.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Set; /** @@ -33,7 +32,7 @@ final class SelfShareAccountsApiResourceSwagger { } - @ApiModel(value = "GetShareAccountsClientIdResponse") + @Schema(description = "GetShareAccountsClientIdResponse") public static final class GetShareAccountsClientIdResponse { private GetShareAccountsClientIdResponse() {} @@ -42,13 +41,13 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsProductOptions() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String name; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String shortName; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer totalShares; } @@ -60,17 +59,17 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsCurrency() {} - @ApiModelProperty(example = "USD") + @Schema(example = "USD") public String code; - @ApiModelProperty(example = "US Dollar") + @Schema(example = "US Dollar") public String name; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer decimalPlaces; - @ApiModelProperty(example = "$") + @Schema(example = "$") public String displaySymbol; - @ApiModelProperty(example = "currency.USD") + @Schema(example = "currency.USD") public String nameCode; - @ApiModelProperty(example = "US Dollar ($)") + @Schema(example = "US Dollar ($)") public String displayLabel; } @@ -79,60 +78,60 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsChargeTimeType() {} - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer id; - @ApiModelProperty(example = "chargeTimeType.sharespurchase") + @Schema(example = "chargeTimeType.sharespurchase") public String code; - @ApiModelProperty(example = "Share purchase") - public String value; + @Schema(example = "Share purchase") + public String description; } static final class GetShareAccountsChargeAppliesTo { private GetShareAccountsChargeAppliesTo() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "chargeAppliesTo.shares") + @Schema(example = "chargeAppliesTo.shares") public String code; - @ApiModelProperty(example = "Shares") - public String value; + @Schema(example = "Shares") + public String description; } static final class GetShareAccountsChargeCalculationType { private GetShareAccountsChargeCalculationType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "chargeCalculationType.flat") + @Schema(example = "chargeCalculationType.flat") public String code; - @ApiModelProperty(example = "Flat") - public String value; + @Schema(example = "Flat") + public String description; } static final class GetShareAccountsChargePaymentMode { private GetShareAccountsChargePaymentMode() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "chargepaymentmode.regular") + @Schema(example = "chargepaymentmode.regular") public String code; - @ApiModelProperty(example = "Regular") - public String value; + @Schema(example = "Regular") + public String description; } - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Activation fee") + @Schema(example = "Activation fee") public String name; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean penalty; public GetShareAccountsCurrency currency; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer amount; public GetShareAccountsChargeTimeType chargeTimeType; public GetShareAccountsChargeAppliesTo chargeAppliesTo; @@ -141,13 +140,13 @@ final class SelfShareAccountsApiResourceSwagger { } - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer clientId; public Set productOptions; public Set chargeOptions; } - @ApiModel(value = "GetShareAccountsClientIdProductIdResponse") + @Schema(description = "GetShareAccountsClientIdProductIdResponse") public static final class GetShareAccountsClientIdProductIdResponse { private GetShareAccountsClientIdProductIdResponse() {} @@ -160,12 +159,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsClientIdProductIdLockPeriodTypeEnum() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "shares.lockin.sharePeriodFrequencyType.days") + @Schema(example = "shares.lockin.sharePeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "days") - public String value; + @Schema(example = "days") + public String description; } @@ -173,12 +172,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsClientIdProductIdMinimumActivePeriodForDividendsTypeEnum() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "shares.minimumactive.sharePeriodFrequencyType.days") + @Schema(example = "shares.minimumactive.sharePeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "days") - public String value; + @Schema(example = "days") + public String description; } @@ -186,12 +185,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsClientIdProductIdAccountingRule() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountingRuleType.cash") + @Schema(example = "accountingRuleType.cash") public String code; - @ApiModelProperty(example = "CASH BASED") - public String value; + @Schema(example = "CASH BASED") + public String description; } @@ -203,11 +202,11 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsShareReferenceId() {} - @ApiModelProperty(example = "32") + @Schema(example = "32") public Integer id; - @ApiModelProperty(example = "Cash in Hand") + @Schema(example = "Cash in Hand") public String name; - @ApiModelProperty(example = "20301") + @Schema(example = "20301") public Integer glCode; } @@ -216,11 +215,11 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsIncomeFromFeeAccountId() {} - @ApiModelProperty(example = "40") + @Schema(example = "40") public Integer id; - @ApiModelProperty(example = "Other Operating Income") + @Schema(example = "Other Operating Income") public String name; - @ApiModelProperty(example = "30105") + @Schema(example = "30105") public Integer glCode; } @@ -229,11 +228,11 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsShareEquityId() {} - @ApiModelProperty(example = "56") + @Schema(example = "56") public Integer id; - @ApiModelProperty(example = "Share Equity") + @Schema(example = "Share Equity") public String name; - @ApiModelProperty(example = "00098") + @Schema(example = "00098") public Integer glCode; } @@ -242,11 +241,11 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsShareSuspenseId() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "Overpayment Liability") + @Schema(example = "Overpayment Liability") public String name; - @ApiModelProperty(example = "10200") + @Schema(example = "10200") public Integer glCode; } @@ -261,12 +260,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetClientIdProductIdMinimumActivePeriodFrequencyTypeOptions() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "shares.lockin.sharePeriodFrequencyType.days") + @Schema(example = "shares.lockin.sharePeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public Integer value; + @Schema(example = "Days") + public Integer description; } @@ -274,12 +273,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetClientIdProductIdLockinPeriodFrequencyTypeOptions() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "shares.lockin.sharePeriodFrequencyType.days") + @Schema(example = "shares.lockin.sharePeriodFrequencyType.days") public String code; - @ApiModelProperty(example = "Days") - public Integer value; + @Schema(example = "Days") + public Integer description; } @@ -295,12 +294,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetLiabilityAccountType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.liability") + @Schema(example = "accountType.liability") public String code; - @ApiModelProperty(example = "LIABILITY") - public Integer value; + @Schema(example = "LIABILITY") + public Integer description; } @@ -308,12 +307,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetLiabilityAccountUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public Integer value; + @Schema(example = "DETAIL") + public Integer description; } @@ -321,30 +320,30 @@ final class SelfShareAccountsApiResourceSwagger { private GetLiabilityAccountTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean mandatory; } - @ApiModelProperty(example = "30") + @Schema(example = "30") public Integer id; - @ApiModelProperty(example = "Recurring Deposits") + @Schema(example = "Recurring Deposits") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer parentId; - @ApiModelProperty(example = "10104") + @Schema(example = "10104") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetLiabilityAccountType type; public GetLiabilityAccountUsage usage; - @ApiModelProperty(example = " ....Recurring Deposits") + @Schema(example = " ....Recurring Deposits") public String nameDecorated; public GetLiabilityAccountTagId tagId; @@ -358,12 +357,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetAssetAccountType() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountType.asset") + @Schema(example = "accountType.asset") public String code; - @ApiModelProperty(example = "ASSET") - public Integer value; + @Schema(example = "ASSET") + public Integer description; } @@ -371,12 +370,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetAssetAccountUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public Integer value; + @Schema(example = "DETAIL") + public Integer description; } @@ -384,30 +383,30 @@ final class SelfShareAccountsApiResourceSwagger { private GetAssetAccountTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean mandatory; } - @ApiModelProperty(example = "31") + @Schema(example = "31") public Integer id; - @ApiModelProperty(example = "Furniture and Fixtures") + @Schema(example = "Furniture and Fixtures") public String name; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer parentId; - @ApiModelProperty(example = "20101") + @Schema(example = "20101") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetAssetAccountType type; public GetAssetAccountUsage usage; - @ApiModelProperty(example = " ....Furniture and Fixtures") + @Schema(example = " ....Furniture and Fixtures") public String nameDecorated; public GetAssetAccountTagId tagId; @@ -421,12 +420,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetIncomeAccountType() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "accountType.income") + @Schema(example = "accountType.income") public String code; - @ApiModelProperty(example = "INCOME") - public Integer value; + @Schema(example = "INCOME") + public Integer description; } @@ -434,12 +433,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetIncomeAccountUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public Integer value; + @Schema(example = "DETAIL") + public Integer description; } @@ -447,30 +446,30 @@ final class SelfShareAccountsApiResourceSwagger { private GetIncomeAccountTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean mandatory; } - @ApiModelProperty(example = "54") + @Schema(example = "54") public Integer id; - @ApiModelProperty(example = "Loan Recovery (Temp)") + @Schema(example = "Loan Recovery (Temp)") public String name; - @ApiModelProperty(example = "220002-Temp") + @Schema(example = "220002-Temp") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetIncomeAccountType type; public GetIncomeAccountUsage usage; - @ApiModelProperty(example = "Temporary account to track income from Loan recovery") + @Schema(example = "Temporary account to track income from Loan recovery") public String Description; - @ApiModelProperty(example = "Loan Recovery (Temp)") + @Schema(example = "Loan Recovery (Temp)") public String nameDecorated; public GetIncomeAccountTagId tagId; } @@ -483,12 +482,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsEquityAccountType() {} - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "accountType.equity") + @Schema(example = "accountType.equity") public String code; - @ApiModelProperty(example = "EQUITY") - public Integer value; + @Schema(example = "EQUITY") + public Integer description; } @@ -496,12 +495,12 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsEquityAccountUsage() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "accountUsage.detail") + @Schema(example = "accountUsage.detail") public String code; - @ApiModelProperty(example = "DETAIL") - public Integer value; + @Schema(example = "DETAIL") + public Integer description; } @@ -509,30 +508,30 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsEquityAccountTagId() {} - @ApiModelProperty(example = "0") + @Schema(example = "0") public Integer id; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean active; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean mandatory; } - @ApiModelProperty(example = "56") + @Schema(example = "56") public Integer id; - @ApiModelProperty(example = "Share Equity") + @Schema(example = "Share Equity") public String name; - @ApiModelProperty(example = "25") + @Schema(example = "25") public Integer parentId; - @ApiModelProperty(example = "00098") + @Schema(example = "00098") public Integer glCode; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean disabled; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean manualEntriesAllowed; public GetShareAccountsEquityAccountType type; public GetShareAccountsEquityAccountUsage usage; - @ApiModelProperty(example = "....Share Equity") + @Schema(example = "....Share Equity") public String nameDecorated; public GetShareAccountsEquityAccountTagId tagId; @@ -540,39 +539,39 @@ final class SelfShareAccountsApiResourceSwagger { } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer id; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String name; - @ApiModelProperty(example = "SP") + @Schema(example = "SP") public String shortName; - @ApiModelProperty(example = "SP1") + @Schema(example = "SP1") public String description; public GetShareAccountsClientIdResponse.GetShareAccountsChargeOptions.GetShareAccountsCurrency currency; - @ApiModelProperty(example = "1000") + @Schema(example = "1000") public Integer totalShares; - @ApiModelProperty(example = "900") + @Schema(example = "900") public Integer totalSharesIssued; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer unitPrice; - @ApiModelProperty(example = "900") + @Schema(example = "900") public Integer shareCapital; - @ApiModelProperty(example = "8") + @Schema(example = "8") public Integer minimumShares; - @ApiModelProperty(example = "500") + @Schema(example = "500") public Integer norminalShares; - @ApiModelProperty(example = "500") + @Schema(example = "500") public Integer maximumShares; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public String marketPrice; - @ApiModelProperty(example = "[]") + @Schema(example = "[]") public String charges; - @ApiModelProperty(example = "False") + @Schema(example = "False") public Boolean allowDividendCalculationForInactiveClients; - @ApiModelProperty(example = "50") + @Schema(example = "50") public Integer lockinPeriod; public GetShareAccountsClientIdProductIdLockPeriodTypeEnum lockinPeriodEnum; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Integer minimumActivePeriod; public GetShareAccountsClientIdProductIdMinimumActivePeriodForDividendsTypeEnum minimumActivePeriodForDividendsTypeEnum; public GetShareAccountsClientIdProductIdAccountingRule accountingRule; @@ -595,7 +594,7 @@ final class SelfShareAccountsApiResourceSwagger { public Set chargeOptions; } - @ApiModel(value = "PostNewShareApplicationRequest") + @Schema(description = "PostNewShareApplicationRequest") public static final class PostNewShareApplicationRequest { private PostNewShareApplicationRequest() {} @@ -604,39 +603,39 @@ final class SelfShareAccountsApiResourceSwagger { private GetShareAccountsCharges() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer chargeId; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer amount; } - @ApiModelProperty(example = "3") + @Schema(example = "3") public Integer productId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer unitPrice; - @ApiModelProperty(example = "500") + @Schema(example = "500") public Integer requestedShares; - @ApiModelProperty(example = "31 July 2018") + @Schema(example = "31 July 2018") public String submittedDate; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer savingsAccountId; - @ApiModelProperty(example = "31 July 2018") + @Schema(example = "31 July 2018") public String applicationDate; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM YYYY") + @Schema(example = "dd MMMM YYYY") public String dateFormat; public GetShareAccountsCharges charges; - @ApiModelProperty(example = "14") + @Schema(example = "14") public Integer clientId; } - @ApiModel(value = "PostNewShareApplicationResponse") + @Schema(description = "PostNewShareApplicationResponse") public static final class PostNewShareApplicationResponse { private PostNewShareApplicationResponse() {} - @ApiModelProperty(example = "12") + @Schema(example = "12") public Integer resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java index 85d3f3d7f..a87780a1a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java @@ -19,9 +19,7 @@ package org.apache.fineract.portfolio.self.spm.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -44,8 +42,8 @@ import org.springframework.transaction.annotation.Transactional; @Path("/self/surveys/scorecards") @Component @Scope("singleton") -@Api(tags = { "Self Score Card" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Score Card", description = "") }) + +@Tag(name = "Self Score Card", description = "") public class SelfScorecardApiResource { private final PlatformSecurityContext context; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java index 8222ab2c2..b0d53bd6d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java @@ -19,9 +19,7 @@ package org.apache.fineract.portfolio.self.spm.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -39,8 +37,8 @@ import org.springframework.transaction.annotation.Transactional; @Path("/self/surveys") @Component @Scope("singleton") -@Api(tags = { "Self Spm" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Spm", description = "") }) + +@Tag(name = "Self Spm", description = "") public class SelfSpmApiResource { private final PlatformSecurityContext securityContext; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java index e8315d359..d3a6bd55a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java @@ -18,9 +18,7 @@ */ package org.apache.fineract.portfolio.shareproducts.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -52,8 +50,8 @@ import org.springframework.stereotype.Component; @Path("/shareproduct/{productId}/dividend") @Component @Scope("singleton") -@Api(tags = { "Self Dividend" }) -@SwaggerDefinition(tags = { @Tag(name = "Self Dividend", description = "") }) + +@Tag(name = "Self Dividend", description = "") public class ShareDividendApiResource { private final DefaultToApiJsonSerializer toApiJsonSerializer; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java index 052f952e4..47df4d8cb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.tax.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -55,8 +55,8 @@ import org.springframework.stereotype.Component; @Path("/taxes/component") @Component @Scope("singleton") -@Api(tags = { "Tax Components" }) -@SwaggerDefinition(tags = { @Tag(name = "Tax Components", description = "This defines the Tax Components") }) + +@Tag(name = "Tax Components", description = "This defines the Tax Components") public class TaxComponentApiResource { private final String resourceNameForPermissions = "TAXCOMPONENT"; @@ -82,9 +82,9 @@ public class TaxComponentApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Tax Components", httpMethod = "GET", notes = "List Tax Components") + @Operation(summary = "List Tax Components", description = "List Tax Components") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = TaxComponentApiResourceSwagger.GetTaxesComponentsResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TaxComponentApiResourceSwagger.GetTaxesComponentsResponse.class)))) }) public String retrieveAllTaxComponents(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -99,9 +99,10 @@ public class TaxComponentApiResource { @Path("{taxComponentId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Tax Component", httpMethod = "GET", notes = "Retrieve Tax Component") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TaxComponentApiResourceSwagger.GetTaxesComponentsResponse.class) }) - public String retrieveTaxComponent(@PathParam("taxComponentId") @ApiParam(value = "taxComponentId") final Long taxComponentId, + @Operation(summary = "Retrieve Tax Component", description = "Retrieve Tax Component") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxComponentApiResourceSwagger.GetTaxesComponentsResponse.class))) }) + public String retrieveTaxComponent(@PathParam("taxComponentId") @Parameter(description = "taxComponentId") final Long taxComponentId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -129,13 +130,13 @@ public class TaxComponentApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a new Tax Component", httpMethod = "POST", notes = "Creates a new Tax Component\n\n" + @Operation(summary = "Create a new Tax Component", description = "Creates a new Tax Component\n\n" + "Mandatory Fields: name, percentage\n\n" + "Optional Fields: debitAccountType, debitAcountId, creditAccountType, creditAcountId, startDate") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TaxComponentApiResourceSwagger.PostTaxesComponentsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TaxComponentApiResourceSwagger.PostTaxesComponentsResponse.class) }) - public String createTaxCompoent(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TaxComponentApiResourceSwagger.PostTaxesComponentsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxComponentApiResourceSwagger.PostTaxesComponentsResponse.class))) }) + public String createTaxCompoent(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createTaxComponent().withJson(apiRequestBodyAsJson).build(); @@ -148,13 +149,12 @@ public class TaxComponentApiResource { @Path("{taxComponentId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Tax Component", httpMethod = "PUT", notes = "Updates Tax component. Debit and credit account details cannot be modified. All the future tax components would be replaced with the new percentage.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TaxComponentApiResourceSwagger.PutTaxesComponentsTaxComponentIdRequest.class) }) + @Operation(summary = "Update Tax Component", description = "Updates Tax component. Debit and credit account details cannot be modified. All the future tax components would be replaced with the new percentage.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TaxComponentApiResourceSwagger.PutTaxesComponentsTaxComponentIdRequest.class))) @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = TaxComponentApiResourceSwagger.PutTaxesComponentsTaxComponentIdResponse.class) }) - public String updateTaxCompoent(@PathParam("taxComponentId") @ApiParam(value = "taxComponentId") final Long taxComponentId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxComponentApiResourceSwagger.PutTaxesComponentsTaxComponentIdResponse.class))) }) + public String updateTaxCompoent(@PathParam("taxComponentId") @Parameter(description = "taxComponentId") final Long taxComponentId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateTaxComponent(taxComponentId).withJson(apiRequestBodyAsJson) .build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResourceSwagger.java index 99368b86c..3eadbb6fd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.tax.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.Set; @@ -30,7 +29,7 @@ final class TaxComponentApiResourceSwagger { private TaxComponentApiResourceSwagger() {} - @ApiModel(value = "GetTaxesComponentsResponse") + @Schema(description = "GetTaxesComponentsResponse") public static final class GetTaxesComponentsResponse { private GetTaxesComponentsResponse() {} @@ -39,23 +38,23 @@ final class TaxComponentApiResourceSwagger { private GetTaxesComponentsCreditAccountType() {} - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer id; - @ApiModelProperty(example = "accountType.liability") + @Schema(example = "accountType.liability") public String code; - @ApiModelProperty(example = "LIABILITY") - public String value; + @Schema(example = "LIABILITY") + public String description; } static final class GetTaxesComponentsCreditAccount { private GetTaxesComponentsCreditAccount() {} - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer id; - @ApiModelProperty(example = "ACCOUNT_NAME_7BR9C") + @Schema(example = "ACCOUNT_NAME_7BR9C") public String name; - @ApiModelProperty(example = "LIABILITY_PA1460364665046") + @Schema(example = "LIABILITY_PA1460364665046") public String glCode; } @@ -64,67 +63,67 @@ final class TaxComponentApiResourceSwagger { private GetTaxesComponentsHistories() {} } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer id; - @ApiModelProperty(example = "tax component 1") + @Schema(example = "tax component 1") public String name; - @ApiModelProperty(example = "10.000000") + @Schema(example = "10.000000") public Float percentage; public GetTaxesComponentsCreditAccountType creditAccountType; public GetTaxesComponentsCreditAccount creditAccount; - @ApiModelProperty(example = "[2016, 4, 11]") + @Schema(example = "[2016, 4, 11]") public LocalDate startDate; public Set taxComponentsHistories; } - @ApiModel(value = "PostTaxesComponentsRequest") + @Schema(description = "PostTaxesComponentsRequest") public static final class PostTaxesComponentsRequest { private PostTaxesComponentsRequest() {} - @ApiModelProperty(example = "tax component 1") + @Schema(example = "tax component 1") public String name; - @ApiModelProperty(example = "10") + @Schema(example = "10") public Float percentage; - @ApiModelProperty(example = "2") + @Schema(example = "2") public Integer creditAccountType; - @ApiModelProperty(example = "4") + @Schema(example = "4") public Integer creditAcountId; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "11 April 2016") + @Schema(example = "11 April 2016") public String startDate; } - @ApiModel(value = "PostTaxesComponentsResponse") + @Schema(description = "PostTaxesComponentsResponse") public static final class PostTaxesComponentsResponse { private PostTaxesComponentsResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutTaxesComponentsTaxComponentIdRequest") + @Schema(description = "PutTaxesComponentsTaxComponentIdRequest") public static final class PutTaxesComponentsTaxComponentIdRequest { private PutTaxesComponentsTaxComponentIdRequest() {} - @ApiModelProperty(example = "tax component 2") + @Schema(example = "tax component 2") public String name; - @ApiModelProperty(example = "15") + @Schema(example = "15") public Float percentage; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; - @ApiModelProperty(example = "15 April 2016") + @Schema(example = "15 April 2016") public String startDate; } - @ApiModel(value = "PutTaxesComponentsTaxComponentIdResponse") + @Schema(description = "PutTaxesComponentsTaxComponentIdResponse") public static final class PutTaxesComponentsTaxComponentIdResponse { private PutTaxesComponentsTaxComponentIdResponse() {} @@ -133,15 +132,15 @@ final class TaxComponentApiResourceSwagger { private PutTaxesComponentsChanges() {} - @ApiModelProperty(example = "15") + @Schema(example = "15") public Float percentage; - @ApiModelProperty(example = "tax component 2") + @Schema(example = "tax component 2") public String name; - @ApiModelProperty(example = "[2016, 4, 15]") + @Schema(example = "[2016, 4, 15]") public LocalDate startDate; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; public PutTaxesComponentsChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java index 6373445d5..5fce11847 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.portfolio.tax.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -55,8 +55,8 @@ import org.springframework.stereotype.Component; @Path("/taxes/group") @Component @Scope("singleton") -@Api(tags = { "Tax Group" }) -@SwaggerDefinition(tags = { @Tag(name = "Tax Group", description = "This defines the Tax Group") }) + +@Tag(name = "Tax Group", description = "This defines the Tax Group") public class TaxGroupApiResource { private final String resourceNameForPermissions = "TAXGROUP"; @@ -81,9 +81,9 @@ public class TaxGroupApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Tax Group", httpMethod = "GET", notes = "List Tax Group") + @Operation(summary = "List Tax Group", description = "List Tax Group") @ApiResponses({ - @ApiResponse(code = 200, message = "OK", response = TaxGroupApiResourceSwagger.GetTaxesGroupResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TaxGroupApiResourceSwagger.GetTaxesGroupResponse.class)))) }) public String retrieveAllTaxGroups(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -98,9 +98,10 @@ public class TaxGroupApiResource { @Path("{taxGroupId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve Tax Group", httpMethod = "GET", notes = "Retrieve Tax Group") - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TaxGroupApiResourceSwagger.GetTaxesGroupResponse.class) }) - public String retrieveTaxGroup(@PathParam("taxGroupId") @ApiParam(value = "taxGroupId") final Long taxGroupId, + @Operation(summary = "Retrieve Tax Group", description = "Retrieve Tax Group") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.GetTaxesGroupResponse.class))) }) + public String retrieveTaxGroup(@PathParam("taxGroupId") @Parameter(description = "taxGroupId") final Long taxGroupId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -132,13 +133,12 @@ public class TaxGroupApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a new Tax Group", httpMethod = "POST", notes = "Create a new Tax Group\n" - + "Mandatory Fields: name and taxComponents\n" + "Mandatory Fields in taxComponents: taxComponentId\n" - + "Optional Fields in taxComponents: id, startDate and endDate") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TaxGroupApiResourceSwagger.PostTaxesGroupRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TaxGroupApiResourceSwagger.PostTaxesGroupResponse.class) }) - public String createTaxGroup(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a new Tax Group", description = "Create a new Tax Group\n" + "Mandatory Fields: name and taxComponents\n" + + "Mandatory Fields in taxComponents: taxComponentId\n" + "Optional Fields in taxComponents: id, startDate and endDate") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.PostTaxesGroupRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.PostTaxesGroupResponse.class))) }) + public String createTaxGroup(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createTaxGroup().withJson(apiRequestBodyAsJson).build(); @@ -151,12 +151,12 @@ public class TaxGroupApiResource { @Path("{taxGroupId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update Tax Group", httpMethod = "PUT", notes = "Updates Tax Group. Only end date can be up-datable and can insert new tax components.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TaxGroupApiResourceSwagger.PutTaxesGroupTaxGroupIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TaxGroupApiResourceSwagger.PutTaxesGroupTaxGroupIdResponse.class) }) - public String updateTaxGroup(@PathParam("taxGroupId") @ApiParam(value = "taxGroupId") final Long taxGroupId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update Tax Group", description = "Updates Tax Group. Only end date can be up-datable and can insert new tax components.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.PutTaxesGroupTaxGroupIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.PutTaxesGroupTaxGroupIdResponse.class))) }) + public String updateTaxGroup(@PathParam("taxGroupId") @Parameter(description = "taxGroupId") final Long taxGroupId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateTaxGroup(taxGroupId).withJson(apiRequestBodyAsJson).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResourceSwagger.java index e5bfbf613..1a3c4a0f9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.portfolio.tax.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; import java.util.List; import java.util.Set; @@ -31,7 +30,7 @@ final class TaxGroupApiResourceSwagger { private TaxGroupApiResourceSwagger() {} - @ApiModel(value = "GetTaxesGroupResponse") + @Schema(description = "GetTaxesGroupResponse") public static final class GetTaxesGroupResponse { private GetTaxesGroupResponse() {} @@ -44,27 +43,27 @@ final class TaxGroupApiResourceSwagger { private GetTaxesGroupTaxComponent() {} - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer id; - @ApiModelProperty(example = "tax component 2") + @Schema(example = "tax component 2") public String name; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer id; public GetTaxesGroupTaxComponent taxComponent; - @ApiModelProperty(example = "[2016, 4, 11]") + @Schema(example = "[2016, 4, 11]") public LocalDate startDate; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer id; - @ApiModelProperty(example = "tax group 1") + @Schema(example = "tax group 1") public String name; public Set taxAssociations; } - @ApiModel(value = "PostTaxesGroupRequest") + @Schema(description = "PostTaxesGroupRequest") public static final class PostTaxesGroupRequest { private PostTaxesGroupRequest() {} @@ -73,31 +72,31 @@ final class TaxGroupApiResourceSwagger { private PostTaxesGroupTaxComponents() {} - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer taxComponentId; - @ApiModelProperty(example = "11 April 2016") + @Schema(example = "11 April 2016") public String startDate; } - @ApiModelProperty(example = "tax group 1") + @Schema(example = "tax group 1") public String name; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; public Set taxComponents; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; } - @ApiModel(value = "PostTaxesGroupResponse") + @Schema(description = "PostTaxesGroupResponse") public static final class PostTaxesGroupResponse { private PostTaxesGroupResponse() {} - @ApiModelProperty(example = "1") + @Schema(example = "1") public Integer resourceId; } - @ApiModel(value = "PutTaxesGroupTaxGroupIdRequest") + @Schema(description = "PutTaxesGroupTaxGroupIdRequest") public static final class PutTaxesGroupTaxGroupIdRequest { private PutTaxesGroupTaxGroupIdRequest() {} @@ -106,24 +105,24 @@ final class TaxGroupApiResourceSwagger { private PutTaxesGroupTaxComponents() {} - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer id; - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer taxComponentId; - @ApiModelProperty(example = "22 April 2016") + @Schema(example = "22 April 2016") public String endDate; } - @ApiModelProperty(example = "tax group 2") + @Schema(example = "tax group 2") public String name; - @ApiModelProperty(example = "en") + @Schema(example = "en") public String locale; public Set taxComponents; - @ApiModelProperty(example = "dd MMMM yyyy") + @Schema(example = "dd MMMM yyyy") public String dateFormat; } - @ApiModel(value = "PutTaxesGroupTaxGroupIdResponse") + @Schema(description = "PutTaxesGroupTaxGroupIdResponse") public static final class PutTaxesGroupTaxGroupIdResponse { private PutTaxesGroupTaxGroupIdResponse() {} @@ -136,20 +135,20 @@ final class TaxGroupApiResourceSwagger { private PutTaxesGroupModifiedComponents() {} - @ApiModelProperty(example = "Apr 22, 2016 12:00:00 AM") + @Schema(example = "Apr 22, 2016 12:00:00 AM") public String endDate; - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer taxComponentId; } - @ApiModelProperty(example = "[6]") + @Schema(example = "[6]") public List addComponents; public Set modifiedComponents; - @ApiModelProperty(example = "tax group 2") + @Schema(example = "tax group 2") public String name; } - @ApiModelProperty(example = "7") + @Schema(example = "7") public Integer resourceId; public PutTaxesGroupChanges changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java index ff12beb40..280500a4c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.spm.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.Collections; import java.util.List; import javax.ws.rs.Consumes; @@ -51,9 +52,7 @@ import org.springframework.transaction.annotation.Transactional; @Path("/surveys/{surveyId}/lookuptables") @Component @Scope("singleton") -@Api(tags = { "SPM API - LookUp Table" }) -@SwaggerDefinition(tags = { - @Tag(name = "SPM API - LookUp Table", description = "The Apache Fineract SPM API provides the ability to create custom surveys to collect social performance measurentment data or any additional questionnaire a financial institute want to collect.") }) +@Tag(name = "SPM API - LookUp Table", description = "The Apache Fineract SPM API provides the ability to create custom surveys to collect social performance measurentment data or any additional questionnaire a financial institute want to collect.") public class LookupTableApiResource { private final PlatformSecurityContext securityContext; @@ -73,9 +72,10 @@ public class LookupTableApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "List all Lookup Table entries", notes = "List all Lookup Table entries for a survey.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = LookupTableData.class, responseContainer = "list") }) - public List fetchLookupTables(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId) { + @Operation(summary = "List all Lookup Table entries", description = "List all Lookup Table entries for a survey.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = LookupTableData.class)))) }) + public List fetchLookupTables(@PathParam("surveyId") @Parameter(description = "Enter surveyId") final Long surveyId) { this.securityContext.authenticatedUser(); final Survey survey = findSurvey(surveyId); @@ -94,10 +94,11 @@ public class LookupTableApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "Retrieve a Lookup Table entry", notes = "Retrieve a Lookup Table entry for a survey.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = LookupTableData.class) }) - public LookupTableData findLookupTable(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId, - @PathParam("key") @ApiParam(value = "Enter key") final String key) { + @Operation(summary = "Retrieve a Lookup Table entry", description = "Retrieve a Lookup Table entry for a survey.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = LookupTableData.class))) }) + public LookupTableData findLookupTable(@PathParam("surveyId") @Parameter(description = "Enter surveyId") final Long surveyId, + @PathParam("key") @Parameter(description = "Enter key") final String key) { this.securityContext.authenticatedUser(); findSurvey(surveyId); @@ -115,10 +116,10 @@ public class LookupTableApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "Create a Lookup Table entry", notes = "Add a new entry to a survey.\n" + "\n" + "Mandatory Fields\n" + @Operation(summary = "Create a Lookup Table entry", description = "Add a new entry to a survey.\n" + "\n" + "Mandatory Fields\n" + "key, score, validFrom, validTo") - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) - public void createLookupTable(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId, + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) + public void createLookupTable(@PathParam("surveyId") @Parameter(description = "Enter surveyId") final Long surveyId, final LookupTableData lookupTableData) { this.securityContext.authenticatedUser(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java index 5f713a0b5..3a93417d6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.spm.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -52,8 +53,8 @@ import org.springframework.transaction.annotation.Transactional; @Path("/surveys/scorecards") @Component @Scope("singleton") -@Api(tags = { "Score Card" }) -@SwaggerDefinition(tags = { @Tag(name = "Score Card", description = "") }) + +@Tag(name = "Score Card", description = "") public class ScorecardApiResource { private final PlatformSecurityContext securityContext; @@ -78,9 +79,10 @@ public class ScorecardApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "List all Scorecard entries", notes = "List all Scorecard entries for a survey.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = Scorecard.class, responseContainer = "list") }) - public List findBySurvey(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId) { + @Operation(summary = "List all Scorecard entries", description = "List all Scorecard entries for a survey.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Scorecard.class)))) }) + public List findBySurvey(@PathParam("surveyId") @Parameter(description = "Enter surveyId") final Long surveyId) { this.securityContext.authenticatedUser(); this.spmService.findById(surveyId); return (List) this.scorecardReadPlatformService.retrieveScorecardBySurvey(surveyId); @@ -91,11 +93,11 @@ public class ScorecardApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "Create a Scorecard entry", notes = "Add a new entry to a survey.\n" + "\n" + "Mandatory Fields\n" + @Operation(summary = "Create a Scorecard entry", description = "Add a new entry to a survey.\n" + "\n" + "Mandatory Fields\n" + "clientId, createdOn, questionId, responseId, staffId") - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) - public void createScorecard(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId, - @ApiParam(format = "body", type = "body") final ScorecardData scorecardData) { + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) + public void createScorecard(@PathParam("surveyId") @Parameter(description = "Enter surveyId") final Long surveyId, + @Parameter(description = "scorecardData") final ScorecardData scorecardData) { final AppUser appUser = this.securityContext.authenticatedUser(); final Survey survey = this.spmService.findById(surveyId); final Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(scorecardData.getClientId()); @@ -107,8 +109,8 @@ public class ScorecardApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - public List findBySurveyAndClient(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId, - @PathParam("clientId") @ApiParam(value = "Enter clientId") final Long clientId) { + public List findBySurveyAndClient(@PathParam("surveyId") @Parameter(description = "Enter surveyId") final Long surveyId, + @PathParam("clientId") @Parameter(description = "Enter clientId") final Long clientId) { this.securityContext.authenticatedUser(); this.spmService.findById(surveyId); this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java index a4f84aa7f..254f94494 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java @@ -19,13 +19,14 @@ package org.apache.fineract.spm.api; import com.google.gson.Gson; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +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 java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -52,8 +53,8 @@ import org.springframework.transaction.annotation.Transactional; @Path("/surveys") @Component @Scope("singleton") -@Api(tags = { "Spm-Surveys" }) -@SwaggerDefinition(tags = { @Tag(name = "Spm-Surveys", description = "") }) + +@Tag(name = "Spm-Surveys", description = "") public class SpmApiResource { private final PlatformSecurityContext securityContext; @@ -69,8 +70,9 @@ public class SpmApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "List all Surveys", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SurveyData.class, responseContainer = "list") }) + @Operation(summary = "List all Surveys", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SurveyData.class)))) }) public List fetchAllSurveys(@QueryParam("isActive") final Boolean isActive) { this.securityContext.authenticatedUser(); final List result = new ArrayList<>(); @@ -93,9 +95,10 @@ public class SpmApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "Retrieve a Survey", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = SurveyData.class) }) - public SurveyData findSurvey(@PathParam("id") @ApiParam(value = "Enter id") final Long id) { + @Operation(summary = "Retrieve a Survey", description = "") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = SurveyData.class))) }) + public SurveyData findSurvey(@PathParam("id") @Parameter(description = "Enter id") final Long id) { this.securityContext.authenticatedUser(); final Survey survey = this.spmService.findById(id); return SurveyMapper.map(survey); @@ -105,10 +108,10 @@ public class SpmApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "Create a Survey", notes = "Adds a new survey to collect client related data.\n" + "\n" + "Mandatory Fields\n" - + "\n" + "countryCode, key, name, questions, responses, sequenceNo, text, value") - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) - public String createSurvey(@ApiParam(value = "Create survey") final SurveyData surveyData) { + @Operation(summary = "Create a Survey", description = "Adds a new survey to collect client related data.\n" + "\n" + + "Mandatory Fields\n" + "\n" + "countryCode, key, name, questions, responses, sequenceNo, text, description") + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) + public String createSurvey(@Parameter(description = "Create survey") final SurveyData surveyData) { this.securityContext.authenticatedUser(); final Survey survey = SurveyMapper.map(surveyData, new Survey()); this.spmService.createSurvey(survey); @@ -134,8 +137,8 @@ public class SpmApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Transactional - @ApiOperation(value = "Deactivate Survey", notes = "") - @ApiResponses({ @ApiResponse(code = 200, message = "OK") }) + @Operation(summary = "Deactivate Survey", description = "") + @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) public void activateOrDeactivateSurvey(@PathParam("id") final Long id, @QueryParam("command") final String command) { this.securityContext.authenticatedUser(); if (command != null && command.equalsIgnoreCase("activate")) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java index dc616fa74..b3c35cf29 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java @@ -18,15 +18,14 @@ */ package org.apache.fineract.template.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; @@ -74,13 +73,12 @@ import org.springframework.stereotype.Component; @Produces({ MediaType.APPLICATION_JSON }) @Component @Scope("singleton") -@Api(tags = { "User Generated Documents" }) -@SwaggerDefinition(tags = { - @Tag(name = "User Generated Documents", description = "User Generated Documents(alternatively, Templates) are used for end-user features such as custom user defined document generation (AKA UGD). They are based on {{ moustache }} templates. Think of them as a sort of built-in \"mail merge\" functionality.\n" - + "\n" - + "User Generated Documents (and other types of templates) can aggregate data from several Apache Fineract back-end API calls via mappers. Mappers can even access non-Apache Fineract REST services from other servers. UGDs can render such data in tables, show images, etc. TBD: Please have a look at some of the Example UGDs included in Apache Fineract (or the Wiki page, for now.).\n" - + "\n" - + "UGDs can be assigned to an entity like client or loan and be of a type like Document or SMS. The entity and type of a UGD is only there for the convenience of user agents (UIs), in order to know where to show UGDs for the user (i.e. which tab). The Template Engine back-end runner does not actually need this metadata.") }) + +@Tag(name = "User Generated Documents", description = "User Generated Documents(alternatively, Templates) are used for end-user features such as custom user defined document generation (AKA UGD). They are based on {{ moustache }} templates. Think of them as a sort of built-in \"mail merge\" functionality.\n" + + "\n" + + "User Generated Documents (and other types of templates) can aggregate data from several Apache Fineract back-end API calls via mappers. Mappers can even access non-Apache Fineract REST services from other servers. UGDs can render such data in tables, show images, etc. TBD: Please have a look at some of the Example UGDs included in Apache Fineract (or the Wiki page, for now.).\n" + + "\n" + + "UGDs can be assigned to an entity like client or loan and be of a type like Document or SMS. The entity and type of a UGD is only there for the convenience of user agents (UIs), in order to know where to show UGDs for the user (i.e. which tab). The Template Engine back-end runner does not actually need this metadata.") public class TemplatesApiResource { private final Set RESPONSE_TEMPLATES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id")); @@ -112,13 +110,15 @@ public class TemplatesApiResource { } @GET - @ApiOperation(value = "Retrieve all UGDs", notes = "Example Requests:\n" + "\n" + "templates\n" + "\n" + @Operation(summary = "Retrieve all UGDs", description = "Example Requests:\n" + "\n" + "templates\n" + "\n" + "It is also possible to get specific UGDs by entity and type:\n" + "\n" + "templates?type=0&entity=0\n" + "[Entity: Id]\n\n\n\n" + "\n\n" + "client: 0, loan: 1" + "\n\n" + "[Type: Id]\n\n\n\n" + "Document: 0, E-Mail (not yet): 1, SMS: 2") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TemplatesApiResourcesSwagger.GetTemplatesResponse.class) }) - public String retrieveAll(@DefaultValue("-1") @QueryParam("typeId") @ApiParam(value = "typeId") final int typeId, - @DefaultValue("-1") @QueryParam("entityId") @ApiParam(value = "entityId") final int entityId, @Context final UriInfo uriInfo) { + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.GetTemplatesResponse.class))) }) + public String retrieveAll(@DefaultValue("-1") @QueryParam("typeId") @Parameter(description = "typeId") final int typeId, + @DefaultValue("-1") @QueryParam("entityId") @Parameter(description = "entityId") final int entityId, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); @@ -138,10 +138,11 @@ public class TemplatesApiResource { @GET @Path("template") - @ApiOperation(value = "Retrieve UGD Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for UGDs. The UGD data returned consists of any or all of:\n" + @Operation(summary = "Retrieve UGD Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for UGDs. The UGD data returned consists of any or all of:\n" + "\n" + "ARGUMENTS\n" + "name String entity String type String text String optional mappers Mapper optional\n" + "Example Request:\n" + "\n" + "templates/template") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TemplatesApiResourcesSwagger.GetTemplatesTemplateResponse.class) }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.GetTemplatesTemplateResponse.class))) }) public String template(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); @@ -153,12 +154,12 @@ public class TemplatesApiResource { } @POST - @ApiOperation(value = "Add a UGD", notes = "Adds a new UGD.\n" + "\n" + "Mandatory Fields\n" + "name\n\n\n\n" + "Example Requests:\n" - + "\n" + "templates/1") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TemplatesApiResourcesSwagger.PostTemplatesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TemplatesApiResourcesSwagger.PostTemplatesResponse.class) }) - public String createTemplate(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Add a UGD", description = "Adds a new UGD.\n" + "\n" + "Mandatory Fields\n" + "name\n\n\n\n" + + "Example Requests:\n" + "\n" + "templates/1") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.PostTemplatesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.PostTemplatesResponse.class))) }) + public String createTemplate(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createTemplate().withJson(apiRequestBodyAsJson).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); @@ -168,9 +169,10 @@ public class TemplatesApiResource { @GET @Path("{templateId}") - @ApiOperation(value = "Retrieve a UGD", notes = "Example Requests:\n" + "\n" + "templates/1") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TemplatesApiResourcesSwagger.GetTemplatesTemplateIdResponse.class) }) - public String retrieveOne(@PathParam("templateId") @ApiParam(value = "templateId") final Long templateId, + @Operation(summary = "Retrieve a UGD", description = "Example Requests:\n" + "\n" + "templates/1") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.GetTemplatesTemplateIdResponse.class))) }) + public String retrieveOne(@PathParam("templateId") @Parameter(description = "templateId") final Long templateId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); @@ -195,12 +197,12 @@ public class TemplatesApiResource { @PUT @Path("{templateId}") - @ApiOperation(value = "Update a UGD", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TemplatesApiResourcesSwagger.PutTemplatesTemplateIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = TemplatesApiResourcesSwagger.PutTemplatesTemplateIdResponse.class) }) - public String saveTemplate(@PathParam("templateId") @ApiParam(value = "templateId") final Long templateId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a UGD", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.PutTemplatesTemplateIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.PutTemplatesTemplateIdResponse.class))) }) + public String saveTemplate(@PathParam("templateId") @Parameter(description = "templateId") final Long templateId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateTemplate(templateId).withJson(apiRequestBodyAsJson).build(); @@ -211,10 +213,10 @@ public class TemplatesApiResource { @DELETE @Path("{templateId}") - @ApiOperation(value = "Delete a UGD", notes = "") + @Operation(summary = "Delete a UGD", description = "") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = TemplatesApiResourcesSwagger.DeleteTemplatesTemplateIdResponse.class) }) - public String deleteTemplate(@PathParam("templateId") @ApiParam(value = "templateId") final Long templateId) { + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.DeleteTemplatesTemplateIdResponse.class))) }) + public String deleteTemplate(@PathParam("templateId") @Parameter(description = "templateId") final Long templateId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteTemplate(templateId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResourcesSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResourcesSwagger.java index 702b56e28..0372d8da4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResourcesSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResourcesSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.template.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import org.apache.fineract.template.domain.TemplateMapper; @@ -32,143 +31,143 @@ final class TemplatesApiResourcesSwagger { } - @ApiModel(value = "GetTemplatesResponse") + @Schema(description = "GetTemplatesResponse") public static final class GetTemplatesResponse { private GetTemplatesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Text") + @Schema(example = "Text") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long entity; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long type; - @ApiModelProperty(example = "This is a loan for {{loan.clientName}}") + @Schema(example = "This is a loan for {{loan.clientName}}") public String text; public List mappers; } - @ApiModel(value = "GetTemplatesTemplateResponse") + @Schema(description = "GetTemplatesTemplateResponse") public static final class GetTemplatesTemplateResponse { private GetTemplatesTemplateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Text") + @Schema(example = "Text") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long entity; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long type; - @ApiModelProperty(example = "This is a loan for {{loan.clientName}}") + @Schema(example = "This is a loan for {{loan.clientName}}") public String text; public List mappers; } - @ApiModel(value = "PostTemplatesRequest") + @Schema(description = "PostTemplatesRequest") public static final class PostTemplatesRequest { private PostTemplatesRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Text") + @Schema(example = "Text") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long entity; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long type; - @ApiModelProperty(example = "This is a loan for {{loan.clientName}}") + @Schema(example = "This is a loan for {{loan.clientName}}") public String text; public List mappers; } - @ApiModel(value = "PostTemplatesResponse") + @Schema(description = "PostTemplatesResponse") public static final class PostTemplatesResponse { private PostTemplatesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "GetTemplatesTemplateIdResponse") + @Schema(description = "GetTemplatesTemplateIdResponse") public static final class GetTemplatesTemplateIdResponse { private GetTemplatesTemplateIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Text") + @Schema(example = "Text") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long entity; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long type; - @ApiModelProperty(example = "This is a loan for {{loan.clientName}}") + @Schema(example = "This is a loan for {{loan.clientName}}") public String text; public List mappers; } - @ApiModel(value = "PutTemplatesTemplateIdRequest") + @Schema(description = "PutTemplatesTemplateIdRequest") public static final class PutTemplatesTemplateIdRequest { private PutTemplatesTemplateIdRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Text") + @Schema(example = "Text") public String name; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long entity; - @ApiModelProperty(example = "0") + @Schema(example = "0") public Long type; - @ApiModelProperty(example = "This is a loan for {{loan.clientName}}") + @Schema(example = "This is a loan for {{loan.clientName}}") public String text; public List mappers; } - @ApiModel(value = "PutTemplatesTemplateIdResponse") + @Schema(description = "PutTemplatesTemplateIdResponse") public static final class PutTemplatesTemplateIdResponse { private PutTemplatesTemplateIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "DeleteTemplatesTemplateIdResponse") + @Schema(description = "DeleteTemplatesTemplateIdResponse") public static final class DeleteTemplatesTemplateIdResponse { private DeleteTemplatesTemplateIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java index bcb5b6221..5540be18d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -53,11 +53,9 @@ import org.springframework.stereotype.Component; @Path("/" + PasswordPreferencesApiConstants.RESOURCE_NAME) @Component @Scope("singleton") -@Api(tags = { "Password preferences" }) -@SwaggerDefinition(tags = { - @Tag(name = "Password preferences", description = "This API enables management of password policy for user administration.\n" + "\n" - + "There is no Apache Fineract functionality for creating a validation policy. The validation policies come pre-installed.\n" - + "\n" + "Validation policies may be updated") }) +@Tag(name = "Password preferences", description = "This API enables management of password policy for user administration.\n" + "\n" + + "There is no Apache Fineract functionality for creating a validation policy. The validation policies come pre-installed.\n" + "\n" + + "Validation policies may be updated") public class PasswordPreferencesApiResource { private final PlatformSecurityContext context; @@ -83,7 +81,7 @@ public class PasswordPreferencesApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @ApiResponses({ - @ApiResponse(code = 200, message = "", response = PasswordPreferencesApiResourceSwagger.GetPasswordPreferencesTemplateResponse.class) }) + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = PasswordPreferencesApiResourceSwagger.GetPasswordPreferencesTemplateResponse.class))) }) public String retrieve(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(PasswordPreferencesApiConstants.ENTITY_NAME); @@ -99,11 +97,10 @@ public class PasswordPreferencesApiResource { @PUT @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update password preferences", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = PasswordPreferencesApiResourceSwagger.PutPasswordPreferencesTemplateRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "") }) - public String update(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update password preferences", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PasswordPreferencesApiResourceSwagger.PutPasswordPreferencesTemplateRequest.class))) + @ApiResponses({ @ApiResponse(responseCode = "200", description = "") }) + public String update(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updatePasswordPreferences() // @@ -119,10 +116,10 @@ public class PasswordPreferencesApiResource { @Path("/template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Application Password validation policies", notes = "ARGUMENTS\n" + "Example Requests:\n" + "\n" + @Operation(summary = "List Application Password validation policies", description = "ARGUMENTS\n" + "Example Requests:\n" + "\n" + "passwordpreferences") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = PasswordPreferencesApiResourceSwagger.GetPasswordPreferencesTemplateResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PasswordPreferencesApiResourceSwagger.GetPasswordPreferencesTemplateResponse.class)))) }) public String template(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(PasswordPreferencesApiConstants.ENTITY_NAME); diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResourceSwagger.java index 876d16e00..f93078e5b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 22/8/17. @@ -30,31 +29,31 @@ final class PasswordPreferencesApiResourceSwagger { } - @ApiModel(value = "GetPasswordPreferencesTemplateResponse") + @Schema(description = "GetPasswordPreferencesTemplateResponse") public static final class GetPasswordPreferencesTemplateResponse { private GetPasswordPreferencesTemplateResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Password must be at least 1 character and not more that 50 characters long") + @Schema(example = "Password must be at least 1 character and not more that 50 characters long") public String description; - @ApiModelProperty(example = "true") + @Schema(example = "true") public boolean active; - @ApiModelProperty(example = "simple") + @Schema(example = "simple") public String key; } - @ApiModel(value = "PutPasswordPreferencesTemplateRequest") + @Schema(description = "PutPasswordPreferencesTemplateRequest") public static final class PutPasswordPreferencesTemplateRequest { private PutPasswordPreferencesTemplateRequest() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long validationPolicyId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java index 0b3a663c8..04e574bda 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java @@ -18,15 +18,15 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -56,12 +56,9 @@ import org.springframework.stereotype.Component; @Path("/permissions") @Component @Scope("singleton") -@Api(tags = { "Permissions" }) -@SwaggerDefinition(tags = { - @Tag(name = "Permissions", description = "An API capability to support management of application permissions for user administration.\n" - + "\n" + "There is no Apache Fineract functionality for creating or deleting permissions. Permissions come pre-installed.\n" - + "\n" - + "Permissions are not updated, except in the case of enabling or disabling non-read transactions for Maker Checker functionality") }) +@Tag(name = "Permissions", description = "An API capability to support management of application permissions for user administration.\n" + + "\n" + "There is no Apache Fineract functionality for creating or deleting permissions. Permissions come pre-installed.\n" + "\n" + + "Permissions are not updated, except in the case of enabling or disabling non-read transactions for Maker Checker functionality") public class PermissionsApiResource { private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -88,7 +85,7 @@ public class PermissionsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Application Permissions", notes = "ARGUMENTS\n" + @Operation(summary = "List Application Permissions", description = "ARGUMENTS\n" + "makerCheckerableoptional, Values are true, false. Default is false.\n" + "If makerCheckerable=false or not supplied then a list of application permissions is returned. The \"selected\" attribute is always true in this case.\n" + "\n" @@ -96,7 +93,7 @@ public class PermissionsApiResource { + "\n" + "Note: Each Apache Fineract transaction is associated with a permission.\n" + "\n" + "Example Requests:\n" + "\n" + "permissions\n" + "\n" + "\n" + "permissions?makerCheckerable=true\n" + "\n" + "\n" + "permissions?fields=grouping,code") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = PermissionsApiResourceSwagger.GetPermissionsResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = PermissionsApiResourceSwagger.GetPermissionsResponse.class)))) }) public String retrieveAllPermissions(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -116,11 +113,11 @@ public class PermissionsApiResource { @PUT @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Enable/Disable Permissions for Maker Checker", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = PermissionsApiResourceSwagger.PutPermissionsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) }) - public String updatePermissionsDetails(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Enable/Disable Permissions for Maker Checker", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PermissionsApiResourceSwagger.PutPermissionsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class))) }) + public String updatePermissionsDetails(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updatePermissions() // diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResourceSwagger.java index 21b486b4c..7bd32499a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; /** * Created by sanyam on 22/8/17. @@ -30,33 +29,33 @@ final class PermissionsApiResourceSwagger { } - @ApiModel(value = "GetPermissionsResponse") + @Schema(description = "GetPermissionsResponse") public static final class GetPermissionsResponse { private GetPermissionsResponse() { } - @ApiModelProperty(example = "authorisation") + @Schema(example = "authorisation") public String grouping; - @ApiModelProperty(example = "READ_PERMISSION") + @Schema(example = "READ_PERMISSION") public String code; - @ApiModelProperty(example = "PERMISSION") + @Schema(example = "PERMISSION") public String entityName; - @ApiModelProperty(example = "READ") + @Schema(example = "READ") public String actionName; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean selected; } - @ApiModel(value = "PutPermissionsRequest") + @Schema(description = "PutPermissionsRequest") public static final class PutPermissionsRequest { private PutPermissionsRequest() { } - @ApiModelProperty(example = "\"CREATE_GUARANTOR\":true,\n" + " \"CREATE_CLIENT\":true") + @Schema(example = "\"CREATE_GUARANTOR\":true,\n" + " \"CREATE_CLIENT\":true") public String permissions; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java index 8828d8493..c489ad046 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java @@ -18,15 +18,16 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -64,9 +65,7 @@ import org.springframework.stereotype.Component; @Path("/roles") @Component @Scope("singleton") -@Api(tags = { "Roles" }) -@SwaggerDefinition(tags = { - @Tag(name = "Roles", description = "An API capability to support management of application roles for user administration.") }) +@Tag(name = "Roles", description = "An API capability to support management of application roles for user administration.") public class RolesApiResource { /** @@ -110,9 +109,9 @@ public class RolesApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "List Roles", notes = "Example Requests:\n" + "\n" + "roles\n" + "\n" + "\n" + "roles?fields=name") + @Operation(summary = "List Roles", description = "Example Requests:\n" + "\n" + "roles\n" + "\n" + "\n" + "roles?fields=name") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.GetRolesResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = RolesApiResourceSwagger.GetRolesResponse.class)))) }) public String retrieveAllRoles(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -126,11 +125,11 @@ public class RolesApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Create a New Role", notes = "Mandatory Fields\n" + "name, description") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RolesApiResourceSwagger.PostRolesRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.PostRolesResponse.class) }) - public String createRole(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Create a New Role", description = "Mandatory Fields\n" + "name, description") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PostRolesRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PostRolesResponse.class))) }) + public String createRole(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createRole() // @@ -146,9 +145,10 @@ public class RolesApiResource { @Path("{roleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Role", notes = "Example Requests:\n" + "\n" + "roles/1\n" + "\n" + "\n" + "roles/1?fields=name") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.GetRolesRoleIdResponse.class) }) - public String retrieveRole(@PathParam("roleId") @ApiParam(value = "roleId") final Long roleId, @Context final UriInfo uriInfo) { + @Operation(summary = "Retrieve a Role", description = "Example Requests:\n" + "\n" + "roles/1\n" + "\n" + "\n" + "roles/1?fields=name") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.GetRolesRoleIdResponse.class))) }) + public String retrieveRole(@PathParam("roleId") @Parameter(description = "roleId") final Long roleId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -171,14 +171,15 @@ public class RolesApiResource { @Path("{roleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Enable Role | Disable Role", notes = "Description : Enable role in case role is disabled. | Disable the role in case role is not associated with any users.\n\n\n\n" + @Operation(summary = "Enable Role | Disable Role", description = "Description : Enable role in case role is disabled. | Disable the role in case role is not associated with any users.\n\n\n\n" + "\n\n" + "Example Request: https://DomainName/api/v1/roles/{roleId}?command=enable" + "\n\n\n\n" + "\n\n" + "https://DomainName/api/v1/roles/{roleId}?command=disable") - @ApiImplicitParams({ @ApiImplicitParam(value = "No Request Body", name = "No Request Body") }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.PostRolesRoleIdResponse.class) }) - public String actionsOnRoles(@PathParam("roleId") @ApiParam(value = "roleId") final Long roleId, - @QueryParam("command") @ApiParam(value = "command") final String commandParam, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Parameters({ @Parameter(description = "No Request Body", name = "No Request Body") }) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PostRolesRoleIdResponse.class))) }) + public String actionsOnRoles(@PathParam("roleId") @Parameter(description = "roleId") final Long roleId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -198,12 +199,12 @@ public class RolesApiResource { @Path("{roleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Role", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RolesApiResourceSwagger.PutRolesRoleIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.PutRolesRoleIdResponse.class) }) - public String updateRole(@PathParam("roleId") @ApiParam(value = "roleId") final Long roleId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Role", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PutRolesRoleIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PutRolesRoleIdResponse.class))) }) + public String updateRole(@PathParam("roleId") @Parameter(description = "roleId") final Long roleId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateRole(roleId) // @@ -219,9 +220,10 @@ public class RolesApiResource { @Path("{roleId}/permissions") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Retrieve a Role's Permissions", notes = "Example Requests:\n" + "\n" + "roles/1/permissions") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.GetRolesRoleIdPermissionsResponse.class) }) - public String retrieveRolePermissions(@PathParam("roleId") @ApiParam(value = "roleId") final Long roleId, + @Operation(summary = "Retrieve a Role's Permissions", description = "Example Requests:\n" + "\n" + "roles/1/permissions") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.GetRolesRoleIdPermissionsResponse.class))) }) + public String retrieveRolePermissions(@PathParam("roleId") @Parameter(description = "roleId") final Long roleId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -238,12 +240,12 @@ public class RolesApiResource { @Path("{roleId}/permissions") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Update a Role's Permissions", notes = "") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = RolesApiResourceSwagger.PutRolesRoleIdPermissionsRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.PutRolesRoleIdPermissionsResponse.class) }) - public String updateRolePermissions(@PathParam("roleId") @ApiParam(value = "roleId") final Long roleId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + @Operation(summary = "Update a Role's Permissions", description = "") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PutRolesRoleIdPermissionsRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.PutRolesRoleIdPermissionsResponse.class))) }) + public String updateRolePermissions(@PathParam("roleId") @Parameter(description = "roleId") final Long roleId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateRolePermissions(roleId) // @@ -265,9 +267,10 @@ public class RolesApiResource { @Path("{roleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiOperation(value = "Delete a Role", notes = "Description : Delete the role in case role is not associated with any users.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = RolesApiResourceSwagger.DeleteRolesRoleIdResponse.class) }) - public String deleteRole(@PathParam("roleId") @ApiParam(value = "roleId") final Long roleId) { + @Operation(summary = "Delete a Role", description = "Description : Delete the role in case role is not associated with any users.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = RolesApiResourceSwagger.DeleteRolesRoleIdResponse.class))) }) + public String deleteRole(@PathParam("roleId") @Parameter(description = "roleId") final Long roleId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteRole(roleId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResourceSwagger.java index 6a5d904a9..919d44ec4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; /** @@ -31,77 +30,77 @@ final class RolesApiResourceSwagger { } - @ApiModel(value = "GetRolesResponse") + @Schema(description = "GetRolesResponse") public static final class GetRolesResponse { private GetRolesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Super Users") + @Schema(example = "Super Users") public String name; - @ApiModelProperty(example = "This role provides all application permissions.") + @Schema(example = "This role provides all application permissions.") public String description; } - @ApiModel(value = "GetRolesRoleIdResponse") + @Schema(description = "GetRolesRoleIdResponse") public static final class GetRolesRoleIdResponse { private GetRolesRoleIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Super Users") + @Schema(example = "Super Users") public String name; - @ApiModelProperty(example = "This role provides all application permissions.") + @Schema(example = "This role provides all application permissions.") public String description; } - @ApiModel(value = "PostRolesRequest") + @Schema(description = "PostRolesRequest") public static final class PostRolesRequest { private PostRolesRequest() { } - @ApiModelProperty(example = "Another Role Name") + @Schema(example = "Another Role Name") public String name; - @ApiModelProperty(example = "A description outlining the purpose of this role in relation to the application.") + @Schema(example = "A description outlining the purpose of this role in relation to the application.") public String description; } - @ApiModel(value = "PostRolesResponse") + @Schema(description = "PostRolesResponse") public static final class PostRolesResponse { private PostRolesResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "PutRolesRoleIdRequest") + @Schema(description = "PutRolesRoleIdRequest") public static final class PutRolesRoleIdRequest { private PutRolesRoleIdRequest() { } - @ApiModelProperty(example = "some description(changed)") + @Schema(example = "some description(changed)") public String description; } - @ApiModel(value = "PutRolesRoleIdResponse") + @Schema(description = "PutRolesRoleIdResponse") public static final class PutRolesRoleIdResponse { private PutRolesRoleIdResponse() { @@ -112,29 +111,29 @@ final class RolesApiResourceSwagger { private PutRolesRoleIdResponseChanges() {} - @ApiModelProperty(example = "some description(changed)") + @Schema(example = "some description(changed)") public String description; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; public PutRolesRoleIdResponseChanges changes; } - @ApiModel(value = "PostRolesRoleIdResponse") + @Schema(description = "PostRolesRoleIdResponse") public static final class PostRolesRoleIdResponse { private PostRolesRoleIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } - @ApiModel(value = "GetRolesRoleIdPermissionsResponse") + @Schema(description = "GetRolesRoleIdPermissionsResponse") public static final class GetRolesRoleIdPermissionsResponse { private GetRolesRoleIdPermissionsResponse() { @@ -147,29 +146,29 @@ final class RolesApiResourceSwagger { } - @ApiModelProperty(example = "authorisation") + @Schema(example = "authorisation") public String grouping; - @ApiModelProperty(example = "READ_PERMISSION") + @Schema(example = "READ_PERMISSION") public String code; - @ApiModelProperty(example = "PERMISSION") + @Schema(example = "PERMISSION") public String entityName; - @ApiModelProperty(example = "READ") + @Schema(example = "READ") public String actionName; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean selected; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "Super Users") + @Schema(example = "Super Users") public String name; - @ApiModelProperty(example = "This role provides all application permissions.") + @Schema(example = "This role provides all application permissions.") public String description; public Collection permissionUsageData; } - @ApiModel(value = "PutRolesRoleIdPermissionsRequest") + @Schema(description = "PutRolesRoleIdPermissionsRequest") public static final class PutRolesRoleIdPermissionsRequest { private PutRolesRoleIdPermissionsRequest() { @@ -182,7 +181,7 @@ final class RolesApiResourceSwagger { } - @ApiModelProperty(example = "true") + @Schema(example = "true") public String ALL_FUNCTIONS_READ; } @@ -190,7 +189,7 @@ final class RolesApiResourceSwagger { } - @ApiModel(value = "PutRolesRoleIdPermissionsResponse") + @Schema(description = "PutRolesRoleIdPermissionsResponse") public static final class PutRolesRoleIdPermissionsResponse { private PutRolesRoleIdPermissionsResponse() { @@ -203,24 +202,24 @@ final class RolesApiResourceSwagger { } - @ApiModelProperty(example = "true") + @Schema(example = "true") public String ALL_FUNCTIONS_READ; } - @ApiModelProperty(example = "8") + @Schema(example = "8") public Long resourceId; public PutRolesRoleIdPermissionsRequest.PostRolesRoleIdPermissionsResponsePermissions permissions; } - @ApiModel(value = "DeleteRolesRoleIdResponse") + @Schema(description = "DeleteRolesRoleIdResponse") public static final class DeleteRolesRoleIdResponse { private DeleteRolesRoleIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long resourceId; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java index b154e5031..9de531639 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java @@ -20,15 +20,15 @@ package org.apache.fineract.useradministration.api; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +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 java.io.InputStream; import java.util.Arrays; import java.util.Collection; @@ -69,8 +69,8 @@ import org.springframework.stereotype.Component; @Path("/users") @Component @Scope("singleton") -@Api(tags = { "Users" }) -@SwaggerDefinition(tags = { @Tag(name = "Users", description = "An API capability to support administration of application users.") }) + +@Tag(name = "Users", description = "An API capability to support administration of application users.") public class UsersApiResource { /** @@ -108,10 +108,10 @@ public class UsersApiResource { } @GET - @ApiOperation(value = "Retrieve list of users", notes = "Example Requests:\n" + "\n" + "users\n" + "\n" + "\n" + @Operation(summary = "Retrieve list of users", description = "Example Requests:\n" + "\n" + "users\n" + "\n" + "\n" + "users?fields=id,username,email,officeName") @ApiResponses({ - @ApiResponse(code = 200, message = "", response = UsersApiResourceSwagger.GetUsersResponse.class, responseContainer = "List") }) + @ApiResponse(responseCode = "200", description = "", content = @Content(array = @ArraySchema(schema = @Schema(implementation = UsersApiResourceSwagger.GetUsersResponse.class)))) }) @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String retrieveAll(@Context final UriInfo uriInfo) { @@ -126,12 +126,13 @@ public class UsersApiResource { @GET @Path("{userId}") - @ApiOperation(value = "Retrieve a User", notes = "Example Requests:\n" + "\n" + "users/1\n" + "\n" + "\n" + "users/1?template=true\n" - + "\n" + "\n" + "users/1?fields=username,officeName") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = UsersApiResourceSwagger.GetUsersUserIdResponse.class) }) + @Operation(summary = "Retrieve a User", description = "Example Requests:\n" + "\n" + "users/1\n" + "\n" + "\n" + + "users/1?template=true\n" + "\n" + "\n" + "users/1?fields=username,officeName") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.GetUsersUserIdResponse.class))) }) @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String retrieveOne(@PathParam("userId") @ApiParam(value = "userId") final Long userId, @Context final UriInfo uriInfo) { + public String retrieveOne(@PathParam("userId") @Parameter(description = "userId") final Long userId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions, userId); @@ -148,9 +149,10 @@ public class UsersApiResource { @GET @Path("template") - @ApiOperation(value = "Retrieve User Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "users/template") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = UsersApiResourceSwagger.GetUsersTemplateResponse.class) }) + @Operation(summary = "Retrieve User Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "users/template") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.GetUsersTemplateResponse.class))) }) @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String template(@Context final UriInfo uriInfo) { @@ -164,16 +166,16 @@ public class UsersApiResource { } @POST - @ApiOperation(value = "Create a User", notes = "Adds new application user.\n" + "\n" + @Operation(summary = "Create a User", description = "Adds new application user.\n" + "\n" + "Note: Password information is not required (or processed). Password details at present are auto-generated and then sent to the email account given (which is why it can take a few seconds to complete).\n" + "\n" + "Mandatory Fields: \n" + "username, firstname, lastname, email, officeId, roles, sendPasswordToEmail\n" + "\n" + "Optional Fields: \n" + "staffId,passwordNeverExpires,isSelfServiceUser,clients") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = UsersApiResourceSwagger.PostUsersRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = UsersApiResourceSwagger.PostUsersResponse.class) }) + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.PostUsersRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.PostUsersResponse.class))) }) @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .createUser() // @@ -187,14 +189,14 @@ public class UsersApiResource { @PUT @Path("{userId}") - @ApiOperation(value = "Update a User", notes = "When updating a password you must provide the repeatPassword parameter also.") - @ApiImplicitParams({ - @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = UsersApiResourceSwagger.PutUsersUserIdRequest.class) }) - @ApiResponses({ @ApiResponse(code = 200, message = "", response = UsersApiResourceSwagger.PutUsersUserIdResponse.class) }) + @Operation(summary = "Update a User", description = "When updating a password you must provide the repeatPassword parameter also.") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.PutUsersUserIdRequest.class))) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.PutUsersUserIdResponse.class))) }) @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String update(@PathParam("userId") @ApiParam(value = "userId") final Long userId, - @ApiParam(hidden = true) final String apiRequestBodyAsJson) { + public String update(@PathParam("userId") @Parameter(description = "userId") final Long userId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .updateUser(userId) // @@ -208,11 +210,12 @@ public class UsersApiResource { @DELETE @Path("{userId}") - @ApiOperation(value = "Delete a User", notes = "Removes the user and the associated roles and permissions.") - @ApiResponses({ @ApiResponse(code = 200, message = "", response = UsersApiResourceSwagger.DeleteUsersUserIdResponse.class) }) + @Operation(summary = "Delete a User", description = "Removes the user and the associated roles and permissions.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = UsersApiResourceSwagger.DeleteUsersUserIdResponse.class))) }) @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String delete(@PathParam("userId") @ApiParam(value = "userId") final Long userId) { + public String delete(@PathParam("userId") @Parameter(description = "userId") final Long userId) { final CommandWrapper commandRequest = new CommandWrapperBuilder() // .deleteUser(userId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResourceSwagger.java index 0da5c46d1..681190fbe 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResourceSwagger.java @@ -18,8 +18,7 @@ */ package org.apache.fineract.useradministration.api; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.organisation.staff.data.StaffData; @@ -34,56 +33,56 @@ final class UsersApiResourceSwagger { } - @ApiModel(value = "GetUsersResponse") + @Schema(description = "GetUsersResponse") public static final class GetUsersResponse { private GetUsersResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String username; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String firstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String lastname; - @ApiModelProperty(example = "demomfi@mifos.org") + @Schema(example = "demomfi@mifos.org") public String email; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean passwordNeverExpires; public StaffData staff; public Collection selectedRoles; } - @ApiModel(value = "GetUsersUserIdResponse") + @Schema(description = "GetUsersUserIdResponse") public static final class GetUsersUserIdResponse { private GetUsersUserIdResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long id; - @ApiModelProperty(example = "mifos") + @Schema(example = "mifos") public String username; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "Head Office") + @Schema(example = "Head Office") public String officeName; - @ApiModelProperty(example = "App") + @Schema(example = "App") public String firstname; - @ApiModelProperty(example = "Administrator") + @Schema(example = "Administrator") public String lastname; - @ApiModelProperty(example = "demomfi@mifos.org") + @Schema(example = "demomfi@mifos.org") public String email; - @ApiModelProperty(example = "false") + @Schema(example = "false") public Boolean passwordNeverExpires; public StaffData staff; public Collection availableRoles; @@ -91,7 +90,7 @@ final class UsersApiResourceSwagger { } - @ApiModel(value = "GetUsersTemplateResponse") + @Schema(description = "GetUsersTemplateResponse") public static final class GetUsersTemplateResponse { private GetUsersTemplateResponse() { @@ -103,62 +102,62 @@ final class UsersApiResourceSwagger { public Collection selfServiceRoles; } - @ApiModel(value = "PostUsersRequest") + @Schema(description = "PostUsersRequest") public static final class PostUsersRequest { private PostUsersRequest() { } - @ApiModelProperty(example = "newuser") + @Schema(example = "newuser") public String username; - @ApiModelProperty(example = "Test") + @Schema(example = "Test") public String firstname; - @ApiModelProperty(example = "User") + @Schema(example = "User") public String lastname; - @ApiModelProperty(example = "whatever@mifos.org") + @Schema(example = "whatever@mifos.org") public String email; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long staffId; - @ApiModelProperty(example = "[2,3]") + @Schema(example = "[2,3]") public String Roles; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean sendPasswordToEmail; - @ApiModelProperty(example = "true") + @Schema(example = "true") public Boolean isSelfServiceUser; } - @ApiModel(value = "PostUsersResponse") + @Schema(description = "PostUsersResponse") public static final class PostUsersResponse { private PostUsersResponse() { } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Long resourceId; } - @ApiModel(value = "PutUsersUserIdRequest") + @Schema(description = "PutUsersUserIdRequest") public static final class PutUsersUserIdRequest { private PutUsersUserIdRequest() { } - @ApiModelProperty(example = "Test") + @Schema(example = "Test") public String firstname; - @ApiModelProperty(example = "window75") + @Schema(example = "window75") public String password; - @ApiModelProperty(example = "window75") + @Schema(example = "window75") public String repeatPassword; } - @ApiModel(value = "PutUsersUserIdResponse") + @Schema(description = "PutUsersUserIdResponse") public static final class PutUsersUserIdResponse { private PutUsersUserIdResponse() { @@ -171,20 +170,20 @@ final class UsersApiResourceSwagger { } - @ApiModelProperty(example = "Test") + @Schema(example = "Test") public String firstname; - @ApiModelProperty(example = "abc3326b1bb376351c7baeb4175f5e0504e33aadf6a158474a6d71de1befae51") + @Schema(example = "abc3326b1bb376351c7baeb4175f5e0504e33aadf6a158474a6d71de1befae51") public String passwordEncoded; } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Long resourceId; public PutUsersUserIdResponseChanges changes; } - @ApiModel(value = "DeleteUsersUserIdResponse") + @Schema(description = "DeleteUsersUserIdResponse") public static final class DeleteUsersUserIdResponse { private DeleteUsersUserIdResponse() { @@ -198,9 +197,9 @@ final class UsersApiResourceSwagger { } } - @ApiModelProperty(example = "1") + @Schema(example = "1") public Long officeId; - @ApiModelProperty(example = "11") + @Schema(example = "11") public Long resourceId; public DeleteUsersUserIdResponseChanges changes; } diff --git a/fineract-provider/src/main/resources/META-INF/spring/appContext.xml b/fineract-provider/src/main/resources/META-INF/spring/appContext.xml index 64f4b91d7..8ed13e37a 100644 --- a/fineract-provider/src/main/resources/META-INF/spring/appContext.xml +++ b/fineract-provider/src/main/resources/META-INF/spring/appContext.xml @@ -112,6 +112,4 @@ - - diff --git a/fineract-provider/src/main/resources/META-INF/spring/swagger.xml b/fineract-provider/src/main/resources/META-INF/spring/swagger.xml deleted file mode 100644 index 8104293fd..000000000 --- a/fineract-provider/src/main/resources/META-INF/spring/swagger.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/fineract-provider/src/main/resources/static/swagger-ui/index.html b/fineract-provider/src/main/resources/static/swagger-ui/index.html index 7bc89131c..c21ebe405 100644 --- a/fineract-provider/src/main/resources/static/swagger-ui/index.html +++ b/fineract-provider/src/main/resources/static/swagger-ui/index.html @@ -39,7 +39,7 @@ window.onload = function() { // Begin Swagger UI call region const ui = SwaggerUIBundle({ - url: "response.json", + url: "fineract.json", dom_id: '#swagger-ui', deepLinking: true, presets: [ diff --git a/gradle.properties b/gradle.properties index 4069de224..eb8caad07 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,8 +16,5 @@ # specific language governing permissions and limitations # under the License. # - -# Increased memory and disabled daemon are required by gradle-tomcat-plugin -# The daemon is more pain than gain, because the Tomcat in the Gradle process does not shut down cleanly. -# TODO remove this after https://issues.apache.org/jira/browse/FINERACT-764 -org.gradle.jvmargs=-Xmx4g +# Increased memory needed for swagger-gradle-plugin - but can't be too close to 4G as memory within Docker in Travis is limited +org.gradle.jvmargs=-Xmx2g