FINERACT-1528: Replace copy and pasted Swagger UI with Springdoc
This commit is contained in:
committed by
Arnold Gálovics
parent
3bc160c33c
commit
4bef3ba6b8
-60
@@ -1,60 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.webjars.WebJarAssetLocator;
|
||||
|
||||
@EnableWebMvc
|
||||
@Configuration
|
||||
public class WebFrontEndConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WebFrontEndConfiguration.class);
|
||||
|
||||
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/static/", "classpath:/public/" };
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
if (!registry.hasMappingForPattern("/**")) {
|
||||
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
|
||||
}
|
||||
|
||||
WebJarAssetLocator locator = new WebJarAssetLocator();
|
||||
String fullPathToSwaggerUiJs = locator.getFullPath("swagger-ui.js");
|
||||
LOG.info("Found Swagger UI at {}", fullPathToSwaggerUiJs);
|
||||
String fullPathToSwaggerUi = fullPathToSwaggerUiJs.substring(0, fullPathToSwaggerUiJs.lastIndexOf("/") + 1);
|
||||
|
||||
final String[] swaggerResourceLocations = { "classpath:/static/swagger-ui/", "classpath:fineract.yaml",
|
||||
"classpath:" + fullPathToSwaggerUi };
|
||||
|
||||
registry.addResourceHandler("/swagger-ui/**").addResourceLocations(swaggerResourceLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addRedirectViewController("/swagger-ui", "/swagger-ui/index.html");
|
||||
registry.addRedirectViewController("/swagger-ui/", "/swagger-ui/index.html");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class SurveyApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@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 ] ")
|
||||
+ "Refer Link for sample Body: [ https://demo.fineract.dev/fineract-provider/legacy-docs/apiLive.htm#survey_create ] ")
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdRequest.class)))
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdResponse.class))) })
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ public class AccountsApiResource {
|
||||
+ "requestedDate is requsted date of shares redeem\n" + "\n" + "requestedShares is number of shares to be redeemed\n\n"
|
||||
+ "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")
|
||||
+ "For more info visit this link - https://demo.fineract.dev/fineract-provider/legacy-docs/apiLive.htm#shareaccounts")
|
||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PostAccountsTypeAccountIdRequest.class)))
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountsApiResourceSwagger.PostAccountsTypeAccountIdResponse.class))) })
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class SelfAuthenticationApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@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")
|
||||
+ "Please visit this link for more info - https://demo.fineract.dev/fineract-provider/legacy-docs/apiLive.htm#selfbasicauth")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfAuthenticationApiResourceSwagger.PostSelfAuthenticationResponse.class))) })
|
||||
public String authenticate(final String apiRequestBodyAsJson) {
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class SelfUserDetailsApiResource {
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@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")
|
||||
+ "For more info visit this link - https://demo.fineract.dev/fineract-provider/legacy-docs/apiLive.htm#selfoauth")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfUserDetailsApiResourceSwagger.GetSelfUserDetailsResponse.class))) })
|
||||
public String fetchAuthenticatedUserData() {
|
||||
|
||||
Reference in New Issue
Block a user