FINERACT-838 Added Swagger Codegen Support (#1206)
incl. doc in README and new docs/developers/swagger/client.md
This commit is contained in:
@@ -263,6 +263,14 @@ API clients (Web UIs, Mobile, etc.)
|
||||
* https://github.com/openMF has more related proejcts
|
||||
|
||||
|
||||
Generate Apache Fineract API Client
|
||||
============
|
||||
|
||||
Apache Fineract supports client code generation using [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) based on the [OpenAPI Specification Version 3.0.3](https://swagger.io/specification/).
|
||||
|
||||
For more instructions on how to generate the client code, check `docs/developers/swagger/client.md`
|
||||
|
||||
|
||||
Online Demos
|
||||
============
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
Generate Apache Fineract API Client
|
||||
============
|
||||
|
||||
Apache Fineract supports client code generation using [Swagger Codegen](https://github.com/swagger-api/swagger-codegen). Project supports [all clients](https://github.com/swagger-api/swagger-codegen#overview) supported by Swagger Codegen. It uses [OpenAPI Specification Version 3.0.3](https://swagger.io/specification/).
|
||||
|
||||
## Generate API Client
|
||||
|
||||
In root directory of the project:
|
||||
|
||||
- Run `./gradlew build`
|
||||
- Run `./gradlew generateSwaggerCode`
|
||||
|
||||
The client code will be generated under `build/swagger-code-fineract`
|
||||
|
||||
## Build API Client:
|
||||
|
||||
- Run `cd build/swagger-code-fineract`
|
||||
- Run `./gradlew build`
|
||||
|
||||
## Customize Code Generator:
|
||||
|
||||
Swagger Codegen provides several options to customize the generated code. [Here](https://openapi-generator.tech/docs/generators/java/) are the options available for customization.
|
||||
|
||||
- Open `fineract-provider/config/swagger/config.json`
|
||||
- Customize options
|
||||
- Build the project again as mentioned in **Generate API Client Code** section
|
||||
@@ -56,6 +56,7 @@ buildscript {
|
||||
classpath "net.ltgt.gradle:gradle-errorprone-plugin:1.2.1"
|
||||
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.1.0"
|
||||
classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.4"
|
||||
classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.18.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +80,7 @@ apply plugin: "com.gorylenko.gradle-git-properties"
|
||||
apply plugin: "net.ltgt.errorprone"
|
||||
apply plugin: "com.diffplug.spotless"
|
||||
apply plugin: "io.swagger.core.v3.swagger-gradle-plugin"
|
||||
apply plugin: "org.hidetake.swagger.generator"
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
@@ -848,3 +850,18 @@ gitProperties {
|
||||
|
||||
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
|
||||
generateGitProperties.outputs.upToDateWhen { false }
|
||||
|
||||
//This is for swagger code generation
|
||||
dependencies {
|
||||
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.20'
|
||||
}
|
||||
|
||||
swaggerSources {
|
||||
fineract {
|
||||
inputFile = file('../build/classes/java/main/static/swagger-ui/fineract.yaml')
|
||||
code {
|
||||
language = 'java'
|
||||
configFile = file('config/swagger/config.json')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"groupId": "org.apache.fineract",
|
||||
"artifactId": "client",
|
||||
"artifactVersion": "1.4.0",
|
||||
"invokerPackage": "org.apache.fineract.client",
|
||||
"modelPackage": "org.apache.fineract.client.models",
|
||||
"apiPackage": "org.apache.fineract.client.services",
|
||||
"dateLibrary": "joda",
|
||||
"hideGenerationTimestamp": "true",
|
||||
"library": "retrofit2"
|
||||
}
|
||||
Reference in New Issue
Block a user