FINERACT-835: Complete work on automatically generating Swagger docs
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
a440d56392
commit
acca72f83d
@@ -124,9 +124,8 @@ dependencyManagement {
|
||||
dependency 'com.github.spotbugs:spotbugs-annotations:4.0.6'
|
||||
dependency 'javax.cache:cache-api:1.1.1'
|
||||
dependency 'org.mock-server:mockserver-junit-jupiter:5.10.0'
|
||||
|
||||
// If this is upgraded, you need to change path in WebFrontEndConfiguration
|
||||
dependency 'org.webjars.npm:swagger-ui-dist:3.28.0'
|
||||
dependency 'org.webjars:webjars-locator-core:0.46'
|
||||
|
||||
dependency ('org.dom4j:dom4j:2.1.3') {
|
||||
exclude 'relaxngDatatype:relaxngDatatype' // already in com.sun.xml.bind:jaxb-osgi:2.3.0.1
|
||||
@@ -201,6 +200,7 @@ resolve {
|
||||
prettyPrint = 'TRUE'
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
outputDir = file("${buildDir}/classes/java/main/static/swagger-ui")
|
||||
openApiFile = file("config/swagger/fineract-input.json")
|
||||
}
|
||||
|
||||
// Configuration for JaCoCo code coverage task
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"openapi" : "3.0.3",
|
||||
"info": {
|
||||
"version": "1.4.0",
|
||||
"title": "Apache Fineract",
|
||||
"description": "Apache Fineract is a secure, multi-tenanted microfinance platform\n\nThe goal of the Apache Fineract API is to empower developers to build apps on top of the Apache Fineract Platform<br>The [reference app](https://cui.fineract.dev) (username: mifos, password: password) works on the same demo tenant as the interactive links in this documentation\n\n- The API is organized around [REST](https://en.wikipedia.org/wiki/Representational_state_transfer)\n- Find out more about Apache Fineract [here](/fineract-provider/api-docs/apiLive.htm#top)\n- You can [Try The API From Your Browser](/fineract-provider/api-docs/apiLive.htm#interact)\n- The Generic Options are available [here](/fineract-provider/api-docs/apiLive.htm#genopts)\n- Find out more about [Updating Dates and Numbers](/fineract-provider/api-docs/apiLive.htm#dates_and_numbers)\n- For the Authentication and the Basic of HTTP and HTTPS refer [here](/fineract-provider/api-docs/apiLive.htm#authentication_overview)\n- Check about ERROR codes [here](/fineract-provider/api-docs/apiLive.htm#errors)\n\nPlease refer to the [old documentation](/fineract-provider/api-docs/apiLive.htm) for any documentation queries",
|
||||
"termsOfService": "https://demo.fineract.dev/fineract-provider/api-docs/apiLive.htm",
|
||||
"contact": {
|
||||
"email": "dev@fineract.apache.org"
|
||||
},
|
||||
"license": {
|
||||
"name": "Apache 2.0",
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,8 @@ dependencies {
|
||||
'javax.cache:cache-api',
|
||||
|
||||
'com.github.spotbugs:spotbugs-annotations',
|
||||
'io.swagger.core.v3:swagger-annotations'
|
||||
'io.swagger.core.v3:swagger-annotations',
|
||||
'org.webjars:webjars-locator-core'
|
||||
)
|
||||
implementation ('org.apache.activemq:activemq-broker') {
|
||||
exclude group: 'org.apache.geronimo.specs'
|
||||
|
||||
+11
-3
@@ -18,16 +18,21 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.boot;
|
||||
|
||||
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
|
||||
@@ -36,9 +41,12 @@ public class WebFrontEndConfiguration implements WebMvcConfigurer {
|
||||
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
|
||||
}
|
||||
|
||||
// TODO: The below path should be version agnostic
|
||||
String[] SWAGGER_RESOURCE_LOCATIONS = { "classpath:/static/swagger-ui/",
|
||||
"classpath:/META-INF/resources/webjars/swagger-ui-dist/3.26.0/" };
|
||||
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);
|
||||
|
||||
String[] SWAGGER_RESOURCE_LOCATIONS = { "classpath:/static/swagger-ui/", "classpath:" + fullPathToSwaggerUi };
|
||||
|
||||
registry.addResourceHandler("/swagger-ui/**").addResourceLocations(SWAGGER_RESOURCE_LOCATIONS);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user