Skip to content

Commit

Permalink
fix example code reported by styler (#13707)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored Oct 16, 2022
1 parent c0a9f0e commit dc23ba3
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,9 @@ public String constructRdocType(CodegenProperty codegenProperty) {

public String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps) {
if (codegenParameter.isArray) { // array
return "list(" + constructExampleCode(codegenParameter.items, modelMaps, 0) + ")";
return "c(" + constructExampleCode(codegenParameter.items, modelMaps, 0) + ")";
} else if (codegenParameter.isMap) { // map
return "list(key = " + constructExampleCode(codegenParameter.items, modelMaps, 0) + ")";
return "c(key = " + constructExampleCode(codegenParameter.items, modelMaps, 0) + ")";
} else if (languageSpecificPrimitives.contains(codegenParameter.dataType)) { // primitive type
return codegenParameter.example;
} else { // model
Expand All @@ -947,9 +947,9 @@ public String constructExampleCode(CodegenProperty codegenProperty, HashMap<Stri
depth++;

if (codegenProperty.isArray) { // array
return "list(" + constructExampleCode(codegenProperty.items, modelMaps, depth) + ")";
return "c(" + constructExampleCode(codegenProperty.items, modelMaps, depth) + ")";
} else if (codegenProperty.isMap) { // map
return "list(key = " + constructExampleCode(codegenProperty.items, modelMaps, depth) + ")";
return "c(key = " + constructExampleCode(codegenProperty.items, modelMaps, depth) + ")";
} else if (languageSpecificPrimitives.contains(codegenProperty.dataType)) { // primitive type
if ("character".equals(codegenProperty.dataType)) {
if (StringUtils.isEmpty(codegenProperty.example)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
#'
#' library({{{packageName}}})
{{#allParams}}
#' var_{{{paramName}}} <- {{{example}}} # {{{dataType}}} | {{{description}}}
#' var_{{{paramName}}} <- {{{vendorExtensions.x-r-example}}} # {{{dataType}}} | {{{description}}}{{^required}} (Optional){{/required}}
{{/allParams}}
#'
{{#summary}}
Expand Down
10 changes: 5 additions & 5 deletions samples/client/petstore/R-httr2-wrapper/R/fake_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
#' #################### add_pet_optional ####################
#'
#' library(petstore)
#' var_pet <- Pet$new() # Pet | Pet object that needs to be added to the store
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
#'
#' #Add a new pet to the store (optional body)
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -155,7 +155,7 @@
#'
#' library(petstore)
#' var_dummy <- "dummy_example" # character | dummy required parameter
#' var_var_data_file <- "var_data_file_example" # character | header data file
#' var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
#'
#' #test data_file to ensure it's escaped correctly
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -188,7 +188,7 @@
#' #################### fake_path_array ####################
#'
#' library(petstore)
#' var_path_array <- ["path_array_example"] # array[character] | dummy path parameter
#' var_path_array <- c("inner_example") # array[character] | dummy path parameter
#'
#' #test array parameter in path
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -238,8 +238,8 @@
#' #################### fake_set_query ####################
#'
#' library(petstore)
#' var_set_dummy <- ["set_dummy_example"] # set[character] | set query
#' var_array_dummy <- ["array_dummy_example"] # array[character] | array query
#' var_set_dummy <- c("inner_example") # set[character] | set query
#' var_array_dummy <- c("inner_example") # array[character] | array query
#'
#' #test set query parameter
#' api_instance <- petstore_api$new()
Expand Down
18 changes: 9 additions & 9 deletions samples/client/petstore/R-httr2-wrapper/R/pet_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
#' #################### add_pet ####################
#'
#' library(petstore)
#' var_pet <- Pet$new() # Pet | Pet object that needs to be added to the store
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
#'
#' #Add a new pet to the store
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -326,7 +326,7 @@
#'
#' library(petstore)
#' var_pet_id <- 56 # integer | Pet id to delete
#' var_api_key <- "api_key_example" # character |
#' var_api_key <- "api_key_example" # character | (Optional)
#'
#' #Deletes a pet
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -354,7 +354,7 @@
#' #################### find_pets_by_status ####################
#'
#' library(petstore)
#' var_status <- ["status_example"] # array[character] | Status values that need to be considered for filter
#' var_status <- c("available") # array[character] | Status values that need to be considered for filter
#'
#' #Finds Pets by status
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -390,7 +390,7 @@
#' #################### find_pets_by_tags ####################
#'
#' library(petstore)
#' var_tags <- ["tags_example"] # array[character] | Tags to filter by
#' var_tags <- c("inner_example") # array[character] | Tags to filter by
#'
#' #Finds Pets by tags
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -537,7 +537,7 @@
#' #################### update_pet ####################
#'
#' library(petstore)
#' var_pet <- Pet$new() # Pet | Pet object that needs to be added to the store
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
#'
#' #Update an existing pet
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -574,8 +574,8 @@
#'
#' 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
#' 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
#' api_instance <- petstore_api$new()
Expand All @@ -601,8 +601,8 @@
#'
#' 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
#' 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
#' api_instance <- petstore_api$new()
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/R-httr2-wrapper/R/store_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
#' #################### place_order ####################
#'
#' library(petstore)
#' var_order <- Order$new() # Order | order placed for purchasing the pet
#' 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
#' api_instance <- petstore_api$new()
Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/R-httr2-wrapper/R/user_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
#' #################### create_user ####################
#'
#' library(petstore)
#' var_user <- User$new() # User | Created user object
#' var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Created user object
#'
#' #Create user
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -225,7 +225,7 @@
#' #################### create_users_with_array_input ####################
#'
#' library(petstore)
#' var_user <- [User$new()] # array[User] | List of user object
#' var_user <- c(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
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -253,7 +253,7 @@
#' #################### create_users_with_list_input ####################
#'
#' library(petstore)
#' var_user <- [User$new()] # array[User] | List of user object
#' var_user <- c(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
#' api_instance <- petstore_api$new()
Expand Down Expand Up @@ -404,7 +404,7 @@
#'
#' library(petstore)
#' var_username <- "username_example" # character | name that need to be deleted
#' var_user <- User$new() # User | Updated user object
#' var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
#'
#' #Updated user
#' api_instance <- petstore_api$new()
Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/R-httr2-wrapper/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library(petstore)
# Add a new pet to the store (optional body)
#
# prepare function argument(s)
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 (Optional)
var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)

api_instance <- petstore_api$new()
# Configure HTTP basic authorization: http_auth
Expand Down Expand Up @@ -153,7 +153,7 @@ library(petstore)
# test array parameter in path
#
# prepare function argument(s)
var_path_array <- list("inner_example") # array[character] | dummy path parameter
var_path_array <- c("inner_example") # array[character] | dummy path parameter

api_instance <- petstore_api$new()
result <- tryCatch(
Expand Down Expand Up @@ -263,8 +263,8 @@ library(petstore)
# test set query parameter
#
# prepare function argument(s)
var_set_dummy <- list("inner_example") # set[character] | set query
var_array_dummy <- list("inner_example") # array[character] | array query
var_set_dummy <- c("inner_example") # set[character] | set query
var_array_dummy <- c("inner_example") # array[character] | array query

api_instance <- petstore_api$new()
result <- tryCatch(
Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/R-httr2-wrapper/docs/PetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ library(petstore)
# Add a new pet to the store
#
# prepare function argument(s)
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
var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store

api_instance <- petstore_api$new()
# Configure HTTP basic authorization: http_auth
Expand Down Expand Up @@ -154,7 +154,7 @@ library(petstore)
# Finds Pets by status
#
# prepare function argument(s)
var_status <- list("available") # array[character] | Status values that need to be considered for filter
var_status <- c("available") # array[character] | Status values that need to be considered for filter

api_instance <- petstore_api$new()
# Configure OAuth2 access token for authorization: petstore_auth
Expand Down Expand Up @@ -218,7 +218,7 @@ library(petstore)
# Finds Pets by tags
#
# prepare function argument(s)
var_tags <- list("inner_example") # array[character] | Tags to filter by
var_tags <- c("inner_example") # array[character] | Tags to filter by

api_instance <- petstore_api$new()
result <- tryCatch(
Expand Down Expand Up @@ -479,7 +479,7 @@ library(petstore)
# Update an existing pet
#
# prepare function argument(s)
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
var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store

api_instance <- petstore_api$new()
# Configure OAuth2 access token for authorization: petstore_auth
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/R-httr2-wrapper/docs/UserApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ library(petstore)
# Creates list of users with given input array
#
# prepare function argument(s)
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
var_user <- c(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object

api_instance <- petstore_api$new()
# Configure API key authorization: api_key
Expand Down Expand Up @@ -142,7 +142,7 @@ library(petstore)
# Creates list of users with given input array
#
# prepare function argument(s)
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
var_user <- c(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object

api_instance <- petstore_api$new()
# Configure API key authorization: api_key
Expand Down
10 changes: 5 additions & 5 deletions samples/client/petstore/R-httr2/R/fake_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
#' #################### add_pet_optional ####################
#'
#' library(petstore)
#' var_pet <- Pet$new() # Pet | Pet object that needs to be added to the store
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
#'
#' #Add a new pet to the store (optional body)
#' api_instance <- FakeApi$new()
Expand Down Expand Up @@ -155,7 +155,7 @@
#'
#' library(petstore)
#' var_dummy <- "dummy_example" # character | dummy required parameter
#' var_var_data_file <- "var_data_file_example" # character | header data file
#' var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
#'
#' #test data_file to ensure it's escaped correctly
#' api_instance <- FakeApi$new()
Expand Down Expand Up @@ -188,7 +188,7 @@
#' #################### fake_path_array ####################
#'
#' library(petstore)
#' var_path_array <- ["path_array_example"] # array[character] | dummy path parameter
#' var_path_array <- c("inner_example") # array[character] | dummy path parameter
#'
#' #test array parameter in path
#' api_instance <- FakeApi$new()
Expand Down Expand Up @@ -238,8 +238,8 @@
#' #################### fake_set_query ####################
#'
#' library(petstore)
#' var_set_dummy <- ["set_dummy_example"] # set[character] | set query
#' var_array_dummy <- ["array_dummy_example"] # array[character] | array query
#' var_set_dummy <- c("inner_example") # set[character] | set query
#' var_array_dummy <- c("inner_example") # array[character] | array query
#'
#' #test set query parameter
#' api_instance <- FakeApi$new()
Expand Down
18 changes: 9 additions & 9 deletions samples/client/petstore/R-httr2/R/pet_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
#' #################### add_pet ####################
#'
#' library(petstore)
#' var_pet <- Pet$new() # Pet | Pet object that needs to be added to the store
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
#'
#' #Add a new pet to the store
#' api_instance <- PetApi$new()
Expand Down Expand Up @@ -326,7 +326,7 @@
#'
#' library(petstore)
#' var_pet_id <- 56 # integer | Pet id to delete
#' var_api_key <- "api_key_example" # character |
#' var_api_key <- "api_key_example" # character | (Optional)
#'
#' #Deletes a pet
#' api_instance <- PetApi$new()
Expand Down Expand Up @@ -354,7 +354,7 @@
#' #################### find_pets_by_status ####################
#'
#' library(petstore)
#' var_status <- ["status_example"] # array[character] | Status values that need to be considered for filter
#' var_status <- c("available") # array[character] | Status values that need to be considered for filter
#'
#' #Finds Pets by status
#' api_instance <- PetApi$new()
Expand Down Expand Up @@ -390,7 +390,7 @@
#' #################### find_pets_by_tags ####################
#'
#' library(petstore)
#' var_tags <- ["tags_example"] # array[character] | Tags to filter by
#' var_tags <- c("inner_example") # array[character] | Tags to filter by
#'
#' #Finds Pets by tags
#' api_instance <- PetApi$new()
Expand Down Expand Up @@ -537,7 +537,7 @@
#' #################### update_pet ####################
#'
#' library(petstore)
#' var_pet <- Pet$new() # Pet | Pet object that needs to be added to the store
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
#'
#' #Update an existing pet
#' api_instance <- PetApi$new()
Expand Down Expand Up @@ -574,8 +574,8 @@
#'
#' 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
#' 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
#' api_instance <- PetApi$new()
Expand All @@ -601,8 +601,8 @@
#'
#' 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
#' 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
#' api_instance <- PetApi$new()
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/R-httr2/R/store_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
#' #################### place_order ####################
#'
#' library(petstore)
#' var_order <- Order$new() # Order | order placed for purchasing the pet
#' 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
#' api_instance <- StoreApi$new()
Expand Down
Loading

0 comments on commit dc23ba3

Please sign in to comment.