From 2e3c4f58a656eb429f9eb814044beeac28412b3f Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Mon, 11 Feb 2019 19:16:40 +0800
Subject: [PATCH 1/3] add auto-generated doc for r client

---
 .../codegen/languages/RClientCodegen.java     | 164 ++++++++-
 .../src/main/resources/r/README.mustache      |  68 +++-
 .../src/main/resources/r/api_doc.mustache     |  46 ++-
 .../src/main/resources/r/model_doc.mustache   |   6 +-
 samples/client/petstore/R/R/PetApi.r          |  38 +-
 samples/client/petstore/R/R/StoreApi.r        |  14 +-
 samples/client/petstore/R/R/UserApi.r         |  12 +-
 samples/client/petstore/R/README.md           |  89 ++++-
 samples/client/petstore/R/docs/ApiResponse.md |  10 +
 samples/client/petstore/R/docs/Category.md    |   9 +
 samples/client/petstore/R/docs/Order.md       |  13 +
 samples/client/petstore/R/docs/Pet.md         |  13 +
 samples/client/petstore/R/docs/PetApi.md      | 324 ++++++++++++++++++
 samples/client/petstore/R/docs/StoreApi.md    | 161 +++++++++
 samples/client/petstore/R/docs/Tag.md         |   9 +
 samples/client/petstore/R/docs/User.md        |  15 +
 samples/client/petstore/R/docs/UserApi.md     | 312 +++++++++++++++++
 17 files changed, 1228 insertions(+), 75 deletions(-)
 create mode 100644 samples/client/petstore/R/docs/ApiResponse.md
 create mode 100644 samples/client/petstore/R/docs/Category.md
 create mode 100644 samples/client/petstore/R/docs/Order.md
 create mode 100644 samples/client/petstore/R/docs/Pet.md
 create mode 100644 samples/client/petstore/R/docs/PetApi.md
 create mode 100644 samples/client/petstore/R/docs/StoreApi.md
 create mode 100644 samples/client/petstore/R/docs/Tag.md
 create mode 100644 samples/client/petstore/R/docs/User.md
 create mode 100644 samples/client/petstore/R/docs/UserApi.md

diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java
index 36ff03e6b1e..e967fefafa8 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java
@@ -17,8 +17,10 @@
 
 package org.openapitools.codegen.languages;
 
+import io.swagger.v3.oas.models.examples.Example;
 import io.swagger.v3.oas.models.media.ArraySchema;
 import io.swagger.v3.oas.models.media.Schema;
+import io.swagger.v3.oas.models.parameters.Parameter;
 import org.apache.commons.lang3.StringUtils;
 import org.openapitools.codegen.*;
 import org.openapitools.codegen.utils.ModelUtils;
@@ -27,6 +29,7 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.util.*;
+import java.util.regex.Pattern;
 
 import static org.openapitools.codegen.utils.StringUtils.camelize;
 import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -133,8 +136,8 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
         apiTestTemplateFiles.clear(); // TODO: add api test template
         modelTestTemplateFiles.clear(); // TODO: add model test template
 
-        apiDocTemplateFiles.clear(); // TODO: add api doc template
-        modelDocTemplateFiles.clear(); // TODO: add model doc template
+        modelDocTemplateFiles.put("model_doc.mustache", ".md");
+        apiDocTemplateFiles.put("api_doc.mustache", ".md");
 
         modelPackage = packageName;
         apiPackage = packageName;
@@ -205,7 +208,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
 
     @Override
     public String toParamName(String name) {
-        return toVarName(name);
+        return toVarName(name).replace("_", ".");
     }
 
     @Override
@@ -450,4 +453,159 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
             return enumName;
         }
     }
+
+    @Override
+    public void setParameterExampleValue(CodegenParameter p) {
+        String example;
+
+        if (p.defaultValue == null) {
+            example = p.example;
+        } else {
+            p.example = p.defaultValue;
+            return;
+        }
+
+        String type = p.baseType;
+        if (type == null) {
+            type = p.dataType;
+        }
+
+        if ("character".equals(type)) {
+            if (example == null) {
+                example = p.paramName + "_example";
+            }
+            example = "'" + escapeText(example) + "'";
+        } else if ("integer".equals(type)) {
+            if (example == null) {
+                example = "56";
+            }
+        } else if ("numeric".equals(type)) {
+            if (example == null) {
+                example = "3.4";
+            }
+        } else if ("data.frame".equals(type)) {
+            if (example == null) {
+                example = "/path/to/file";
+            }
+            example = "File.new('" + escapeText(example) + "')";
+        } else if (!languageSpecificPrimitives.contains(type)) {
+            // type is a model class, e.g. User
+            example = type + "$new";
+        }
+
+        if (example == null) {
+            example = "NULL";
+        } else if (Boolean.TRUE.equals(p.isListContainer)) {
+            example = "[" + example + "]";
+        } else if (Boolean.TRUE.equals(p.isMapContainer)) {
+            example = "{'key' => " + example + "}";
+        }
+
+        p.example = example;
+    }
+
+    /**
+     * Return the example value of the parameter. Overrides the
+     * setParameterExampleValue(CodegenParameter, Parameter) method in
+     * DefaultCodegen to always call setParameterExampleValue(CodegenParameter)
+     * in this class, which adds single quotes around strings from the
+     * x-example property.
+     *
+     * @param codegenParameter Codegen parameter
+     * @param parameter        Parameter
+     */
+    public void setParameterExampleValue(CodegenParameter codegenParameter, Parameter parameter) {
+        if (parameter.getExample() != null) {
+            codegenParameter.example = parameter.getExample().toString();
+        } else if (parameter.getExamples() != null && !parameter.getExamples().isEmpty()) {
+            Example example = parameter.getExamples().values().iterator().next();
+            if (example.getValue() != null) {
+                codegenParameter.example = example.getValue().toString();
+            }
+        } else {
+            Schema schema = parameter.getSchema();
+            if (schema != null && schema.getExample() != null) {
+                codegenParameter.example = schema.getExample().toString();
+            }
+        }
+
+        setParameterExampleValue(codegenParameter);
+    }
+
+    /**
+     * Return the default value of the property
+     * @param p OpenAPI property object
+     * @return string presentation of the default value of the property
+     */
+    @Override
+    public String toDefaultValue(Schema p) {
+        if (ModelUtils.isBooleanSchema(p)) {
+            if (p.getDefault() != null) {
+                if (Boolean.valueOf(p.getDefault().toString()) == false)
+                    return "False";
+                else
+                    return "True";
+            }
+            // include fallback to example, default defined as server only
+            // example is not defined as server only
+            if (p.getExample() != null) {
+                if (Boolean.valueOf(p.getExample().toString()) == false)
+                    return "False";
+                else
+                    return "True";
+            }
+        } else if (ModelUtils.isDateSchema(p)) {
+            // TODO
+        } else if (ModelUtils.isDateTimeSchema(p)) {
+            // TODO
+        } else if (ModelUtils.isNumberSchema(p)) {
+            if (p.getDefault() != null) {
+                return p.getDefault().toString();
+            }
+            // default numbers are not yet returned by v2 spec openAPI results
+            // https://github.com/swagger-api/swagger-parser/issues/971
+            // include fallback to example, default defined as server only
+            // example is not defined as server only
+            if (p.getExample() != null) {
+                return p.getExample().toString();
+            }
+        } else if (ModelUtils.isIntegerSchema(p)) {
+            if (p.getDefault() != null) {
+                return p.getDefault().toString();
+            }
+            // default integers are not yet returned by v2 spec openAPI results
+            // https://github.com/swagger-api/swagger-parser/issues/971
+            // include fallback to example, default defined as server only
+            // example is not defined as server only
+            if (p.getExample() != null) {
+                return p.getExample().toString();
+            }
+        } else if (ModelUtils.isStringSchema(p)) {
+            if (p.getDefault() != null) {
+                if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getDefault()).find())
+                    return "'''" + p.getDefault() + "'''";
+                else
+                    return "'" + p.getDefault() + "'";
+            }
+            // include fallback to example, default defined as server only
+            // example is not defined as server only
+            if (p.getExample() != null) {
+                if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getExample()).find())
+                    return "'''" + p.getExample() + "'''";
+                else
+                    return "'" + p.getExample() + "'";
+            }
+        } else if (ModelUtils.isArraySchema(p)) {
+            if (p.getDefault() != null) {
+                return p.getDefault().toString();
+            }
+            // include fallback to example, default defined as server only
+            // example is not defined as server only
+            if (p.getExample() != null) {
+                return p.getExample().toString();
+            }
+        }
+
+        return null;
+    }
 }
diff --git a/modules/openapi-generator/src/main/resources/r/README.mustache b/modules/openapi-generator/src/main/resources/r/README.mustache
index 39c87067d2b..2bd30edc1ba 100644
--- a/modules/openapi-generator/src/main/resources/r/README.mustache
+++ b/modules/openapi-generator/src/main/resources/r/README.mustache
@@ -18,23 +18,73 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
 {{/infoUrl}}
 
 ## Installation
-You'll need the `devtools` package in order to build the API.
-Make sure you have a proper CRAN repository from which you can download packages.
 
 ### Prerequisites
-Install the `devtools` package with the following command.
+
+Install the dependencies
+
+```R
+install.packages("jsonlite")
+install.packages("httr")
+```
+
+### Build the package
+
+```sh
+- R CMD build .
+- R CMD check {{{packageName}}}_{{{packageVersion}}}.tar.gz
+- R CMD INSTALL {{{packageName}}}_{{{packageVersion}}}.tar.gz
+```
+
+### Install the package
+
 ```R
-if(!require(devtools)) { install.packages("devtools") }
+install.packages("{{{packageName}}}")
 ```
 
-### Installation of the API package
-Make sure you set the working directory to where the API code is located.
-Then execute
+### Usage
+
 ```R
-library(devtools)
-install(".")
+libary({{{packageName}}})
 ```
 
+## Documentation for API Endpoints
+
+All URIs are relative to *{{basePath}}*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
+{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
+
+## Documentation for Models
+
+{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
+{{/model}}{{/models}}
+
+## Documentation for Authorization
+
+{{^authMethods}} All endpoints do not require authorization.
+{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
+{{#authMethods}}### {{name}}
+
+{{#isApiKey}}- **Type**: API key
+- **API key parameter name**: {{keyParamName}}
+- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
+{{/isApiKey}}
+{{#isBasic}}- **Type**: HTTP basic authentication
+{{/isBasic}}
+{{#isOAuth}}- **Type**: OAuth
+- **Flow**: {{flow}}
+- **Authorization URL**: {{authorizationUrl}}
+- **Scopes**: {{^scopes}}N/A{{/scopes}}
+{{#scopes}}  - {{scope}}: {{description}}
+{{/scopes}}
+{{/isOAuth}}
+
+{{/authMethods}}
+
+
 ## Author
 
 {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
diff --git a/modules/openapi-generator/src/main/resources/r/api_doc.mustache b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
index 70d0b96ce86..10105710b72 100644
--- a/modules/openapi-generator/src/main/resources/r/api_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
@@ -1,4 +1,4 @@
-# {{invokerPackage}}\{{classname}}{{#description}}
+# {{moduleName}}::{{classname}}{{#description}}
 {{description}}{{/description}}
 
 All URIs are relative to *{{basePath}}*
@@ -10,41 +10,51 @@ Method | HTTP request | Description
 
 {{#operations}}
 {{#operation}}
-# **{{{operationId}}}**
-> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#authMethods}}ctx, {{/authMethods}}{{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}})
+# **{{operationId}}**
+> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#requiredParams}}var.{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}}{{#defaultValue}}={{{.}}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/optionalParams}})
+
 {{{summary}}}{{#notes}}
 
 {{{notes}}}{{/notes}}
 
-### Required Parameters
+### Example
+```R
+library({{{packageName}}})
+
+{{#allParams}}
+var.{{{paramName}}} <- {{{example}}} # {{{dataType}}} | {{{description}}}
+{{/allParams}}
+
+{{#summary}}
+#{{{.}}}
+{{/summary}}
+{{#returnType}}result = {{/returnType}}{{{classname}}}${{{operationId}}}({{#requiredParams}}var.{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}}=var.{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}})
+{{#returnType}}
+dput(result)
+{{/returnType}}
+```
+
+### Parameters
 {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
 Name | Type | Description  | Notes
-------------- | ------------- | ------------- | -------------{{#authMethods}}
- **ctx** | **context.Context** | context containing the authentication | nil if no authentication{{/authMethods}}{{/-last}}{{/allParams}}{{#allParams}}{{#required}}
-  **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}}
- **optional** | **map[string]interface{}** | optional parameters | nil if no parameters
-
-### Optional Parameters
-Optional parameters are passed through a map[string]interface{}.
-{{#allParams}}{{#-last}}
-Name | Type | Description  | Notes
-------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}}
- **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}}
+------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
+{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
+{{/allParams}}
 
 ### Return type
 
-{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}}
+{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}}
 
 ### Authorization
 
-{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
+{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
 
 ### HTTP request headers
 
  - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
  - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
 
-[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
 
 {{/operation}}
 {{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/r/model_doc.mustache b/modules/openapi-generator/src/main/resources/r/model_doc.mustache
index ccfd3f8d0de..22fc527cc08 100644
--- a/modules/openapi-generator/src/main/resources/r/model_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/r/model_doc.mustache
@@ -1,11 +1,9 @@
-{{#models}}{{#model}}# {{classname}}
+{{#models}}{{#model}}# {{packageName}}::{{classname}}
 
 ## Properties
 Name | Type | Description | Notes
 ------------ | ------------- | ------------- | -------------
-{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
+{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
 {{/vars}}
 
-[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
-
 {{/model}}{{/models}}
diff --git a/samples/client/petstore/R/R/PetApi.r b/samples/client/petstore/R/R/PetApi.r
index f86721afb63..95ef71bdb3d 100644
--- a/samples/client/petstore/R/R/PetApi.r
+++ b/samples/client/petstore/R/R/PetApi.r
@@ -77,7 +77,7 @@ PetApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -85,18 +85,18 @@ PetApi <- R6::R6Class(
       }
 
     },
-    DeletePet = function(pet_id, api_key, ...){
+    DeletePet = function(pet.id, api.key, ...){
       args <- list(...)
       queryParams <- list()
       headerParams <- character()
 
-      if (!missing(`api_key`)) {
-        headerParams['api_key'] <- `api_key`
+      if (!missing(`api.key`)) {
+        headerParams['api_key'] <- `api.key`
       }
 
       urlPath <- "/pet/{petId}"
-      if (!missing(`pet_id`)) {
-        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet_id`, urlPath)
+      if (!missing(`pet.id`)) {
+        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
       }
 
       resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
@@ -107,7 +107,7 @@ PetApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -167,14 +167,14 @@ PetApi <- R6::R6Class(
       }
 
     },
-    GetPetById = function(pet_id, ...){
+    GetPetById = function(pet.id, ...){
       args <- list(...)
       queryParams <- list()
       headerParams <- character()
 
       urlPath <- "/pet/{petId}"
-      if (!missing(`pet_id`)) {
-        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet_id`, urlPath)
+      if (!missing(`pet.id`)) {
+        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
       }
 
       resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
@@ -213,7 +213,7 @@ PetApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -221,7 +221,7 @@ PetApi <- R6::R6Class(
       }
 
     },
-    UpdatePetWithForm = function(pet_id, name, status, ...){
+    UpdatePetWithForm = function(pet.id, name, status, ...){
       args <- list(...)
       queryParams <- list()
       headerParams <- character()
@@ -232,8 +232,8 @@ PetApi <- R6::R6Class(
       )
 
       urlPath <- "/pet/{petId}"
-      if (!missing(`pet_id`)) {
-        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet_id`, urlPath)
+      if (!missing(`pet.id`)) {
+        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
       }
 
       resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
@@ -244,7 +244,7 @@ PetApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -252,19 +252,19 @@ PetApi <- R6::R6Class(
       }
 
     },
-    UploadFile = function(pet_id, additional_metadata, file, ...){
+    UploadFile = function(pet.id, additional.metadata, file, ...){
       args <- list(...)
       queryParams <- list()
       headerParams <- character()
 
       body <- list(
-        "additionalMetadata" = additional_metadata,
+        "additionalMetadata" = additional.metadata,
         "file" = httr::upload_file(file)
       )
 
       urlPath <- "/pet/{petId}/uploadImage"
-      if (!missing(`pet_id`)) {
-        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet_id`, urlPath)
+      if (!missing(`pet.id`)) {
+        urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
       }
 
       resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
diff --git a/samples/client/petstore/R/R/StoreApi.r b/samples/client/petstore/R/R/StoreApi.r
index bd3b612fdcd..e761a24471b 100644
--- a/samples/client/petstore/R/R/StoreApi.r
+++ b/samples/client/petstore/R/R/StoreApi.r
@@ -45,14 +45,14 @@ StoreApi <- R6::R6Class(
         self$apiClient <- ApiClient$new()
       }
     },
-    DeleteOrder = function(order_id, ...){
+    DeleteOrder = function(order.id, ...){
       args <- list(...)
       queryParams <- list()
       headerParams <- character()
 
       urlPath <- "/store/order/{orderId}"
-      if (!missing(`order_id`)) {
-        urlPath <- gsub(paste0("\\{", "orderId", "\\}"), `order_id`, urlPath)
+      if (!missing(`order.id`)) {
+        urlPath <- gsub(paste0("\\{", "orderId", "\\}"), `order.id`, urlPath)
       }
 
       resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
@@ -63,7 +63,7 @@ StoreApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -93,14 +93,14 @@ StoreApi <- R6::R6Class(
       }
 
     },
-    GetOrderById = function(order_id, ...){
+    GetOrderById = function(order.id, ...){
       args <- list(...)
       queryParams <- list()
       headerParams <- character()
 
       urlPath <- "/store/order/{orderId}"
-      if (!missing(`order_id`)) {
-        urlPath <- gsub(paste0("\\{", "orderId", "\\}"), `order_id`, urlPath)
+      if (!missing(`order.id`)) {
+        urlPath <- gsub(paste0("\\{", "orderId", "\\}"), `order.id`, urlPath)
       }
 
       resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
diff --git a/samples/client/petstore/R/R/UserApi.r b/samples/client/petstore/R/R/UserApi.r
index 0aee8708151..f71e4ad4fbb 100644
--- a/samples/client/petstore/R/R/UserApi.r
+++ b/samples/client/petstore/R/R/UserApi.r
@@ -77,7 +77,7 @@ UserApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -105,7 +105,7 @@ UserApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -133,7 +133,7 @@ UserApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -159,7 +159,7 @@ UserApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -237,7 +237,7 @@ UserApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -269,7 +269,7 @@ UserApi <- R6::R6Class(
                                  ...)
 
       if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
-            # void response, no need to return anything
+        # void response, no need to return anything
       } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
         Response$new("API client error", resp)
       } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
diff --git a/samples/client/petstore/R/README.md b/samples/client/petstore/R/README.md
index aaff38b9646..c772fd1175b 100644
--- a/samples/client/petstore/R/README.md
+++ b/samples/client/petstore/R/README.md
@@ -10,23 +10,94 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
 - Build package: org.openapitools.codegen.languages.RClientCodegen
 
 ## Installation
-You'll need the `devtools` package in order to build the API.
-Make sure you have a proper CRAN repository from which you can download packages.
 
 ### Prerequisites
-Install the `devtools` package with the following command.
+
+Install the dependencies
+
 ```R
-if(!require(devtools)) { install.packages("devtools") }
+install.packages("jsonlite")
+install.packages("httr")
 ```
 
-### Installation of the API package
-Make sure you set the working directory to where the API code is located.
-Then execute
+### Build the package
+
+```sh
+- R CMD build .
+- R CMD check petstore_1.0.0.tar.gz
+- R CMD INSTALL petstore_1.0.0.tar.gz
+```
+
+### Install the package
+
 ```R
-library(devtools)
-install(".")
+install.packages("petstore")
 ```
 
+### Usage
+
+```R
+libary(petstore)
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*::PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
+*::PetApi* | [**DeletePet**](docs/PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet
+*::PetApi* | [**FindPetsByStatus**](docs/PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
+*::PetApi* | [**FindPetsByTags**](docs/PetApi.md#FindPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
+*::PetApi* | [**GetPetById**](docs/PetApi.md#GetPetById) | **GET** /pet/{petId} | Find pet by ID
+*::PetApi* | [**UpdatePet**](docs/PetApi.md#UpdatePet) | **PUT** /pet | Update an existing pet
+*::PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#UpdatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
+*::PetApi* | [**UploadFile**](docs/PetApi.md#UploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
+*::StoreApi* | [**DeleteOrder**](docs/StoreApi.md#DeleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
+*::StoreApi* | [**GetInventory**](docs/StoreApi.md#GetInventory) | **GET** /store/inventory | Returns pet inventories by status
+*::StoreApi* | [**GetOrderById**](docs/StoreApi.md#GetOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
+*::StoreApi* | [**PlaceOrder**](docs/StoreApi.md#PlaceOrder) | **POST** /store/order | Place an order for a pet
+*::UserApi* | [**CreateUser**](docs/UserApi.md#CreateUser) | **POST** /user | Create user
+*::UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#CreateUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
+*::UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#CreateUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
+*::UserApi* | [**DeleteUser**](docs/UserApi.md#DeleteUser) | **DELETE** /user/{username} | Delete user
+*::UserApi* | [**GetUserByName**](docs/UserApi.md#GetUserByName) | **GET** /user/{username} | Get user by user name
+*::UserApi* | [**LoginUser**](docs/UserApi.md#LoginUser) | **GET** /user/login | Logs user into the system
+*::UserApi* | [**LogoutUser**](docs/UserApi.md#LogoutUser) | **GET** /user/logout | Logs out current logged in user session
+*::UserApi* | [**UpdateUser**](docs/UserApi.md#UpdateUser) | **PUT** /user/{username} | Updated user
+
+
+## Documentation for Models
+
+ - [::ApiResponse](docs/ApiResponse.md)
+ - [::Category](docs/Category.md)
+ - [::Order](docs/Order.md)
+ - [::Pet](docs/Pet.md)
+ - [::Tag](docs/Tag.md)
+ - [::User](docs/User.md)
+
+
+## Documentation for Authorization
+
+
+### api_key
+
+- **Type**: API key
+- **API key parameter name**: api_key
+- **Location**: HTTP header
+
+### petstore_auth
+
+- **Type**: OAuth
+- **Flow**: implicit
+- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
+- **Scopes**: 
+  - write:pets: modify pets in your account
+  - read:pets: read your pets
+
+
+
 ## Author
 
 
diff --git a/samples/client/petstore/R/docs/ApiResponse.md b/samples/client/petstore/R/docs/ApiResponse.md
new file mode 100644
index 00000000000..ef38431e4cf
--- /dev/null
+++ b/samples/client/petstore/R/docs/ApiResponse.md
@@ -0,0 +1,10 @@
+# petstore::ApiResponse
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**code** | **integer** |  | [optional] 
+**type** | **character** |  | [optional] 
+**message** | **character** |  | [optional] 
+
+
diff --git a/samples/client/petstore/R/docs/Category.md b/samples/client/petstore/R/docs/Category.md
new file mode 100644
index 00000000000..700ed1c4c08
--- /dev/null
+++ b/samples/client/petstore/R/docs/Category.md
@@ -0,0 +1,9 @@
+# petstore::Category
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **integer** |  | [optional] 
+**name** | **character** |  | [optional] 
+
+
diff --git a/samples/client/petstore/R/docs/Order.md b/samples/client/petstore/R/docs/Order.md
new file mode 100644
index 00000000000..9ef7ef61a94
--- /dev/null
+++ b/samples/client/petstore/R/docs/Order.md
@@ -0,0 +1,13 @@
+# petstore::Order
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **integer** |  | [optional] 
+**pet_id** | **integer** |  | [optional] 
+**quantity** | **integer** |  | [optional] 
+**ship_date** | **character** |  | [optional] 
+**status** | **character** | Order Status | [optional] 
+**complete** | **character** |  | [optional] [default to False]
+
+
diff --git a/samples/client/petstore/R/docs/Pet.md b/samples/client/petstore/R/docs/Pet.md
new file mode 100644
index 00000000000..bfc2161b78b
--- /dev/null
+++ b/samples/client/petstore/R/docs/Pet.md
@@ -0,0 +1,13 @@
+# petstore::Pet
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **integer** |  | [optional] 
+**category** | [**Category**](Category.md) |  | [optional] 
+**name** | **character** |  | [default to &#39;doggie&#39;]
+**photo_urls** | **character** |  | 
+**tags** | [**Tag**](Tag.md) |  | [optional] 
+**status** | **character** | pet status in the store | [optional] 
+
+
diff --git a/samples/client/petstore/R/docs/PetApi.md b/samples/client/petstore/R/docs/PetApi.md
new file mode 100644
index 00000000000..15f2a52b0bc
--- /dev/null
+++ b/samples/client/petstore/R/docs/PetApi.md
@@ -0,0 +1,324 @@
+# ::PetApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**AddPet**](PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
+[**DeletePet**](PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet
+[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
+[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
+[**GetPetById**](PetApi.md#GetPetById) | **GET** /pet/{petId} | Find pet by ID
+[**UpdatePet**](PetApi.md#UpdatePet) | **PUT** /pet | Update an existing pet
+[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
+[**UploadFile**](PetApi.md#UploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
+
+
+# **AddPet**
+> AddPet(var.body)
+
+Add a new pet to the store
+
+### Example
+```R
+library(petstore)
+
+var.body <- Pet$new # Pet | Pet object that needs to be added to the store
+
+#Add a new pet to the store
+PetApi$AddPet(var.body)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json, application/xml
+ - **Accept**: Not defined
+
+
+
+# **DeletePet**
+> DeletePet(var.pet.id, api.key)
+
+Deletes a pet
+
+### Example
+```R
+library(petstore)
+
+var.pet.id <- 56 # integer | Pet id to delete
+var.api.key <- 'api.key_example' # character | 
+
+#Deletes a pet
+PetApi$DeletePet(var.pet.id, api.key=var.api.key)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **pet.id** | **integer**| Pet id to delete | 
+ **api.key** | **character**|  | [optional] 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **FindPetsByStatus**
+> Pet FindPetsByStatus(var.status)
+
+Finds Pets by status
+
+Multiple status values can be provided with comma separated strings
+
+### Example
+```R
+library(petstore)
+
+var.status <- ['status_example'] # character | Status values that need to be considered for filter
+
+#Finds Pets by status
+result = PetApi$FindPetsByStatus(var.status)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **status** | [**character**](character.md)| Status values that need to be considered for filter | 
+
+### Return type
+
+[**Pet**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
+# **FindPetsByTags**
+> Pet FindPetsByTags(var.tags)
+
+Finds Pets by tags
+
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+
+### Example
+```R
+library(petstore)
+
+var.tags <- ['tags_example'] # character | Tags to filter by
+
+#Finds Pets by tags
+result = PetApi$FindPetsByTags(var.tags)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **tags** | [**character**](character.md)| Tags to filter by | 
+
+### Return type
+
+[**Pet**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
+# **GetPetById**
+> Pet GetPetById(var.pet.id)
+
+Find pet by ID
+
+Returns a single pet
+
+### Example
+```R
+library(petstore)
+
+var.pet.id <- 56 # integer | ID of pet to return
+
+#Find pet by ID
+result = PetApi$GetPetById(var.pet.id)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **pet.id** | **integer**| ID of pet to return | 
+
+### Return type
+
+[**Pet**](Pet.md)
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
+# **UpdatePet**
+> UpdatePet(var.body)
+
+Update an existing pet
+
+### Example
+```R
+library(petstore)
+
+var.body <- Pet$new # Pet | Pet object that needs to be added to the store
+
+#Update an existing pet
+PetApi$UpdatePet(var.body)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json, application/xml
+ - **Accept**: Not defined
+
+
+
+# **UpdatePetWithForm**
+> UpdatePetWithForm(var.pet.id, name, status)
+
+Updates a pet in the store with form data
+
+### Example
+```R
+library(petstore)
+
+var.pet.id <- 56 # integer | ID of pet that needs to be updated
+var.name <- 'name_example' # character | Updated name of the pet
+var.status <- 'status_example' # character | Updated status of the pet
+
+#Updates a pet in the store with form data
+PetApi$UpdatePetWithForm(var.pet.id, name=var.name, status=var.status)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **pet.id** | **integer**| ID of pet that needs to be updated | 
+ **name** | **character**| Updated name of the pet | [optional] 
+ **status** | **character**| Updated status of the pet | [optional] 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/x-www-form-urlencoded
+ - **Accept**: Not defined
+
+
+
+# **UploadFile**
+> ApiResponse UploadFile(var.pet.id, additional.metadata, file)
+
+uploads an image
+
+### Example
+```R
+library(petstore)
+
+var.pet.id <- 56 # integer | ID of pet to update
+var.additional.metadata <- 'additional.metadata_example' # character | Additional data to pass to server
+var.file <- File.new('/path/to/file') # data.frame | file to upload
+
+#uploads an image
+result = PetApi$UploadFile(var.pet.id, additional.metadata=var.additional.metadata, file=var.file)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **pet.id** | **integer**| ID of pet to update | 
+ **additional.metadata** | **character**| Additional data to pass to server | [optional] 
+ **file** | **data.frame**| file to upload | [optional] 
+
+### Return type
+
+[**ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: multipart/form-data
+ - **Accept**: application/json
+
+
+
diff --git a/samples/client/petstore/R/docs/StoreApi.md b/samples/client/petstore/R/docs/StoreApi.md
new file mode 100644
index 00000000000..0df7a97cd60
--- /dev/null
+++ b/samples/client/petstore/R/docs/StoreApi.md
@@ -0,0 +1,161 @@
+# ::StoreApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**DeleteOrder**](StoreApi.md#DeleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
+[**GetInventory**](StoreApi.md#GetInventory) | **GET** /store/inventory | Returns pet inventories by status
+[**GetOrderById**](StoreApi.md#GetOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
+[**PlaceOrder**](StoreApi.md#PlaceOrder) | **POST** /store/order | Place an order for a pet
+
+
+# **DeleteOrder**
+> DeleteOrder(var.order.id)
+
+Delete purchase order by ID
+
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
+### Example
+```R
+library(petstore)
+
+var.order.id <- 'order.id_example' # character | ID of the order that needs to be deleted
+
+#Delete purchase order by ID
+StoreApi$DeleteOrder(var.order.id)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **order.id** | **character**| ID of the order that needs to be deleted | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **GetInventory**
+> integer GetInventory()
+
+Returns pet inventories by status
+
+Returns a map of status codes to quantities
+
+### Example
+```R
+library(petstore)
+
+
+#Returns pet inventories by status
+result = StoreApi$GetInventory()
+dput(result)
+```
+
+### Parameters
+This endpoint does not need any parameter.
+
+### Return type
+
+**integer**
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+
+# **GetOrderById**
+> Order GetOrderById(var.order.id)
+
+Find purchase order by ID
+
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+### Example
+```R
+library(petstore)
+
+var.order.id <- 56 # integer | ID of pet that needs to be fetched
+
+#Find purchase order by ID
+result = StoreApi$GetOrderById(var.order.id)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **order.id** | **integer**| ID of pet that needs to be fetched | 
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
+# **PlaceOrder**
+> Order PlaceOrder(var.body)
+
+Place an order for a pet
+
+### Example
+```R
+library(petstore)
+
+var.body <- Order$new # Order | order placed for purchasing the pet
+
+#Place an order for a pet
+result = StoreApi$PlaceOrder(var.body)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Order**](Order.md)| order placed for purchasing the pet | 
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
diff --git a/samples/client/petstore/R/docs/Tag.md b/samples/client/petstore/R/docs/Tag.md
new file mode 100644
index 00000000000..1a5a1e82c95
--- /dev/null
+++ b/samples/client/petstore/R/docs/Tag.md
@@ -0,0 +1,9 @@
+# petstore::Tag
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **integer** |  | [optional] 
+**name** | **character** |  | [optional] 
+
+
diff --git a/samples/client/petstore/R/docs/User.md b/samples/client/petstore/R/docs/User.md
new file mode 100644
index 00000000000..65c05023c24
--- /dev/null
+++ b/samples/client/petstore/R/docs/User.md
@@ -0,0 +1,15 @@
+# petstore::User
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **integer** |  | [optional] 
+**username** | **character** |  | [optional] 
+**first_name** | **character** |  | [optional] 
+**last_name** | **character** |  | [optional] 
+**email** | **character** |  | [optional] 
+**password** | **character** |  | [optional] 
+**phone** | **character** |  | [optional] 
+**user_status** | **integer** | User Status | [optional] 
+
+
diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md
new file mode 100644
index 00000000000..26f2b2ecad9
--- /dev/null
+++ b/samples/client/petstore/R/docs/UserApi.md
@@ -0,0 +1,312 @@
+# ::UserApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**CreateUser**](UserApi.md#CreateUser) | **POST** /user | Create user
+[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
+[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
+[**DeleteUser**](UserApi.md#DeleteUser) | **DELETE** /user/{username} | Delete user
+[**GetUserByName**](UserApi.md#GetUserByName) | **GET** /user/{username} | Get user by user name
+[**LoginUser**](UserApi.md#LoginUser) | **GET** /user/login | Logs user into the system
+[**LogoutUser**](UserApi.md#LogoutUser) | **GET** /user/logout | Logs out current logged in user session
+[**UpdateUser**](UserApi.md#UpdateUser) | **PUT** /user/{username} | Updated user
+
+
+# **CreateUser**
+> CreateUser(var.body)
+
+Create user
+
+This can only be done by the logged in user.
+
+### Example
+```R
+library(petstore)
+
+var.body <- User$new # User | Created user object
+
+#Create user
+UserApi$CreateUser(var.body)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**User**](User.md)| Created user object | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **CreateUsersWithArrayInput**
+> CreateUsersWithArrayInput(var.body)
+
+Creates list of users with given input array
+
+### Example
+```R
+library(petstore)
+
+var.body <- [array$new] # User | List of user object
+
+#Creates list of users with given input array
+UserApi$CreateUsersWithArrayInput(var.body)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**User**](array.md)| List of user object | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **CreateUsersWithListInput**
+> CreateUsersWithListInput(var.body)
+
+Creates list of users with given input array
+
+### Example
+```R
+library(petstore)
+
+var.body <- [array$new] # User | List of user object
+
+#Creates list of users with given input array
+UserApi$CreateUsersWithListInput(var.body)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**User**](array.md)| List of user object | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **DeleteUser**
+> DeleteUser(var.username)
+
+Delete user
+
+This can only be done by the logged in user.
+
+### Example
+```R
+library(petstore)
+
+var.username <- 'username_example' # character | The name that needs to be deleted
+
+#Delete user
+UserApi$DeleteUser(var.username)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **character**| The name that needs to be deleted | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **GetUserByName**
+> User GetUserByName(var.username)
+
+Get user by user name
+
+### Example
+```R
+library(petstore)
+
+var.username <- 'username_example' # character | The name that needs to be fetched. Use user1 for testing.
+
+#Get user by user name
+result = UserApi$GetUserByName(var.username)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **character**| The name that needs to be fetched. Use user1 for testing. | 
+
+### Return type
+
+[**User**](User.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
+# **LoginUser**
+> character LoginUser(var.username, var.password)
+
+Logs user into the system
+
+### Example
+```R
+library(petstore)
+
+var.username <- 'username_example' # character | The user name for login
+var.password <- 'password_example' # character | The password for login in clear text
+
+#Logs user into the system
+result = UserApi$LoginUser(var.username, var.password)
+dput(result)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **character**| The user name for login | 
+ **password** | **character**| The password for login in clear text | 
+
+### Return type
+
+**character**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+
+# **LogoutUser**
+> LogoutUser()
+
+Logs out current logged in user session
+
+### Example
+```R
+library(petstore)
+
+
+#Logs out current logged in user session
+UserApi$LogoutUser()
+```
+
+### Parameters
+This endpoint does not need any parameter.
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
+# **UpdateUser**
+> UpdateUser(var.username, var.body)
+
+Updated user
+
+This can only be done by the logged in user.
+
+### Example
+```R
+library(petstore)
+
+var.username <- 'username_example' # character | name that need to be deleted
+var.body <- User$new # User | Updated user object
+
+#Updated user
+UserApi$UpdateUser(var.username, var.body)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **character**| name that need to be deleted | 
+ **body** | [**User**](User.md)| Updated user object | 
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+
-- 
GitLab


From 5f095a4cd5b373ed2cb5cc062e5fc7092e68a6ea Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Mon, 11 Feb 2019 20:55:49 +0800
Subject: [PATCH 2/3] remove module name

---
 .../src/main/resources/r/README.mustache      |  4 +-
 .../src/main/resources/r/api_doc.mustache     |  2 +-
 samples/client/petstore/R/README.md           | 52 +++++++++----------
 samples/client/petstore/R/docs/PetApi.md      |  2 +-
 samples/client/petstore/R/docs/StoreApi.md    |  2 +-
 samples/client/petstore/R/docs/UserApi.md     |  2 +-
 6 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/r/README.mustache b/modules/openapi-generator/src/main/resources/r/README.mustache
index 2bd30edc1ba..32c38931e09 100644
--- a/modules/openapi-generator/src/main/resources/r/README.mustache
+++ b/modules/openapi-generator/src/main/resources/r/README.mustache
@@ -54,12 +54,12 @@ All URIs are relative to *{{basePath}}*
 
 Class | Method | HTTP request | Description
 ------------ | ------------- | ------------- | -------------
-{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
+{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
 {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
 
 ## Documentation for Models
 
-{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
+{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
 {{/model}}{{/models}}
 
 ## Documentation for Authorization
diff --git a/modules/openapi-generator/src/main/resources/r/api_doc.mustache b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
index 10105710b72..83261818003 100644
--- a/modules/openapi-generator/src/main/resources/r/api_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
@@ -1,4 +1,4 @@
-# {{moduleName}}::{{classname}}{{#description}}
+# {{classname}}{{#description}}
 {{description}}{{/description}}
 
 All URIs are relative to *{{basePath}}*
diff --git a/samples/client/petstore/R/README.md b/samples/client/petstore/R/README.md
index c772fd1175b..1594363c5b7 100644
--- a/samples/client/petstore/R/README.md
+++ b/samples/client/petstore/R/README.md
@@ -46,36 +46,36 @@ All URIs are relative to *http://petstore.swagger.io/v2*
 
 Class | Method | HTTP request | Description
 ------------ | ------------- | ------------- | -------------
-*::PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
-*::PetApi* | [**DeletePet**](docs/PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet
-*::PetApi* | [**FindPetsByStatus**](docs/PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
-*::PetApi* | [**FindPetsByTags**](docs/PetApi.md#FindPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
-*::PetApi* | [**GetPetById**](docs/PetApi.md#GetPetById) | **GET** /pet/{petId} | Find pet by ID
-*::PetApi* | [**UpdatePet**](docs/PetApi.md#UpdatePet) | **PUT** /pet | Update an existing pet
-*::PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#UpdatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
-*::PetApi* | [**UploadFile**](docs/PetApi.md#UploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
-*::StoreApi* | [**DeleteOrder**](docs/StoreApi.md#DeleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
-*::StoreApi* | [**GetInventory**](docs/StoreApi.md#GetInventory) | **GET** /store/inventory | Returns pet inventories by status
-*::StoreApi* | [**GetOrderById**](docs/StoreApi.md#GetOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
-*::StoreApi* | [**PlaceOrder**](docs/StoreApi.md#PlaceOrder) | **POST** /store/order | Place an order for a pet
-*::UserApi* | [**CreateUser**](docs/UserApi.md#CreateUser) | **POST** /user | Create user
-*::UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#CreateUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
-*::UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#CreateUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
-*::UserApi* | [**DeleteUser**](docs/UserApi.md#DeleteUser) | **DELETE** /user/{username} | Delete user
-*::UserApi* | [**GetUserByName**](docs/UserApi.md#GetUserByName) | **GET** /user/{username} | Get user by user name
-*::UserApi* | [**LoginUser**](docs/UserApi.md#LoginUser) | **GET** /user/login | Logs user into the system
-*::UserApi* | [**LogoutUser**](docs/UserApi.md#LogoutUser) | **GET** /user/logout | Logs out current logged in user session
-*::UserApi* | [**UpdateUser**](docs/UserApi.md#UpdateUser) | **PUT** /user/{username} | Updated user
+*PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
+*PetApi* | [**DeletePet**](docs/PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet
+*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
+*PetApi* | [**FindPetsByTags**](docs/PetApi.md#FindPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**GetPetById**](docs/PetApi.md#GetPetById) | **GET** /pet/{petId} | Find pet by ID
+*PetApi* | [**UpdatePet**](docs/PetApi.md#UpdatePet) | **PUT** /pet | Update an existing pet
+*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#UpdatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**UploadFile**](docs/PetApi.md#UploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
+*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#DeleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
+*StoreApi* | [**GetInventory**](docs/StoreApi.md#GetInventory) | **GET** /store/inventory | Returns pet inventories by status
+*StoreApi* | [**GetOrderById**](docs/StoreApi.md#GetOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
+*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#PlaceOrder) | **POST** /store/order | Place an order for a pet
+*UserApi* | [**CreateUser**](docs/UserApi.md#CreateUser) | **POST** /user | Create user
+*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#CreateUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
+*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#CreateUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
+*UserApi* | [**DeleteUser**](docs/UserApi.md#DeleteUser) | **DELETE** /user/{username} | Delete user
+*UserApi* | [**GetUserByName**](docs/UserApi.md#GetUserByName) | **GET** /user/{username} | Get user by user name
+*UserApi* | [**LoginUser**](docs/UserApi.md#LoginUser) | **GET** /user/login | Logs user into the system
+*UserApi* | [**LogoutUser**](docs/UserApi.md#LogoutUser) | **GET** /user/logout | Logs out current logged in user session
+*UserApi* | [**UpdateUser**](docs/UserApi.md#UpdateUser) | **PUT** /user/{username} | Updated user
 
 
 ## Documentation for Models
 
- - [::ApiResponse](docs/ApiResponse.md)
- - [::Category](docs/Category.md)
- - [::Order](docs/Order.md)
- - [::Pet](docs/Pet.md)
- - [::Tag](docs/Tag.md)
- - [::User](docs/User.md)
+ - [ApiResponse](docs/ApiResponse.md)
+ - [Category](docs/Category.md)
+ - [Order](docs/Order.md)
+ - [Pet](docs/Pet.md)
+ - [Tag](docs/Tag.md)
+ - [User](docs/User.md)
 
 
 ## Documentation for Authorization
diff --git a/samples/client/petstore/R/docs/PetApi.md b/samples/client/petstore/R/docs/PetApi.md
index 15f2a52b0bc..76ee063bb70 100644
--- a/samples/client/petstore/R/docs/PetApi.md
+++ b/samples/client/petstore/R/docs/PetApi.md
@@ -1,4 +1,4 @@
-# ::PetApi
+# PetApi
 
 All URIs are relative to *http://petstore.swagger.io/v2*
 
diff --git a/samples/client/petstore/R/docs/StoreApi.md b/samples/client/petstore/R/docs/StoreApi.md
index 0df7a97cd60..4c65925840f 100644
--- a/samples/client/petstore/R/docs/StoreApi.md
+++ b/samples/client/petstore/R/docs/StoreApi.md
@@ -1,4 +1,4 @@
-# ::StoreApi
+# StoreApi
 
 All URIs are relative to *http://petstore.swagger.io/v2*
 
diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md
index 26f2b2ecad9..858f4cec720 100644
--- a/samples/client/petstore/R/docs/UserApi.md
+++ b/samples/client/petstore/R/docs/UserApi.md
@@ -1,4 +1,4 @@
-# ::UserApi
+# UserApi
 
 All URIs are relative to *http://petstore.swagger.io/v2*
 
-- 
GitLab


From a8f210540263544a402e66ba43033a3527a96964 Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Mon, 11 Feb 2019 21:03:34 +0800
Subject: [PATCH 3/3] replace nil with void

---
 .../src/main/resources/r/api_doc.mustache     |  4 +--
 samples/client/petstore/R/docs/PetApi.md      | 24 ++++++++---------
 samples/client/petstore/R/docs/StoreApi.md    |  8 +++---
 samples/client/petstore/R/docs/UserApi.md     | 26 +++++++++----------
 4 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/r/api_doc.mustache b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
index 83261818003..76db084161f 100644
--- a/modules/openapi-generator/src/main/resources/r/api_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
@@ -11,7 +11,7 @@ Method | HTTP request | Description
 {{#operations}}
 {{#operation}}
 # **{{operationId}}**
-> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#requiredParams}}var.{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}}{{#defaultValue}}={{{.}}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/optionalParams}})
+> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}}{{#defaultValue}}={{{.}}}{{/defaultValue}}{{^defaultValue}}=var.{{{paramName}}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/optionalParams}})
 
 {{{summary}}}{{#notes}}
 
@@ -43,7 +43,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}}
+{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
 
 ### Authorization
 
diff --git a/samples/client/petstore/R/docs/PetApi.md b/samples/client/petstore/R/docs/PetApi.md
index 76ee063bb70..3e39ab5a785 100644
--- a/samples/client/petstore/R/docs/PetApi.md
+++ b/samples/client/petstore/R/docs/PetApi.md
@@ -15,7 +15,7 @@ Method | HTTP request | Description
 
 
 # **AddPet**
-> AddPet(var.body)
+> AddPet(body)
 
 Add a new pet to the store
 
@@ -37,7 +37,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -51,7 +51,7 @@ nil (empty response body)
 
 
 # **DeletePet**
-> DeletePet(var.pet.id, api.key)
+> DeletePet(pet.id, api.key=var.api.key)
 
 Deletes a pet
 
@@ -75,7 +75,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -89,7 +89,7 @@ nil (empty response body)
 
 
 # **FindPetsByStatus**
-> Pet FindPetsByStatus(var.status)
+> Pet FindPetsByStatus(status)
 
 Finds Pets by status
 
@@ -128,7 +128,7 @@ Name | Type | Description  | Notes
 
 
 # **FindPetsByTags**
-> Pet FindPetsByTags(var.tags)
+> Pet FindPetsByTags(tags)
 
 Finds Pets by tags
 
@@ -167,7 +167,7 @@ Name | Type | Description  | Notes
 
 
 # **GetPetById**
-> Pet GetPetById(var.pet.id)
+> Pet GetPetById(pet.id)
 
 Find pet by ID
 
@@ -206,7 +206,7 @@ Name | Type | Description  | Notes
 
 
 # **UpdatePet**
-> UpdatePet(var.body)
+> UpdatePet(body)
 
 Update an existing pet
 
@@ -228,7 +228,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -242,7 +242,7 @@ nil (empty response body)
 
 
 # **UpdatePetWithForm**
-> UpdatePetWithForm(var.pet.id, name, status)
+> UpdatePetWithForm(pet.id, name=var.name, status=var.status)
 
 Updates a pet in the store with form data
 
@@ -268,7 +268,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -282,7 +282,7 @@ nil (empty response body)
 
 
 # **UploadFile**
-> ApiResponse UploadFile(var.pet.id, additional.metadata, file)
+> ApiResponse UploadFile(pet.id, additional.metadata=var.additional.metadata, file=var.file)
 
 uploads an image
 
diff --git a/samples/client/petstore/R/docs/StoreApi.md b/samples/client/petstore/R/docs/StoreApi.md
index 4c65925840f..deef87d86ed 100644
--- a/samples/client/petstore/R/docs/StoreApi.md
+++ b/samples/client/petstore/R/docs/StoreApi.md
@@ -11,7 +11,7 @@ Method | HTTP request | Description
 
 
 # **DeleteOrder**
-> DeleteOrder(var.order.id)
+> DeleteOrder(order.id)
 
 Delete purchase order by ID
 
@@ -35,7 +35,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -84,7 +84,7 @@ This endpoint does not need any parameter.
 
 
 # **GetOrderById**
-> Order GetOrderById(var.order.id)
+> Order GetOrderById(order.id)
 
 Find purchase order by ID
 
@@ -123,7 +123,7 @@ No authorization required
 
 
 # **PlaceOrder**
-> Order PlaceOrder(var.body)
+> Order PlaceOrder(body)
 
 Place an order for a pet
 
diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md
index 858f4cec720..364eb8b2297 100644
--- a/samples/client/petstore/R/docs/UserApi.md
+++ b/samples/client/petstore/R/docs/UserApi.md
@@ -15,7 +15,7 @@ Method | HTTP request | Description
 
 
 # **CreateUser**
-> CreateUser(var.body)
+> CreateUser(body)
 
 Create user
 
@@ -39,7 +39,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -53,7 +53,7 @@ No authorization required
 
 
 # **CreateUsersWithArrayInput**
-> CreateUsersWithArrayInput(var.body)
+> CreateUsersWithArrayInput(body)
 
 Creates list of users with given input array
 
@@ -75,7 +75,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -89,7 +89,7 @@ No authorization required
 
 
 # **CreateUsersWithListInput**
-> CreateUsersWithListInput(var.body)
+> CreateUsersWithListInput(body)
 
 Creates list of users with given input array
 
@@ -111,7 +111,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -125,7 +125,7 @@ No authorization required
 
 
 # **DeleteUser**
-> DeleteUser(var.username)
+> DeleteUser(username)
 
 Delete user
 
@@ -149,7 +149,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -163,7 +163,7 @@ No authorization required
 
 
 # **GetUserByName**
-> User GetUserByName(var.username)
+> User GetUserByName(username)
 
 Get user by user name
 
@@ -200,7 +200,7 @@ No authorization required
 
 
 # **LoginUser**
-> character LoginUser(var.username, var.password)
+> character LoginUser(username, password)
 
 Logs user into the system
 
@@ -257,7 +257,7 @@ This endpoint does not need any parameter.
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
@@ -271,7 +271,7 @@ No authorization required
 
 
 # **UpdateUser**
-> UpdateUser(var.username, var.body)
+> UpdateUser(username, body)
 
 Updated user
 
@@ -297,7 +297,7 @@ Name | Type | Description  | Notes
 
 ### Return type
 
-nil (empty response body)
+void (empty response body)
 
 ### Authorization
 
-- 
GitLab