Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Java] Use html entities in javadoc of generated code #106

Merged
merged 1 commit into from
May 20, 2018

Conversation

jmini
Copy link
Member

@jmini jmini commented May 18, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script bin/java-petstore-all.sh
  • Filed the PR against the correct branch: Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

cc @bbdouglas (2017/07) @JFCote (2017/08) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01)

Description of the PR

Fix for #43: the javadoc should use html entities like ArrayList&lt;String&gt; and not ArrayList<String> for the maven build of the generated project to run without issue.

@jmini
Copy link
Member Author

jmini commented May 18, 2018

To test it you can run the java codegen on petstore.json like this:

        JavaClientCodegen config = new org.openapitools.codegen.languages.JavaClientCodegen();
        config.setArtifactId(artifactId);
        config.setJava8Mode(true);

        Path outputDirPath = Paths.get(outputDir);

        config.setHideGenerationTimestamp(true);
        config.setOutputDir(outputDir);

        final OpenAPIParser openApiParser = new OpenAPIParser();
        final ParseOptions options = new ParseOptions();
        final OpenAPI openAPI = openApiParser.readLocation(inputSpec, null, options).getOpenAPI();

        final ClientOptInput opts = new ClientOptInput();
        opts.setConfig(config);
        opts.setOpenAPI(openAPI);
        opts.setOpts(new ClientOpts());
        new DefaultGenerator().opts(opts).generate();

I get this change before and after the change:

--- a/org/openapitools/client/api/PetApi.java
+++ b/org/openapitools/client/api/PetApi.java
@@ -295,7 +295,7 @@ public class PetApi {
     }
     /**
      * Build call for findPetsByStatus
-     * @param status Status values that need to be considered for filter (optional, default to new ArrayList<String>())
+     * @param status Status values that need to be considered for filter (optional, default to new ArrayList&lt;String&gt;())
      * @param progressListener Progress listener
      * @param progressRequestListener Progress request listener
      * @return Call to execute
@@ -356,7 +356,7 @@ public class PetApi {
     /**
      * Finds Pets by status
      * Multiple status values can be provided with comma separated strings
-     * @param status Status values that need to be considered for filter (optional, default to new ArrayList<String>())
+     * @param status Status values that need to be considered for filter (optional, default to new ArrayList&lt;String&gt;())
      * @return List&lt;Pet&gt;
      * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
      */
@@ -368,7 +368,7 @@ public class PetApi {
     /**
      * Finds Pets by status
      * Multiple status values can be provided with comma separated strings
-     * @param status Status values that need to be considered for filter (optional, default to new ArrayList<String>())
+     * @param status Status values that need to be considered for filter (optional, default to new ArrayList&lt;String&gt;())
      * @return ApiResponse&lt;List&lt;Pet&gt;&gt;
      * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
      */
@@ -381,7 +381,7 @@ public class PetApi {
     /**
      * Finds Pets by status (asynchronously)
      * Multiple status values can be provided with comma separated strings
-     * @param status Status values that need to be considered for filter (optional, default to new ArrayList<String>())
+     * @param status Status values that need to be considered for filter (optional, default to new ArrayList&lt;String&gt;())
      * @param callback The callback to be executed when the API call finishes
      * @return The request call
      * @throws ApiException If fail to process the API call, e.g. serializing the request body object

@jmini jmini added this to the 3.0.0 milestone May 18, 2018
Copy link
Member

@wing328 wing328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check to see if we need to do something similar to C# templates.

@jmini jmini merged commit 495971c into OpenAPITools:master May 20, 2018
@jmini jmini deleted the issue43 branch May 20, 2018 06:56
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request May 23, 2018
* master: (36 commits)
  jaxrs-cxf-cdi: fix outer enum (OpenAPITools#131)
  Move bash argv opt to end of ags line in scripts (OpenAPITools#124)
  Reduce CI logging (OpenAPITools#119)
  Download elm dependencies without prompting user. (OpenAPITools#118)
  [aspnetcore] Make the use of Swashbuckle optional (OpenAPITools#110)
  DefaultGenerator: fix NullPointerException (OpenAPITools#109)
  [Java] use html entities in javadoc of generated code (OpenAPITools#106)
  Update PULL_REQUEST_TEMPLATE.md
  [java] Enum in array of array (OpenAPITools#66)
  Rename datatype to dataType in CodegenProperty (OpenAPITools#69)
  update elm test to compile all elm files (OpenAPITools#95)
  Fix Petstore example for Elm (OpenAPITools#96)
  Update Docker documentation (OpenAPITools#97)
  CaseFormatLambda has been added, params for Rest-assured client has been refactored (OpenAPITools#91)
  Update integration.md
  [Clojure] Add util method to set the api-context globally (OpenAPITools#93)
  [JaxRS-Java] issue with implFolder on windows, and required fields generation for containers (OpenAPITools#88)
  Set parameters allowableValues dynamically (OpenAPITools#65)
  Meta: set version for "build-helper-maven-plugin" (OpenAPITools#89)
  Fix javadoc issues in "openapi-generator" module (OpenAPITools#84)
  ...
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants