You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/08/24 08:46:16 UTC

[GitHub] [fineract] Grandolf49 opened a new pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Grandolf49 opened a new pull request #1271:
URL: https://github.com/apache/fineract/pull/1271


   ## Description
   This PR addresses FINERACT-1101 issue. Following were the problems earlier:
   1. Library generated by `./gradlew generateSwaggerCode` was required to be build using `mvn package` only. If a user executed `./gradlew build`, the build used to fail saying `Could not determine java version from '11.0.8'.` The issue was with the gradle-wrapper of the project. This is resolved by adding the Mustache Template for the `gradle-wrapper.properties` file.
   
   2. Moreover, `mvn package` also failed due to an error in `maven-javadoc-plugin`. It was using the version `2.10.4` and was failing because of that. Version `3.2.0` worked correctly. This is resolved by adding the Mustache template for the `pom.xml` file
   
   3. To be able to use Mustache Templates, we needed `swagger-codegen-cli` version `3.0.21`. But if we used version `3.0.21` to generate swagger code, it would fail throwing an error `Missing OpenAPI File`. This was because the generated OpenAPI file was invalid. This was preventing to use the Mustache Templates. This is resolved in this [PR](https://github.com/apache/fineract/pull/1270).
   
   Updated the `client.md` file with necessary documentation
   
   ## Checklist
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [x] Commit message starts with the issue number from https://issues.apache.org/jira/projects/FINERACT/. Ex: FINERACT-646 Pockets API.
   
   - [x] Coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions have been followed.
   
   - [x] API documentation at fineract-provider/src/main/resources/static/api-docs/apiLive.htm has been updated with details of any API changes.
   
   - [x] Integration tests have been created/updated for verifying the changes made.
   
   - [x] All Integrations tests are passing with the new commits.
   
   - [x] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the list.)
   
   Our guidelines for code reviews is at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] Grandolf49 commented on pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Posted by GitBox <gi...@apache.org>.
Grandolf49 commented on pull request #1271:
URL: https://github.com/apache/fineract/pull/1271#issuecomment-679054895


   @awasum Thanks for the solution. It worked! I'll update the PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger merged pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Posted by GitBox <gi...@apache.org>.
vorburger merged pull request #1271:
URL: https://github.com/apache/fineract/pull/1271


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] Grandolf49 commented on pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Posted by GitBox <gi...@apache.org>.
Grandolf49 commented on pull request #1271:
URL: https://github.com/apache/fineract/pull/1271#issuecomment-679039355


   Hi @awasum  I checked the error. It is saying 
   ```
   Unapproved Licenses:
   fineract-provider/config/swagger/templates/gradle-wrapper.properties.mustache
   fineract-provider/config/swagger/templates/pom.mustache
   ```
   
   Can you help me resolve this?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger commented on a change in pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Posted by GitBox <gi...@apache.org>.
vorburger commented on a change in pull request #1271:
URL: https://github.com/apache/fineract/pull/1271#discussion_r476538927



##########
File path: docs/developers/swagger/client.md
##########
@@ -7,20 +7,40 @@ Apache Fineract supports client code generation using [Swagger Codegen](https://
 
 In root directory of the project:
 
-- Run `./gradlew build`
+- Run `./gradlew resolve`
 - Run `./gradlew generateSwaggerCode`
 
 The client code will be generated under `build/swagger-code-fineract`
 
-## Build API Client:
+## Build API Client
 
 - Run `cd build/swagger-code-fineract`
 - Run `./gradlew build`
 
-## Customize Code Generator:
+Alternatively, if you have Maven installed on your system, you can also do:
+
+- Run `cd build/swagger-code-fineract`
+- Run `mvn clean package`
+
+## Customize Generated Code
 
 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`
+- Open the [config.json.template](https://github.com/apache/fineract/blob/develop/fineract-provider/config/swagger/config.json.template) file
 - Customize options
-- Build the project again as mentioned in **Generate API Client Code** section
\ No newline at end of file
+- Build the project again as mentioned in **Generate API Client Code** section
+  
+## Customize using Mustache Templates
+
+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.
+
+- [Java Mustache Templates](https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources/Java)
+- [Retrofit2 Mustache Templates](https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2)
+
+If you need to add templates for a specific library, you need to follow the same directory structure as present in the links above.
+
+## Validate OpenAPI Spec File
+
+The `resolve` task in [build.gradle](https://github.com/apache/fineract/blob/217e34ba9e4cf04ad7b82fc3a0f8f8e5f8de8042/fineract-provider/build.gradle#L212) 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](https://validator.swagger.io/) to validate the spec file.

Review comment:
       the use of a particular commit here was probably an oversight, and you meant to use `develop` here, like in line 29? Actually, I wonder if you couldn't just use a relative path (like `...../fineract-provider/...` you what I mean here?)
   
   ```suggestion
   The `resolve` task in [build.gradle](https://github.com/apache/fineract/blob/develop/fineract-provider/build.gradle#L212) 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](https://validator.swagger.io/) to validate the spec file.
   ```

##########
File path: fineract-provider/config/swagger/config.json.template
##########
@@ -5,6 +5,7 @@
    "invokerPackage": "org.apache.fineract.client",
    "modelPackage": "org.apache.fineract.client.models",
    "apiPackage": "org.apache.fineract.client.services",
+   "artifactDescription": "A Java and Retrofit2 based client library for Apache Fineract 1.x Platform",

Review comment:
       I think we usually just call it "Apache Fineract" (VS "Fineract CN"), not "1.x" (I think).
   
   ```suggestion
      "artifactDescription": "A Java and Retrofit2 based client library for Apache Fineract Platform",
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] awasum commented on pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Posted by GitBox <gi...@apache.org>.
awasum commented on pull request #1271:
URL: https://github.com/apache/fineract/pull/1271#issuecomment-679040017


   Ignore the file from rat checks as seen in the build.gradle file.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] awasum commented on pull request #1271: FINERACT-1101 Swagger Codegen build using Gradle

Posted by GitBox <gi...@apache.org>.
awasum commented on pull request #1271:
URL: https://github.com/apache/fineract/pull/1271#issuecomment-679002784


   An Apache RAT test is failing. Make sure you run this branch on your local machine and all builds and tests are passing. https://travis-ci.org/github/apache/fineract/builds/720575703


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org