From 1b0edaa80343d9475fd920c5db537948540ddf6c Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Fri, 19 Aug 2022 14:23:24 +0800
Subject: [PATCH 1/2] minor improvement to r doc

---
 .../src/main/resources/r/README.mustache      | 12 ++++--
 .../src/main/resources/r/api_doc.mustache     |  6 +--
 .../client/petstore/R-httr2-wrapper/README.md |  5 ---
 .../petstore/R-httr2-wrapper/docs/FakeApi.md  |  6 +--
 .../petstore/R-httr2-wrapper/docs/PetApi.md   | 40 +++++++++----------
 .../petstore/R-httr2-wrapper/docs/StoreApi.md | 14 +++----
 .../petstore/R-httr2-wrapper/docs/UserApi.md  | 20 +++++-----
 samples/client/petstore/R-httr2/README.md     |  5 ---
 .../client/petstore/R-httr2/docs/FakeApi.md   |  4 +-
 .../client/petstore/R-httr2/docs/PetApi.md    | 20 +++++-----
 .../client/petstore/R-httr2/docs/StoreApi.md  |  8 ++--
 .../client/petstore/R-httr2/docs/UserApi.md   | 16 ++++----
 samples/client/petstore/R/README.md           |  5 ---
 samples/client/petstore/R/docs/FakeApi.md     |  4 +-
 samples/client/petstore/R/docs/PetApi.md      | 20 +++++-----
 samples/client/petstore/R/docs/StoreApi.md    |  8 ++--
 samples/client/petstore/R/docs/UserApi.md     | 16 ++++----
 17 files changed, 100 insertions(+), 109 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/r/README.mustache b/modules/openapi-generator/src/main/resources/r/README.mustache
index 3b06a18e515..60bd456e58f 100644
--- a/modules/openapi-generator/src/main/resources/r/README.mustache
+++ b/modules/openapi-generator/src/main/resources/r/README.mustache
@@ -121,8 +121,14 @@ Class | Method | HTTP request | Description
 
 {{/authMethods}}
 
-
+{{#apiInfo}}
+{{#apis}}
+{{#-last}}
+{{#infoEmail}}
 ## Author
 
-{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
-{{/-last}}{{/apis}}{{/apiInfo}}
+{{{infoEmail}}}
+{{/infoEmail}}
+{{/-last}}
+{{/apis}}
+{{/apiInfo}}
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 a06981d3727..632dadf874c 100644
--- a/modules/openapi-generator/src/main/resources/r/api_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/r/api_doc.mustache
@@ -26,7 +26,7 @@ var_{{{paramName}}} <- {{{vendorExtensions.x-r-example}}} # {{{dataType}}} | {{{
 {{/allParams}}
 
 {{#summary}}
-#{{{.}}}
+# {{{.}}}
 {{/summary}}
 {{#generateWrapper}}
 api_instance <- {{#lambda.lowercase}}{{{packageName}}}{{/lambda.lowercase}}_api$new()
@@ -62,10 +62,10 @@ api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
 result <- tryCatch(
              {{#returnType}}
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}data_file = "result.txt"),
+             # api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}data_file = "result.txt"),
              {{#vendorExtensions.x-streaming}}
              # this endpoint supports data streaming via a callback function using the optional `stream_callback` parameter, e.g.
-             # api_instance${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}stream_callback = function(x){ print(length(x)) }),
+             # api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}stream_callback = function(x){ print(length(x)) }),
              {{/vendorExtensions.x-streaming}}
              {{/returnType}}
              api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}),
diff --git a/samples/client/petstore/R-httr2-wrapper/README.md b/samples/client/petstore/R-httr2-wrapper/README.md
index 979a2be2e7f..414e8dd44ec 100644
--- a/samples/client/petstore/R-httr2-wrapper/README.md
+++ b/samples/client/petstore/R-httr2-wrapper/README.md
@@ -137,8 +137,3 @@ Class | Method | HTTP request | Description
   - read:pets: read your pets
 
 
-
-## Author
-
-
-
diff --git a/samples/client/petstore/R-httr2-wrapper/docs/FakeApi.md b/samples/client/petstore/R-httr2-wrapper/docs/FakeApi.md
index 15945a39396..4550b1c0b71 100644
--- a/samples/client/petstore/R-httr2-wrapper/docs/FakeApi.md
+++ b/samples/client/petstore/R-httr2-wrapper/docs/FakeApi.md
@@ -22,11 +22,11 @@ library(petstore)
 var_dummy <- "dummy_example" # character | dummy required parameter
 var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
 
-#test data_file to ensure it's escaped correctly
+# test data_file to ensure it's escaped correctly
 api_instance <- petstore_api$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$fake_data_file(var_dummy, var_data_file = var_var_data_file, data_file = "result.txt"),
+             # api_instance$fake_api$fake_data_file(var_dummy, var_data_file = var_var_data_file, data_file = "result.txt"),
              api_instance$fake_api$fake_data_file(var_dummy, var_data_file = var_var_data_file),
              ApiException = function(ex) ex
           )
@@ -82,7 +82,7 @@ library(petstore)
 
 var_reg_exp_test <- "reg_exp_test_example" # character | dummy required parameter
 
-#test regular expression to ensure no exception
+# test regular expression to ensure no exception
 api_instance <- petstore_api$new()
 result <- tryCatch(
              api_instance$fake_api$fake_regular_expression(var_reg_exp_test),
diff --git a/samples/client/petstore/R-httr2-wrapper/docs/PetApi.md b/samples/client/petstore/R-httr2-wrapper/docs/PetApi.md
index cb00312c5ce..dd29240b90e 100644
--- a/samples/client/petstore/R-httr2-wrapper/docs/PetApi.md
+++ b/samples/client/petstore/R-httr2-wrapper/docs/PetApi.md
@@ -29,14 +29,14 @@ library(petstore)
 
 var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
 
-#Add a new pet to the store
+# Add a new pet to the store
 api_instance <- petstore_api$new()
 # Configure HTTP basic authorization: http_auth
 api_instance$api_client$username <- Sys.getenv("USERNAME")
 api_instance$api_client$password <- Sys.getenv("PASSWORD")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$add_pet(var_pet, data_file = "result.txt"),
+             # api_instance$pet_api$add_pet(var_pet, data_file = "result.txt"),
              api_instance$pet_api$add_pet(var_pet),
              ApiException = function(ex) ex
           )
@@ -93,7 +93,7 @@ library(petstore)
 var_pet_id <- 56 # integer | Pet id to delete
 var_api_key <- "api_key_example" # character |  (Optional)
 
-#Deletes a pet
+# Deletes a pet
 api_instance <- petstore_api$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -149,13 +149,13 @@ library(petstore)
 
 var_status <- list("available") # array[character] | Status values that need to be considered for filter
 
-#Finds Pets by status
+# Finds Pets by status
 api_instance <- petstore_api$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$find_pets_by_status(var_status, data_file = "result.txt"),
+             # api_instance$pet_api$find_pets_by_status(var_status, data_file = "result.txt"),
              api_instance$pet_api$find_pets_by_status(var_status),
              ApiException = function(ex) ex
           )
@@ -211,13 +211,13 @@ library(petstore)
 
 var_tags <- list("inner_example") # array[character] | Tags to filter by
 
-#Finds Pets by tags
+# Finds Pets by tags
 api_instance <- petstore_api$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$find_pets_by_tags(var_tags, data_file = "result.txt"),
+             # api_instance$pet_api$find_pets_by_tags(var_tags, data_file = "result.txt"),
              api_instance$pet_api$find_pets_by_tags(var_tags),
              ApiException = function(ex) ex
           )
@@ -273,13 +273,13 @@ library(petstore)
 
 var_pet_id <- 56 # integer | ID of pet to return
 
-#Find pet by ID
+# Find pet by ID
 api_instance <- petstore_api$new()
 # Configure HTTP bearer authorization: BearerToken
 api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$get_pet_by_id(var_pet_id, data_file = "result.txt"),
+             # api_instance$pet_api$get_pet_by_id(var_pet_id, data_file = "result.txt"),
              api_instance$pet_api$get_pet_by_id(var_pet_id),
              ApiException = function(ex) ex
           )
@@ -336,15 +336,15 @@ library(petstore)
 
 var_pet_id <- 56 # integer | ID of pet to return
 
-#Find pet by ID (streaming)
+# Find pet by ID (streaming)
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$get_pet_by_id_streaming(var_pet_id, data_file = "result.txt"),
+             # api_instance$pet_api$get_pet_by_id_streaming(var_pet_id, data_file = "result.txt"),
              # this endpoint supports data streaming via a callback function using the optional `stream_callback` parameter, e.g.
-             # api_instance$get_pet_by_id_streaming(var_pet_id, stream_callback = function(x){ print(length(x)) }),
+             # api_instance$pet_api$get_pet_by_id_streaming(var_pet_id, stream_callback = function(x){ print(length(x)) }),
              api_instance$pet_api$get_pet_by_id_streaming(var_pet_id),
              ApiException = function(ex) ex
           )
@@ -401,15 +401,15 @@ library(petstore)
 
 var_header_test_int <- 56 # integer | header test int
 
-#Header test
+# Header test
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$test_header(var_header_test_int, data_file = "result.txt"),
+             # api_instance$pet_api$test_header(var_header_test_int, data_file = "result.txt"),
              # this endpoint supports data streaming via a callback function using the optional `stream_callback` parameter, e.g.
-             # api_instance$test_header(var_header_test_int, stream_callback = function(x){ print(length(x)) }),
+             # api_instance$pet_api$test_header(var_header_test_int, stream_callback = function(x){ print(length(x)) }),
              api_instance$pet_api$test_header(var_header_test_int),
              ApiException = function(ex) ex
           )
@@ -466,13 +466,13 @@ library(petstore)
 
 var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
 
-#Update an existing pet
+# Update an existing pet
 api_instance <- petstore_api$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$update_pet(var_pet, data_file = "result.txt"),
+             # api_instance$pet_api$update_pet(var_pet, data_file = "result.txt"),
              api_instance$pet_api$update_pet(var_pet),
              ApiException = function(ex) ex
           )
@@ -532,7 +532,7 @@ var_pet_id <- 56 # integer | ID of pet that needs to be updated
 var_name <- "name_example" # character | Updated name of the pet (Optional)
 var_status <- "status_example" # character | Updated status of the pet (Optional)
 
-#Updates a pet in the store with form data
+# Updates a pet in the store with form data
 api_instance <- petstore_api$new()
 result <- tryCatch(
              api_instance$pet_api$update_pet_with_form(var_pet_id, name = var_name, status = var_status),
@@ -589,13 +589,13 @@ var_pet_id <- 56 # integer | ID of pet to update
 var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server (Optional)
 var_file <- File.new('/path/to/file') # data.frame | file to upload (Optional)
 
-#uploads an image
+# uploads an image
 api_instance <- petstore_api$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$upload_file(var_pet_id, additional_metadata = var_additional_metadata, file = var_file, data_file = "result.txt"),
+             # api_instance$pet_api$upload_file(var_pet_id, additional_metadata = var_additional_metadata, file = var_file, data_file = "result.txt"),
              api_instance$pet_api$upload_file(var_pet_id, additional_metadata = var_additional_metadata, file = var_file),
              ApiException = function(ex) ex
           )
diff --git a/samples/client/petstore/R-httr2-wrapper/docs/StoreApi.md b/samples/client/petstore/R-httr2-wrapper/docs/StoreApi.md
index 6b47b9fb715..3933cdb256d 100644
--- a/samples/client/petstore/R-httr2-wrapper/docs/StoreApi.md
+++ b/samples/client/petstore/R-httr2-wrapper/docs/StoreApi.md
@@ -23,7 +23,7 @@ library(petstore)
 
 var_order_id <- "order_id_example" # character | ID of the order that needs to be deleted
 
-#Delete purchase order by ID
+# Delete purchase order by ID
 api_instance <- petstore_api$new()
 result <- tryCatch(
              api_instance$store_api$delete_order(var_order_id),
@@ -76,13 +76,13 @@ Returns a map of status codes to quantities
 library(petstore)
 
 
-#Returns pet inventories by status
+# Returns pet inventories by status
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$get_inventory(data_file = "result.txt"),
+             # api_instance$store_api$get_inventory(data_file = "result.txt"),
              api_instance$store_api$get_inventory(),
              ApiException = function(ex) ex
           )
@@ -134,11 +134,11 @@ library(petstore)
 
 var_order_id <- 56 # integer | ID of pet that needs to be fetched
 
-#Find purchase order by ID
+# Find purchase order by ID
 api_instance <- petstore_api$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$get_order_by_id(var_order_id, data_file = "result.txt"),
+             # api_instance$store_api$get_order_by_id(var_order_id, data_file = "result.txt"),
              api_instance$store_api$get_order_by_id(var_order_id),
              ApiException = function(ex) ex
           )
@@ -195,11 +195,11 @@ library(petstore)
 
 var_order <- Order$new(123, 123, 123, "shipDate_example", "placed", "complete_example") # Order | order placed for purchasing the pet
 
-#Place an order for a pet
+# Place an order for a pet
 api_instance <- petstore_api$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$place_order(var_order, data_file = "result.txt"),
+             # api_instance$store_api$place_order(var_order, data_file = "result.txt"),
              api_instance$store_api$place_order(var_order),
              ApiException = function(ex) ex
           )
diff --git a/samples/client/petstore/R-httr2-wrapper/docs/UserApi.md b/samples/client/petstore/R-httr2-wrapper/docs/UserApi.md
index 04f108ec346..da8f0201268 100644
--- a/samples/client/petstore/R-httr2-wrapper/docs/UserApi.md
+++ b/samples/client/petstore/R-httr2-wrapper/docs/UserApi.md
@@ -27,7 +27,7 @@ library(petstore)
 
 var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Created user object
 
-#Create user
+# Create user
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -82,7 +82,7 @@ library(petstore)
 
 var_user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
 
-#Creates list of users with given input array
+# Creates list of users with given input array
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -137,7 +137,7 @@ library(petstore)
 
 var_user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
 
-#Creates list of users with given input array
+# Creates list of users with given input array
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -192,7 +192,7 @@ library(petstore)
 
 var_username <- "username_example" # character | The name that needs to be deleted
 
-#Delete user
+# Delete user
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -248,11 +248,11 @@ library(petstore)
 
 var_username <- "username_example" # character | The name that needs to be fetched. Use user1 for testing.
 
-#Get user by user name
+# Get user by user name
 api_instance <- petstore_api$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$get_user_by_name(var_username, data_file = "result.txt"),
+             # api_instance$user_api$get_user_by_name(var_username, data_file = "result.txt"),
              api_instance$user_api$get_user_by_name(var_username),
              ApiException = function(ex) ex
           )
@@ -310,11 +310,11 @@ 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
+# Logs user into the system
 api_instance <- petstore_api$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
-             # api_instance$login_user(var_username, var_password, data_file = "result.txt"),
+             # api_instance$user_api$login_user(var_username, var_password, data_file = "result.txt"),
              api_instance$user_api$login_user(var_username, var_password),
              ApiException = function(ex) ex
           )
@@ -370,7 +370,7 @@ Logs out current logged in user session
 library(petstore)
 
 
-#Logs out current logged in user session
+# Logs out current logged in user session
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -423,7 +423,7 @@ library(petstore)
 var_username <- "username_example" # character | name that need to be deleted
 var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
 
-#Updated user
+# Updated user
 api_instance <- petstore_api$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
diff --git a/samples/client/petstore/R-httr2/README.md b/samples/client/petstore/R-httr2/README.md
index 979a2be2e7f..414e8dd44ec 100644
--- a/samples/client/petstore/R-httr2/README.md
+++ b/samples/client/petstore/R-httr2/README.md
@@ -137,8 +137,3 @@ Class | Method | HTTP request | Description
   - read:pets: read your pets
 
 
-
-## Author
-
-
-
diff --git a/samples/client/petstore/R-httr2/docs/FakeApi.md b/samples/client/petstore/R-httr2/docs/FakeApi.md
index 34a4940fee2..eee39fb53bb 100644
--- a/samples/client/petstore/R-httr2/docs/FakeApi.md
+++ b/samples/client/petstore/R-httr2/docs/FakeApi.md
@@ -22,7 +22,7 @@ library(petstore)
 var_dummy <- "dummy_example" # character | dummy required parameter
 var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
 
-#test data_file to ensure it's escaped correctly
+# test data_file to ensure it's escaped correctly
 api_instance <- FakeApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -82,7 +82,7 @@ library(petstore)
 
 var_reg_exp_test <- "reg_exp_test_example" # character | dummy required parameter
 
-#test regular expression to ensure no exception
+# test regular expression to ensure no exception
 api_instance <- FakeApi$new()
 result <- tryCatch(
              api_instance$fake_regular_expression(var_reg_exp_test),
diff --git a/samples/client/petstore/R-httr2/docs/PetApi.md b/samples/client/petstore/R-httr2/docs/PetApi.md
index 595d2c7a29f..35922fbc742 100644
--- a/samples/client/petstore/R-httr2/docs/PetApi.md
+++ b/samples/client/petstore/R-httr2/docs/PetApi.md
@@ -29,7 +29,7 @@ library(petstore)
 
 var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
 
-#Add a new pet to the store
+# Add a new pet to the store
 api_instance <- PetApi$new()
 # Configure HTTP basic authorization: http_auth
 api_instance$api_client$username <- Sys.getenv("USERNAME")
@@ -93,7 +93,7 @@ library(petstore)
 var_pet_id <- 56 # integer | Pet id to delete
 var_api_key <- "api_key_example" # character |  (Optional)
 
-#Deletes a pet
+# Deletes a pet
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -149,7 +149,7 @@ library(petstore)
 
 var_status <- list("available") # array[character] | Status values that need to be considered for filter
 
-#Finds Pets by status
+# Finds Pets by status
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -211,7 +211,7 @@ library(petstore)
 
 var_tags <- list("inner_example") # array[character] | Tags to filter by
 
-#Finds Pets by tags
+# Finds Pets by tags
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -273,7 +273,7 @@ library(petstore)
 
 var_pet_id <- 56 # integer | ID of pet to return
 
-#Find pet by ID
+# Find pet by ID
 api_instance <- PetApi$new()
 # Configure HTTP bearer authorization: BearerToken
 api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
@@ -336,7 +336,7 @@ library(petstore)
 
 var_pet_id <- 56 # integer | ID of pet to return
 
-#Find pet by ID (streaming)
+# Find pet by ID (streaming)
 api_instance <- PetApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -401,7 +401,7 @@ library(petstore)
 
 var_header_test_int <- 56 # integer | header test int
 
-#Header test
+# Header test
 api_instance <- PetApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -466,7 +466,7 @@ library(petstore)
 
 var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
 
-#Update an existing pet
+# Update an existing pet
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -532,7 +532,7 @@ var_pet_id <- 56 # integer | ID of pet that needs to be updated
 var_name <- "name_example" # character | Updated name of the pet (Optional)
 var_status <- "status_example" # character | Updated status of the pet (Optional)
 
-#Updates a pet in the store with form data
+# Updates a pet in the store with form data
 api_instance <- PetApi$new()
 result <- tryCatch(
              api_instance$update_pet_with_form(var_pet_id, name = var_name, status = var_status),
@@ -589,7 +589,7 @@ var_pet_id <- 56 # integer | ID of pet to update
 var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server (Optional)
 var_file <- File.new('/path/to/file') # data.frame | file to upload (Optional)
 
-#uploads an image
+# uploads an image
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
diff --git a/samples/client/petstore/R-httr2/docs/StoreApi.md b/samples/client/petstore/R-httr2/docs/StoreApi.md
index f05d4750e12..454f019b4d8 100644
--- a/samples/client/petstore/R-httr2/docs/StoreApi.md
+++ b/samples/client/petstore/R-httr2/docs/StoreApi.md
@@ -23,7 +23,7 @@ library(petstore)
 
 var_order_id <- "order_id_example" # character | ID of the order that needs to be deleted
 
-#Delete purchase order by ID
+# Delete purchase order by ID
 api_instance <- StoreApi$new()
 result <- tryCatch(
              api_instance$delete_order(var_order_id),
@@ -76,7 +76,7 @@ Returns a map of status codes to quantities
 library(petstore)
 
 
-#Returns pet inventories by status
+# Returns pet inventories by status
 api_instance <- StoreApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -134,7 +134,7 @@ library(petstore)
 
 var_order_id <- 56 # integer | ID of pet that needs to be fetched
 
-#Find purchase order by ID
+# Find purchase order by ID
 api_instance <- StoreApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -195,7 +195,7 @@ library(petstore)
 
 var_order <- Order$new(123, 123, 123, "shipDate_example", "placed", "complete_example") # Order | order placed for purchasing the pet
 
-#Place an order for a pet
+# Place an order for a pet
 api_instance <- StoreApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
diff --git a/samples/client/petstore/R-httr2/docs/UserApi.md b/samples/client/petstore/R-httr2/docs/UserApi.md
index 46b327bc435..beba3ffadca 100644
--- a/samples/client/petstore/R-httr2/docs/UserApi.md
+++ b/samples/client/petstore/R-httr2/docs/UserApi.md
@@ -27,7 +27,7 @@ library(petstore)
 
 var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Created user object
 
-#Create user
+# Create user
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -82,7 +82,7 @@ library(petstore)
 
 var_user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
 
-#Creates list of users with given input array
+# Creates list of users with given input array
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -137,7 +137,7 @@ library(petstore)
 
 var_user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
 
-#Creates list of users with given input array
+# Creates list of users with given input array
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -192,7 +192,7 @@ library(petstore)
 
 var_username <- "username_example" # character | The name that needs to be deleted
 
-#Delete user
+# Delete user
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -248,7 +248,7 @@ library(petstore)
 
 var_username <- "username_example" # character | The name that needs to be fetched. Use user1 for testing.
 
-#Get user by user name
+# Get user by user name
 api_instance <- UserApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -310,7 +310,7 @@ 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
+# Logs user into the system
 api_instance <- UserApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -370,7 +370,7 @@ Logs out current logged in user session
 library(petstore)
 
 
-#Logs out current logged in user session
+# Logs out current logged in user session
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -423,7 +423,7 @@ library(petstore)
 var_username <- "username_example" # character | name that need to be deleted
 var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
 
-#Updated user
+# Updated user
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
diff --git a/samples/client/petstore/R/README.md b/samples/client/petstore/R/README.md
index deaa9abe7af..145eb19813c 100644
--- a/samples/client/petstore/R/README.md
+++ b/samples/client/petstore/R/README.md
@@ -137,8 +137,3 @@ Class | Method | HTTP request | Description
   - read:pets: read your pets
 
 
-
-## Author
-
-
-
diff --git a/samples/client/petstore/R/docs/FakeApi.md b/samples/client/petstore/R/docs/FakeApi.md
index 72a3f966429..292b17b009e 100644
--- a/samples/client/petstore/R/docs/FakeApi.md
+++ b/samples/client/petstore/R/docs/FakeApi.md
@@ -22,7 +22,7 @@ library(petstore)
 var_dummy <- "dummy_example" # character | dummy required parameter
 var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
 
-#test data_file to ensure it's escaped correctly
+# test data_file to ensure it's escaped correctly
 api_instance <- FakeApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -82,7 +82,7 @@ library(petstore)
 
 var_reg_exp_test <- "reg_exp_test_example" # character | dummy required parameter
 
-#test regular expression to ensure no exception
+# test regular expression to ensure no exception
 api_instance <- FakeApi$new()
 result <- tryCatch(
              api_instance$FakeRegularExpression(var_reg_exp_test),
diff --git a/samples/client/petstore/R/docs/PetApi.md b/samples/client/petstore/R/docs/PetApi.md
index 75c818bc8e6..fa212fa2fda 100644
--- a/samples/client/petstore/R/docs/PetApi.md
+++ b/samples/client/petstore/R/docs/PetApi.md
@@ -29,7 +29,7 @@ library(petstore)
 
 var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
 
-#Add a new pet to the store
+# Add a new pet to the store
 api_instance <- PetApi$new()
 # Configure HTTP basic authorization: http_auth
 api_instance$api_client$username <- Sys.getenv("USERNAME")
@@ -93,7 +93,7 @@ library(petstore)
 var_pet_id <- 56 # integer | Pet id to delete
 var_api_key <- "api_key_example" # character |  (Optional)
 
-#Deletes a pet
+# Deletes a pet
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -149,7 +149,7 @@ library(petstore)
 
 var_status <- list("available") # array[character] | Status values that need to be considered for filter
 
-#Finds Pets by status
+# Finds Pets by status
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -211,7 +211,7 @@ library(petstore)
 
 var_tags <- list("inner_example") # array[character] | Tags to filter by
 
-#Finds Pets by tags
+# Finds Pets by tags
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -273,7 +273,7 @@ library(petstore)
 
 var_pet_id <- 56 # integer | ID of pet to return
 
-#Find pet by ID
+# Find pet by ID
 api_instance <- PetApi$new()
 # Configure HTTP bearer authorization: BearerToken
 api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
@@ -336,7 +336,7 @@ library(petstore)
 
 var_pet_id <- 56 # integer | ID of pet to return
 
-#Find pet by ID (streaming)
+# Find pet by ID (streaming)
 api_instance <- PetApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -401,7 +401,7 @@ library(petstore)
 
 var_header_test_int <- 56 # integer | header test int
 
-#Header test
+# Header test
 api_instance <- PetApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -466,7 +466,7 @@ library(petstore)
 
 var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
 
-#Update an existing pet
+# Update an existing pet
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
@@ -532,7 +532,7 @@ var_pet_id <- 56 # integer | ID of pet that needs to be updated
 var_name <- "name_example" # character | Updated name of the pet (Optional)
 var_status <- "status_example" # character | Updated status of the pet (Optional)
 
-#Updates a pet in the store with form data
+# Updates a pet in the store with form data
 api_instance <- PetApi$new()
 result <- tryCatch(
              api_instance$UpdatePetWithForm(var_pet_id, name = var_name, status = var_status),
@@ -589,7 +589,7 @@ var_pet_id <- 56 # integer | ID of pet to update
 var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server (Optional)
 var_file <- File.new('/path/to/file') # data.frame | file to upload (Optional)
 
-#uploads an image
+# uploads an image
 api_instance <- PetApi$new()
 # Configure OAuth2 access token for authorization: petstore_auth
 api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
diff --git a/samples/client/petstore/R/docs/StoreApi.md b/samples/client/petstore/R/docs/StoreApi.md
index f7d2aab93ff..d7e35f1614c 100644
--- a/samples/client/petstore/R/docs/StoreApi.md
+++ b/samples/client/petstore/R/docs/StoreApi.md
@@ -23,7 +23,7 @@ library(petstore)
 
 var_order_id <- "order_id_example" # character | ID of the order that needs to be deleted
 
-#Delete purchase order by ID
+# Delete purchase order by ID
 api_instance <- StoreApi$new()
 result <- tryCatch(
              api_instance$DeleteOrder(var_order_id),
@@ -76,7 +76,7 @@ Returns a map of status codes to quantities
 library(petstore)
 
 
-#Returns pet inventories by status
+# Returns pet inventories by status
 api_instance <- StoreApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -134,7 +134,7 @@ library(petstore)
 
 var_order_id <- 56 # integer | ID of pet that needs to be fetched
 
-#Find purchase order by ID
+# Find purchase order by ID
 api_instance <- StoreApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -195,7 +195,7 @@ library(petstore)
 
 var_order <- Order$new(123, 123, 123, "shipDate_example", "placed", "complete_example") # Order | order placed for purchasing the pet
 
-#Place an order for a pet
+# Place an order for a pet
 api_instance <- StoreApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md
index 229862bbc0d..b128ef520df 100644
--- a/samples/client/petstore/R/docs/UserApi.md
+++ b/samples/client/petstore/R/docs/UserApi.md
@@ -27,7 +27,7 @@ library(petstore)
 
 var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Created user object
 
-#Create user
+# Create user
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -82,7 +82,7 @@ library(petstore)
 
 var_user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
 
-#Creates list of users with given input array
+# Creates list of users with given input array
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -137,7 +137,7 @@ library(petstore)
 
 var_user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
 
-#Creates list of users with given input array
+# Creates list of users with given input array
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -192,7 +192,7 @@ library(petstore)
 
 var_username <- "username_example" # character | The name that needs to be deleted
 
-#Delete user
+# Delete user
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -248,7 +248,7 @@ library(petstore)
 
 var_username <- "username_example" # character | The name that needs to be fetched. Use user1 for testing.
 
-#Get user by user name
+# Get user by user name
 api_instance <- UserApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -310,7 +310,7 @@ 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
+# Logs user into the system
 api_instance <- UserApi$new()
 result <- tryCatch(
              # to save the result into a file, simply add the optional `data_file` parameter, e.g.
@@ -370,7 +370,7 @@ Logs out current logged in user session
 library(petstore)
 
 
-#Logs out current logged in user session
+# Logs out current logged in user session
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
@@ -423,7 +423,7 @@ library(petstore)
 var_username <- "username_example" # character | name that need to be deleted
 var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
 
-#Updated user
+# Updated user
 api_instance <- UserApi$new()
 # Configure API key authorization: api_key
 api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
-- 
GitLab


From 9934dcf3b3e3e85d275e2d25c3f239670f627d5e Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Fri, 19 Aug 2022 14:26:12 +0800
Subject: [PATCH 2/2] better scopes

---
 .../openapi-generator/src/main/resources/r/README.mustache    | 2 +-
 samples/client/petstore/R-httr2-wrapper/README.md             | 4 ++--
 samples/client/petstore/R-httr2/README.md                     | 4 ++--
 samples/client/petstore/R/README.md                           | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/r/README.mustache b/modules/openapi-generator/src/main/resources/r/README.mustache
index 60bd456e58f..efcf2732fa2 100644
--- a/modules/openapi-generator/src/main/resources/r/README.mustache
+++ b/modules/openapi-generator/src/main/resources/r/README.mustache
@@ -115,7 +115,7 @@ Class | Method | HTTP request | Description
 - **Refresh URL**: {{refreshUrl}}
 {{/refreshUrl}}
 - **Scopes**: {{^scopes}}N/A{{/scopes}}
-{{#scopes}}  - {{scope}}: {{description}}
+{{#scopes}}  - `{{scope}}`: {{description}}
 {{/scopes}}
 {{/isOAuth}}
 
diff --git a/samples/client/petstore/R-httr2-wrapper/README.md b/samples/client/petstore/R-httr2-wrapper/README.md
index 414e8dd44ec..eeed062a6ff 100644
--- a/samples/client/petstore/R-httr2-wrapper/README.md
+++ b/samples/client/petstore/R-httr2-wrapper/README.md
@@ -133,7 +133,7 @@ Class | Method | HTTP request | Description
 - **Flow**: implicit
 - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
 - **Scopes**: 
-  - write:pets: modify pets in your account
-  - read:pets: read your pets
+  - `write:pets`: modify pets in your account
+  - `read:pets`: read your pets
 
 
diff --git a/samples/client/petstore/R-httr2/README.md b/samples/client/petstore/R-httr2/README.md
index 414e8dd44ec..eeed062a6ff 100644
--- a/samples/client/petstore/R-httr2/README.md
+++ b/samples/client/petstore/R-httr2/README.md
@@ -133,7 +133,7 @@ Class | Method | HTTP request | Description
 - **Flow**: implicit
 - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
 - **Scopes**: 
-  - write:pets: modify pets in your account
-  - read:pets: read your pets
+  - `write:pets`: modify pets in your account
+  - `read:pets`: read your pets
 
 
diff --git a/samples/client/petstore/R/README.md b/samples/client/petstore/R/README.md
index 145eb19813c..79814bf139a 100644
--- a/samples/client/petstore/R/README.md
+++ b/samples/client/petstore/R/README.md
@@ -133,7 +133,7 @@ Class | Method | HTTP request | Description
 - **Flow**: implicit
 - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
 - **Scopes**: 
-  - write:pets: modify pets in your account
-  - read:pets: read your pets
+  - `write:pets`: modify pets in your account
+  - `read:pets`: read your pets
 
 
-- 
GitLab