Apache Fineract supports client code generation using Swagger Codegen. Project supports all clients supported by Swagger Codegen. It uses OpenAPI Specification Version 3.0.3.
In root directory of the project:
- Run
./gradlew resolve
- Run
./gradlew generateSwaggerCode
The client code will be generated under build/swagger-code-fineract
- Run
cd build/swagger-code-fineract
- Run
./gradlew build
Alternatively, if you have Maven installed on your system, you can also do:
- Run
cd build/swagger-code-fineract
- Run
mvn clean package
Swagger Codegen provides several options to customize the generated code. Here are the options available for customization.
- Open the config.json.template file
- Customize options
- Build the project again as mentioned in Generate API Client Code section
Swagger Codegen uses Mustache Templates for generating the client library. For additional customizations you can add/edit custom templates inside the fineract-provider/config/swagger/templates
folder.
Make sure you are following the supported templates. Otherwise, the generated code will not build correctly.
If you need to add templates for a specific library, you need to follow the same directory structure as present in the links above.
The resolve
task in build.gradle file will generate the OpenAPI Spec File for the project. To make sure Swagger Codegen generates a correct library, it is important for the OpenAPI Spec file to be valid. Use Swagger OpenAPI Validator to validate the spec file.