From 9c52be0ab5c983ea29c8c8f999baac8c647a955e Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Mon, 18 Nov 2024 20:07:39 -0500 Subject: [PATCH 1/7] [r client] fix to-list and to-json functionality --- .../main/resources/r/modelGeneric.mustache | 105 ++++------- samples/client/echo_api/r/R/bird.R | 57 +++--- samples/client/echo_api/r/R/category.R | 57 +++--- samples/client/echo_api/r/R/data_query.R | 81 ++++----- samples/client/echo_api/r/R/default_value.R | 107 ++++-------- .../echo_api/r/R/number_properties_only.R | 65 ++++--- samples/client/echo_api/r/R/pet.R | 93 ++++------ samples/client/echo_api/r/R/query.R | 57 +++--- samples/client/echo_api/r/R/tag.R | 57 +++--- ...est_form_object_multipart_request_marker.R | 49 ++++-- ...rue_object_all_of_query_object_parameter.R | 73 ++++---- ...true_array_string_query_object_parameter.R | 49 ++++-- .../R/allof_tag_api_response.R | 83 ++++----- .../petstore/R-httr2-wrapper/R/animal.R | 59 ++++--- .../petstore/R-httr2-wrapper/R/basque_pig.R | 59 ++++--- .../client/petstore/R-httr2-wrapper/R/cat.R | 67 ++++--- .../petstore/R-httr2-wrapper/R/category.R | 59 ++++--- .../petstore/R-httr2-wrapper/R/danish_pig.R | 59 ++++--- .../client/petstore/R-httr2-wrapper/R/date.R | 67 ++++--- .../client/petstore/R-httr2-wrapper/R/dog.R | 67 ++++--- .../petstore/R-httr2-wrapper/R/dummy_model.R | 51 +++--- .../petstore/R-httr2-wrapper/R/format_test.R | 163 ++++-------------- .../R-httr2-wrapper/R/model_api_response.R | 67 ++++--- .../R-httr2-wrapper/R/nested_one_of.R | 61 +++---- .../client/petstore/R-httr2-wrapper/R/order.R | 91 ++++------ .../client/petstore/R-httr2-wrapper/R/pet.R | 95 ++++------ .../petstore/R-httr2-wrapper/R/pet_map.R | 51 +++--- .../petstore/R-httr2-wrapper/R/special.R | 99 ++++------- .../client/petstore/R-httr2-wrapper/R/tag.R | 59 ++++--- .../R-httr2-wrapper/R/update_pet_request.R | 61 +++---- .../client/petstore/R-httr2-wrapper/R/user.R | 107 ++++-------- .../client/petstore/R-httr2-wrapper/R/whale.R | 67 ++++--- .../client/petstore/R-httr2-wrapper/R/zebra.R | 59 ++++--- .../R-httr2/R/allof_tag_api_response.R | 81 ++++----- samples/client/petstore/R-httr2/R/animal.R | 57 +++--- .../client/petstore/R-httr2/R/basque_pig.R | 57 +++--- samples/client/petstore/R-httr2/R/cat.R | 65 ++++--- samples/client/petstore/R-httr2/R/category.R | 57 +++--- .../client/petstore/R-httr2/R/danish_pig.R | 57 +++--- samples/client/petstore/R-httr2/R/date.R | 65 ++++--- samples/client/petstore/R-httr2/R/dog.R | 65 ++++--- .../client/petstore/R-httr2/R/format_test.R | 161 ++++------------- .../client/petstore/R-httr2/R/just_model.R | 49 ++++-- .../petstore/R-httr2/R/model_api_response.R | 65 ++++--- .../client/petstore/R-httr2/R/nested_one_of.R | 59 ++++--- samples/client/petstore/R-httr2/R/order.R | 89 ++++------ samples/client/petstore/R-httr2/R/pet.R | 93 ++++------ samples/client/petstore/R-httr2/R/pet_map.R | 49 ++++-- samples/client/petstore/R-httr2/R/special.R | 97 ++++------- samples/client/petstore/R-httr2/R/tag.R | 57 +++--- .../petstore/R-httr2/R/update_pet_request.R | 59 ++++--- samples/client/petstore/R-httr2/R/user.R | 105 ++++------- samples/client/petstore/R-httr2/R/whale.R | 65 ++++--- samples/client/petstore/R-httr2/R/zebra.R | 57 +++--- .../petstore/R/R/allof_tag_api_response.R | 83 ++++----- samples/client/petstore/R/R/animal.R | 59 ++++--- samples/client/petstore/R/R/basque_pig.R | 59 ++++--- samples/client/petstore/R/R/cat.R | 67 ++++--- samples/client/petstore/R/R/category.R | 59 ++++--- samples/client/petstore/R/R/danish_pig.R | 59 ++++--- samples/client/petstore/R/R/date.R | 67 ++++--- samples/client/petstore/R/R/dog.R | 67 ++++--- samples/client/petstore/R/R/dummy_model.R | 51 +++--- samples/client/petstore/R/R/format_test.R | 163 ++++-------------- .../client/petstore/R/R/model_api_response.R | 67 ++++--- samples/client/petstore/R/R/nested_one_of.R | 61 +++---- samples/client/petstore/R/R/order.R | 91 ++++------ samples/client/petstore/R/R/pet.R | 95 ++++------ samples/client/petstore/R/R/pet_map.R | 51 +++--- samples/client/petstore/R/R/special.R | 99 ++++------- samples/client/petstore/R/R/tag.R | 59 ++++--- .../client/petstore/R/R/update_pet_request.R | 61 +++---- samples/client/petstore/R/R/user.R | 107 ++++-------- samples/client/petstore/R/R/whale.R | 67 ++++--- samples/client/petstore/R/R/zebra.R | 59 ++++--- 75 files changed, 2343 insertions(+), 3118 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index 24f0ddf8c8f0..5fbb9d17ca2f 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -203,10 +203,25 @@ }, #' @description - #' To JSON String - #' - #' @return {{{classname}}} in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return {{{classname}}} as a base R list. + #' @examples + #' # convert array of {{{classname}}} (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { {{classname}}Object <- list() {{#vars}} if (!is.null(self$`{{name}}`)) { @@ -217,7 +232,7 @@ self$`{{name}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - lapply(self$`{{name}}`, function(x) x$toJSON()) + lapply(self$`{{name}}`, function(x) x$toList()) {{/isPrimitiveType}} {{/isArray}} {{#isMap}} @@ -225,7 +240,7 @@ self$`{{name}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - lapply(self$`{{name}}`, function(x) x$toJSON()) + lapply(self$`{{name}}`, function(x) x$toList()) {{/isPrimitiveType}} {{/isMap}} {{/isContainer}} @@ -234,7 +249,7 @@ self$`{{name}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - self$`{{name}}`$toJSON() + self$`{{name}}`$toList() {{/isPrimitiveType}} {{/isContainer}} } @@ -245,7 +260,7 @@ } {{/isAdditionalPropertiesTrue}} - {{classname}}Object + return({{classname}}Object) }, #' @description @@ -304,76 +319,24 @@ #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return {{{classname}}} in JSON format - toJSONString = function() { - jsoncontent <- c( - {{#vars}} - if (!is.null(self$`{{name}}`)) { - sprintf( - '"{{baseName}}": - {{#isContainer}} - {{#isArray}} - {{#isPrimitiveType}} - {{#isNumeric}}[%d]{{/isNumeric}}{{^isNumeric}}[%s]{{/isNumeric}} - {{/isPrimitiveType}} - {{^isPrimitiveType}}[%s] - {{/isPrimitiveType}} - {{/isArray}} - {{#isMap}} - {{#isPrimitiveType}} - {{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}{{/isBoolean}}%s{{^isBoolean}}{{/isBoolean}}{{/isNumeric}} - {{/isPrimitiveType}} - {{^isPrimitiveType}}%s - {{/isPrimitiveType}} - {{/isMap}} - {{/isContainer}} - {{^isContainer}} - {{#isPrimitiveType}} - {{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}"{{/isBoolean}}%s{{^isBoolean}}"{{/isBoolean}}{{/isNumeric}} - {{/isPrimitiveType}} - {{^isPrimitiveType}}%s - {{/isPrimitiveType}} - {{/isContainer}}', - {{#isContainer}} - {{#isArray}} - {{#isPrimitiveType}} - paste(unlist(lapply(self$`{{{name}}}`, function(x) paste0('"', x, '"'))), collapse = ",") - {{/isPrimitiveType}} - {{^isPrimitiveType}} - paste(sapply(self$`{{{name}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") - {{/isPrimitiveType}} - {{/isArray}} - {{#isMap}} - {{#isPrimitiveType}} - jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x }), auto_unbox = TRUE, digits = NA) - {{/isPrimitiveType}} - {{^isPrimitiveType}} - jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x$toJSON() }), auto_unbox = TRUE, digits = NA) - {{/isPrimitiveType}} - {{/isMap}} - {{/isContainer}} - {{^isContainer}} - {{#isPrimitiveType}} - {{#isBoolean}}tolower({{/isBoolean}}self$`{{name}}`{{#isBoolean}}){{/isBoolean}} - {{/isPrimitiveType}} - {{^isPrimitiveType}} - jsonlite::toJSON(self$`{{name}}`$toJSON(), auto_unbox = TRUE, digits = NA) - {{/isPrimitiveType}} - {{/isContainer}} - ) - }{{^-last}},{{/-last}} - {{/vars}} - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + {{#isAdditionalPropertiesTrue}} - json_obj <- jsonlite::fromJSON(json_string) for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) {{/isAdditionalPropertiesTrue}} + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R index 5132beb3788c..4c04d98b8a0e 100644 --- a/samples/client/echo_api/r/R/bird.R +++ b/samples/client/echo_api/r/R/bird.R @@ -40,10 +40,25 @@ Bird <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Bird in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Bird as a base R list. + #' @examples + #' # convert array of Bird (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { BirdObject <- list() if (!is.null(self$`size`)) { BirdObject[["size"]] <- @@ -53,7 +68,7 @@ Bird <- R6::R6Class( BirdObject[["color"]] <- self$`color` } - BirdObject + return(BirdObject) }, #' @description @@ -74,29 +89,19 @@ Bird <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Bird in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`size`)) { - sprintf( - '"size": - "%s" - ', - self$`size` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R index cbf3a88b9ddc..6db564b8db4f 100644 --- a/samples/client/echo_api/r/R/category.R +++ b/samples/client/echo_api/r/R/category.R @@ -40,10 +40,25 @@ Category <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Category in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Category as a base R list. + #' @examples + #' # convert array of Category (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -53,7 +68,7 @@ Category <- R6::R6Class( CategoryObject[["name"]] <- self$`name` } - CategoryObject + return(CategoryObject) }, #' @description @@ -74,29 +89,19 @@ Category <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R index edc0bcda0a72..5c5d95694966 100644 --- a/samples/client/echo_api/r/R/data_query.R +++ b/samples/client/echo_api/r/R/data_query.R @@ -67,10 +67,25 @@ DataQuery <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DataQuery in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DataQuery as a base R list. + #' @examples + #' # convert array of DataQuery (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DataQueryObject <- list() if (!is.null(self$`id`)) { DataQueryObject[["id"]] <- @@ -92,7 +107,7 @@ DataQuery <- R6::R6Class( DataQueryObject[["date"]] <- self$`date` } - DataQueryObject + return(DataQueryObject) }, #' @description @@ -122,53 +137,19 @@ DataQuery <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DataQuery in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`outcomes`)) { - sprintf( - '"outcomes": - [%s] - ', - paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`suffix`)) { - sprintf( - '"suffix": - "%s" - ', - self$`suffix` - ) - }, - if (!is.null(self$`text`)) { - sprintf( - '"text": - "%s" - ', - self$`text` - ) - }, - if (!is.null(self$`date`)) { - sprintf( - '"date": - "%s" - ', - self$`date` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R index 4456d7fcea03..57f73b924d21 100644 --- a/samples/client/echo_api/r/R/default_value.R +++ b/samples/client/echo_api/r/R/default_value.R @@ -87,14 +87,29 @@ DefaultValue <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DefaultValue in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DefaultValue as a base R list. + #' @examples + #' # convert array of DefaultValue (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DefaultValueObject <- list() if (!is.null(self$`array_string_enum_ref_default`)) { DefaultValueObject[["array_string_enum_ref_default"]] <- - lapply(self$`array_string_enum_ref_default`, function(x) x$toJSON()) + lapply(self$`array_string_enum_ref_default`, function(x) x$toList()) } if (!is.null(self$`array_string_enum_default`)) { DefaultValueObject[["array_string_enum_default"]] <- @@ -124,7 +139,7 @@ DefaultValue <- R6::R6Class( DefaultValueObject[["string_nullable"]] <- self$`string_nullable` } - DefaultValueObject + return(DefaultValueObject) }, #' @description @@ -163,77 +178,19 @@ DefaultValue <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DefaultValue in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`array_string_enum_ref_default`)) { - sprintf( - '"array_string_enum_ref_default": - [%s] -', - paste(sapply(self$`array_string_enum_ref_default`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") - ) - }, - if (!is.null(self$`array_string_enum_default`)) { - sprintf( - '"array_string_enum_default": - [%s] - ', - paste(unlist(lapply(self$`array_string_enum_default`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`array_string_default`)) { - sprintf( - '"array_string_default": - [%s] - ', - paste(unlist(lapply(self$`array_string_default`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`array_integer_default`)) { - sprintf( - '"array_integer_default": - [%s] - ', - paste(unlist(lapply(self$`array_integer_default`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`array_string`)) { - sprintf( - '"array_string": - [%s] - ', - paste(unlist(lapply(self$`array_string`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`array_string_nullable`)) { - sprintf( - '"array_string_nullable": - [%s] - ', - paste(unlist(lapply(self$`array_string_nullable`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`array_string_extension_nullable`)) { - sprintf( - '"array_string_extension_nullable": - [%s] - ', - paste(unlist(lapply(self$`array_string_extension_nullable`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`string_nullable`)) { - sprintf( - '"string_nullable": - "%s" - ', - self$`string_nullable` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R index 7b0b698630fd..d2f1a9a28462 100644 --- a/samples/client/echo_api/r/R/number_properties_only.R +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -46,10 +46,25 @@ NumberPropertiesOnly <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return NumberPropertiesOnly in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return NumberPropertiesOnly as a base R list. + #' @examples + #' # convert array of NumberPropertiesOnly (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { NumberPropertiesOnlyObject <- list() if (!is.null(self$`number`)) { NumberPropertiesOnlyObject[["number"]] <- @@ -63,7 +78,7 @@ NumberPropertiesOnly <- R6::R6Class( NumberPropertiesOnlyObject[["double"]] <- self$`double` } - NumberPropertiesOnlyObject + return(NumberPropertiesOnlyObject) }, #' @description @@ -87,37 +102,19 @@ NumberPropertiesOnly <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NumberPropertiesOnly in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`number`)) { - sprintf( - '"number": - %d - ', - self$`number` - ) - }, - if (!is.null(self$`float`)) { - sprintf( - '"float": - %d - ', - self$`float` - ) - }, - if (!is.null(self$`double`)) { - sprintf( - '"double": - %d - ', - self$`double` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R index b03d04e66cd6..6e25bc66043e 100644 --- a/samples/client/echo_api/r/R/pet.R +++ b/samples/client/echo_api/r/R/pet.R @@ -75,10 +75,25 @@ Pet <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Pet in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Pet as a base R list. + #' @examples + #' # convert array of Pet (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -90,7 +105,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toJSON() + self$`category`$toList() } if (!is.null(self$`photoUrls`)) { PetObject[["photoUrls"]] <- @@ -98,13 +113,13 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toJSON()) + lapply(self$`tags`, function(x) x$toList()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- self$`status` } - PetObject + return(PetObject) }, #' @description @@ -142,61 +157,19 @@ Pet <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`category`)) { - sprintf( - '"category": - %s - ', - jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`photoUrls`)) { - sprintf( - '"photoUrls": - [%s] - ', - paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`tags`)) { - sprintf( - '"tags": - [%s] -', - paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R index 527a97226b1d..2d13cbf4fba3 100644 --- a/samples/client/echo_api/r/R/query.R +++ b/samples/client/echo_api/r/R/query.R @@ -39,10 +39,25 @@ Query <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Query in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Query as a base R list. + #' @examples + #' # convert array of Query (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { QueryObject <- list() if (!is.null(self$`id`)) { QueryObject[["id"]] <- @@ -52,7 +67,7 @@ Query <- R6::R6Class( QueryObject[["outcomes"]] <- self$`outcomes` } - QueryObject + return(QueryObject) }, #' @description @@ -73,29 +88,19 @@ Query <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Query in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`outcomes`)) { - sprintf( - '"outcomes": - [%s] - ', - paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R index b23305a43afc..cc1050408a15 100644 --- a/samples/client/echo_api/r/R/tag.R +++ b/samples/client/echo_api/r/R/tag.R @@ -40,10 +40,25 @@ Tag <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Tag in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Tag as a base R list. + #' @examples + #' # convert array of Tag (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -53,7 +68,7 @@ Tag <- R6::R6Class( TagObject[["name"]] <- self$`name` } - TagObject + return(TagObject) }, #' @description @@ -74,29 +89,19 @@ Tag <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R index 6c523622cde0..39946e0e5a40 100644 --- a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -31,16 +31,31 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return TestFormObjectMultipartRequestMarker in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return TestFormObjectMultipartRequestMarker as a base R list. + #' @examples + #' # convert array of TestFormObjectMultipartRequestMarker (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TestFormObjectMultipartRequestMarkerObject <- list() if (!is.null(self$`name`)) { TestFormObjectMultipartRequestMarkerObject[["name"]] <- self$`name` } - TestFormObjectMultipartRequestMarkerObject + return(TestFormObjectMultipartRequestMarkerObject) }, #' @description @@ -58,21 +73,19 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return TestFormObjectMultipartRequestMarker in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R index 8616e605bf93..3d740ae75253 100644 --- a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -58,10 +58,25 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas }, #' @description - #' To JSON String - #' - #' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter as a base R list. + #' @examples + #' # convert array of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject <- list() if (!is.null(self$`size`)) { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["size"]] <- @@ -79,7 +94,7 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["name"]] <- self$`name` } - TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject + return(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject) }, #' @description @@ -106,45 +121,19 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`size`)) { - sprintf( - '"size": - "%s" - ', - self$`size` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R index a6e69b27f3be..f92f2733a638 100644 --- a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -30,16 +30,31 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter as a base R list. + #' @examples + #' # convert array of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject <- list() if (!is.null(self$`values`)) { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject[["values"]] <- self$`values` } - TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject + return(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject) }, #' @description @@ -57,21 +72,19 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`values`)) { - sprintf( - '"values": - [%s] - ', - paste(unlist(lapply(self$`values`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R index 454e378a5c16..c4559b3e5145 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R @@ -77,10 +77,25 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return AllofTagApiResponse in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return AllofTagApiResponse as a base R list. + #' @examples + #' # convert array of AllofTagApiResponse (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { AllofTagApiResponseObject <- list() if (!is.null(self$`id`)) { AllofTagApiResponseObject[["id"]] <- @@ -106,7 +121,7 @@ AllofTagApiResponse <- R6::R6Class( AllofTagApiResponseObject[[key]] <- self$additional_properties[[key]] } - AllofTagApiResponseObject + return(AllofTagApiResponseObject) }, #' @description @@ -143,58 +158,22 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return AllofTagApiResponse in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`code`)) { - sprintf( - '"code": - %d - ', - self$`code` - ) - }, - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`message`)) { - sprintf( - '"message": - "%s" - ', - self$`message` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/animal.R b/samples/client/petstore/R-httr2-wrapper/R/animal.R index 471a01afef3b..03da218e9927 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/animal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/animal.R @@ -52,10 +52,25 @@ Animal <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Animal in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Animal as a base R list. + #' @examples + #' # convert array of Animal (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { AnimalObject <- list() if (!is.null(self$`className`)) { AnimalObject[["className"]] <- @@ -69,7 +84,7 @@ Animal <- R6::R6Class( AnimalObject[[key]] <- self$additional_properties[[key]] } - AnimalObject + return(AnimalObject) }, #' @description @@ -97,34 +112,22 @@ Animal <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Animal in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R index cce82cd7d932..5af7c69e8359 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R @@ -50,10 +50,25 @@ BasquePig <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return BasquePig in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return BasquePig as a base R list. + #' @examples + #' # convert array of BasquePig (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { BasquePigObject <- list() if (!is.null(self$`className`)) { BasquePigObject[["className"]] <- @@ -67,7 +82,7 @@ BasquePig <- R6::R6Class( BasquePigObject[[key]] <- self$additional_properties[[key]] } - BasquePigObject + return(BasquePigObject) }, #' @description @@ -95,34 +110,22 @@ BasquePig <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return BasquePig in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/cat.R b/samples/client/petstore/R-httr2-wrapper/R/cat.R index b4014681ba49..072decc18b9c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/cat.R +++ b/samples/client/petstore/R-httr2-wrapper/R/cat.R @@ -60,10 +60,25 @@ Cat <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Cat in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Cat as a base R list. + #' @examples + #' # convert array of Cat (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CatObject <- list() if (!is.null(self$`className`)) { CatObject[["className"]] <- @@ -81,7 +96,7 @@ Cat <- R6::R6Class( CatObject[[key]] <- self$additional_properties[[key]] } - CatObject + return(CatObject) }, #' @description @@ -112,42 +127,22 @@ Cat <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Cat in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`declawed`)) { - sprintf( - '"declawed": - %s - ', - tolower(self$`declawed`) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/category.R b/samples/client/petstore/R-httr2-wrapper/R/category.R index 31106a3bc9e2..5793f3264f1a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/category.R +++ b/samples/client/petstore/R-httr2-wrapper/R/category.R @@ -50,10 +50,25 @@ Category <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Category in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Category as a base R list. + #' @examples + #' # convert array of Category (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -67,7 +82,7 @@ Category <- R6::R6Class( CategoryObject[[key]] <- self$additional_properties[[key]] } - CategoryObject + return(CategoryObject) }, #' @description @@ -95,34 +110,22 @@ Category <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R index 08ca2b9e3eea..4f78411ab788 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R @@ -50,10 +50,25 @@ DanishPig <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DanishPig in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DanishPig as a base R list. + #' @examples + #' # convert array of DanishPig (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DanishPigObject <- list() if (!is.null(self$`className`)) { DanishPigObject[["className"]] <- @@ -67,7 +82,7 @@ DanishPig <- R6::R6Class( DanishPigObject[[key]] <- self$additional_properties[[key]] } - DanishPigObject + return(DanishPigObject) }, #' @description @@ -95,34 +110,22 @@ DanishPig <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DanishPig in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`size`)) { - sprintf( - '"size": - %d - ', - self$`size` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/date.R b/samples/client/petstore/R-httr2-wrapper/R/date.R index d9b6ec0beb1b..e2f3816c2269 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/date.R +++ b/samples/client/petstore/R-httr2-wrapper/R/date.R @@ -63,10 +63,25 @@ Date <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Date in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Date as a base R list. + #' @examples + #' # convert array of Date (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DateObject <- list() if (!is.null(self$`className`)) { DateObject[["className"]] <- @@ -84,7 +99,7 @@ Date <- R6::R6Class( DateObject[[key]] <- self$additional_properties[[key]] } - DateObject + return(DateObject) }, #' @description @@ -119,42 +134,22 @@ Date <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Date in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`percent_description`)) { - sprintf( - '"percent_description": - "%s" - ', - self$`percent_description` - ) - }, - if (!is.null(self$`url_property`)) { - sprintf( - '"url_property": - "%s" - ', - self$`url_property` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/dog.R b/samples/client/petstore/R-httr2-wrapper/R/dog.R index 34ae29121163..4aa6742dcc78 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dog.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dog.R @@ -60,10 +60,25 @@ Dog <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Dog in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Dog as a base R list. + #' @examples + #' # convert array of Dog (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DogObject <- list() if (!is.null(self$`className`)) { DogObject[["className"]] <- @@ -81,7 +96,7 @@ Dog <- R6::R6Class( DogObject[[key]] <- self$additional_properties[[key]] } - DogObject + return(DogObject) }, #' @description @@ -112,42 +127,22 @@ Dog <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Dog in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`breed`)) { - sprintf( - '"breed": - "%s" - ', - self$`breed` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R index 12d3ab52a155..ec28d376d53f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R @@ -41,10 +41,25 @@ DummyModel <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DummyModel in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DummyModel as a base R list. + #' @examples + #' # convert array of DummyModel (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DummyModelObject <- list() if (!is.null(self$`property`)) { DummyModelObject[["property"]] <- @@ -54,7 +69,7 @@ DummyModel <- R6::R6Class( DummyModelObject[[key]] <- self$additional_properties[[key]] } - DummyModelObject + return(DummyModelObject) }, #' @description @@ -79,26 +94,22 @@ DummyModel <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DummyModel in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`property`)) { - sprintf( - '"property": - "%s" - ', - self$`property` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/format_test.R b/samples/client/petstore/R-httr2-wrapper/R/format_test.R index f93bf1435c9a..f445caea8224 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/format_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/format_test.R @@ -158,10 +158,25 @@ FormatTest <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return FormatTest in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return FormatTest as a base R list. + #' @examples + #' # convert array of FormatTest (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { FormatTestObject <- list() if (!is.null(self$`integer`)) { FormatTestObject[["integer"]] <- @@ -227,7 +242,7 @@ FormatTest <- R6::R6Class( FormatTestObject[[key]] <- self$additional_properties[[key]] } - FormatTestObject + return(FormatTestObject) }, #' @description @@ -294,138 +309,22 @@ FormatTest <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return FormatTest in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`integer`)) { - sprintf( - '"integer": - %d - ', - self$`integer` - ) - }, - if (!is.null(self$`int32`)) { - sprintf( - '"int32": - %d - ', - self$`int32` - ) - }, - if (!is.null(self$`int64`)) { - sprintf( - '"int64": - %d - ', - self$`int64` - ) - }, - if (!is.null(self$`number`)) { - sprintf( - '"number": - %d - ', - self$`number` - ) - }, - if (!is.null(self$`float`)) { - sprintf( - '"float": - %d - ', - self$`float` - ) - }, - if (!is.null(self$`double`)) { - sprintf( - '"double": - %d - ', - self$`double` - ) - }, - if (!is.null(self$`string`)) { - sprintf( - '"string": - "%s" - ', - self$`string` - ) - }, - if (!is.null(self$`byte`)) { - sprintf( - '"byte": - "%s" - ', - self$`byte` - ) - }, - if (!is.null(self$`binary`)) { - sprintf( - '"binary": - "%s" - ', - self$`binary` - ) - }, - if (!is.null(self$`date`)) { - sprintf( - '"date": - "%s" - ', - self$`date` - ) - }, - if (!is.null(self$`dateTime`)) { - sprintf( - '"dateTime": - "%s" - ', - self$`dateTime` - ) - }, - if (!is.null(self$`uuid`)) { - sprintf( - '"uuid": - "%s" - ', - self$`uuid` - ) - }, - if (!is.null(self$`password`)) { - sprintf( - '"password": - "%s" - ', - self$`password` - ) - }, - if (!is.null(self$`pattern_with_digits`)) { - sprintf( - '"pattern_with_digits": - "%s" - ', - self$`pattern_with_digits` - ) - }, - if (!is.null(self$`pattern_with_digits_and_delimiter`)) { - sprintf( - '"pattern_with_digits_and_delimiter": - "%s" - ', - self$`pattern_with_digits_and_delimiter` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R index 9116e438fedc..3634304e857c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R @@ -59,10 +59,25 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return ModelApiResponse in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return ModelApiResponse as a base R list. + #' @examples + #' # convert array of ModelApiResponse (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { ModelApiResponseObject <- list() if (!is.null(self$`code`)) { ModelApiResponseObject[["code"]] <- @@ -80,7 +95,7 @@ ModelApiResponse <- R6::R6Class( ModelApiResponseObject[[key]] <- self$additional_properties[[key]] } - ModelApiResponseObject + return(ModelApiResponseObject) }, #' @description @@ -111,42 +126,22 @@ ModelApiResponse <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return ModelApiResponse in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`code`)) { - sprintf( - '"code": - %d - ', - self$`code` - ) - }, - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`message`)) { - sprintf( - '"message": - "%s" - ', - self$`message` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index e04a31a69acd..b69969f79f68 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -48,10 +48,25 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return NestedOneOf in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return NestedOneOf as a base R list. + #' @examples + #' # convert array of NestedOneOf (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { NestedOneOfObject <- list() if (!is.null(self$`size`)) { NestedOneOfObject[["size"]] <- @@ -59,13 +74,13 @@ NestedOneOf <- R6::R6Class( } if (!is.null(self$`nested_pig`)) { NestedOneOfObject[["nested_pig"]] <- - self$`nested_pig`$toJSON() + self$`nested_pig`$toList() } for (key in names(self$additional_properties)) { NestedOneOfObject[[key]] <- self$additional_properties[[key]] } - NestedOneOfObject + return(NestedOneOfObject) }, #' @description @@ -95,34 +110,22 @@ NestedOneOf <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`size`)) { - sprintf( - '"size": - %d - ', - self$`size` - ) - }, - if (!is.null(self$`nested_pig`)) { - sprintf( - '"nested_pig": - %s - ', - jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/order.R b/samples/client/petstore/R-httr2-wrapper/R/order.R index cd84eed74eef..57e8afb93f6d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/order.R +++ b/samples/client/petstore/R-httr2-wrapper/R/order.R @@ -89,10 +89,25 @@ Order <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Order in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Order as a base R list. + #' @examples + #' # convert array of Order (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { OrderObject <- list() if (!is.null(self$`id`)) { OrderObject[["id"]] <- @@ -122,7 +137,7 @@ Order <- R6::R6Class( OrderObject[[key]] <- self$additional_properties[[key]] } - OrderObject + return(OrderObject) }, #' @description @@ -165,66 +180,22 @@ Order <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Order in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`petId`)) { - sprintf( - '"petId": - %d - ', - self$`petId` - ) - }, - if (!is.null(self$`quantity`)) { - sprintf( - '"quantity": - %d - ', - self$`quantity` - ) - }, - if (!is.null(self$`shipDate`)) { - sprintf( - '"shipDate": - "%s" - ', - self$`shipDate` - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - }, - if (!is.null(self$`complete`)) { - sprintf( - '"complete": - %s - ', - tolower(self$`complete`) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet.R b/samples/client/petstore/R-httr2-wrapper/R/pet.R index 28e1693c419f..cc0083ccb2f5 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet.R @@ -85,10 +85,25 @@ Pet <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Pet in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Pet as a base R list. + #' @examples + #' # convert array of Pet (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -96,7 +111,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toJSON() + self$`category`$toList() } if (!is.null(self$`name`)) { PetObject[["name"]] <- @@ -108,7 +123,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toJSON()) + lapply(self$`tags`, function(x) x$toList()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- @@ -118,7 +133,7 @@ Pet <- R6::R6Class( PetObject[[key]] <- self$additional_properties[[key]] } - PetObject + return(PetObject) }, #' @description @@ -163,66 +178,22 @@ Pet <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`category`)) { - sprintf( - '"category": - %s - ', - jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`photoUrls`)) { - sprintf( - '"photoUrls": - [%s] - ', - paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`tags`)) { - sprintf( - '"tags": - [%s] -', - paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R index 1fc910ac1da2..9d00d4d7cf5d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R @@ -40,10 +40,25 @@ PetMap <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return PetMap in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return PetMap as a base R list. + #' @examples + #' # convert array of PetMap (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetMapObject <- list() if (!is.null(self$`pet`)) { PetMapObject[["pet"]] <- @@ -53,7 +68,7 @@ PetMap <- R6::R6Class( PetMapObject[[key]] <- self$additional_properties[[key]] } - PetMapObject + return(PetMapObject) }, #' @description @@ -78,26 +93,22 @@ PetMap <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return PetMap in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`pet`)) { - sprintf( - '"pet": - %s - ', - jsonlite::toJSON(lapply(self$`pet`, function(x){ x }), auto_unbox = TRUE, digits = NA) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/special.R b/samples/client/petstore/R-httr2-wrapper/R/special.R index 5841fc79dd39..fd8aa79b26ba 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/special.R +++ b/samples/client/petstore/R-httr2-wrapper/R/special.R @@ -97,10 +97,25 @@ Special <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Special in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Special as a base R list. + #' @examples + #' # convert array of Special (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { SpecialObject <- list() if (!is.null(self$`set_test`)) { SpecialObject[["set_test"]] <- @@ -134,7 +149,7 @@ Special <- R6::R6Class( SpecialObject[[key]] <- self$additional_properties[[key]] } - SpecialObject + return(SpecialObject) }, #' @description @@ -180,74 +195,22 @@ Special <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Special in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`set_test`)) { - sprintf( - '"set_test": - [%s] - ', - paste(unlist(lapply(self$`set_test`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`item_self`)) { - sprintf( - '"self": - %d - ', - self$`item_self` - ) - }, - if (!is.null(self$`item_private`)) { - sprintf( - '"private": - "%s" - ', - self$`item_private` - ) - }, - if (!is.null(self$`item_super`)) { - sprintf( - '"super": - "%s" - ', - self$`item_super` - ) - }, - if (!is.null(self$`123_number`)) { - sprintf( - '"123_number": - "%s" - ', - self$`123_number` - ) - }, - if (!is.null(self$`array[test]`)) { - sprintf( - '"array[test]": - "%s" - ', - self$`array[test]` - ) - }, - if (!is.null(self$`empty_string`)) { - sprintf( - '"empty_string": - "%s" - ', - self$`empty_string` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/tag.R b/samples/client/petstore/R-httr2-wrapper/R/tag.R index c9ec58ae6b82..ce13bc25c170 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/tag.R +++ b/samples/client/petstore/R-httr2-wrapper/R/tag.R @@ -50,10 +50,25 @@ Tag <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Tag in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Tag as a base R list. + #' @examples + #' # convert array of Tag (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -67,7 +82,7 @@ Tag <- R6::R6Class( TagObject[[key]] <- self$additional_properties[[key]] } - TagObject + return(TagObject) }, #' @description @@ -95,34 +110,22 @@ Tag <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R index 47369030cfac..c8e6bf91cb1a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R @@ -45,14 +45,29 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return UpdatePetRequest in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return UpdatePetRequest as a base R list. + #' @examples + #' # convert array of UpdatePetRequest (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { UpdatePetRequestObject <- list() if (!is.null(self$`jsonData`)) { UpdatePetRequestObject[["jsonData"]] <- - self$`jsonData`$toJSON() + self$`jsonData`$toList() } if (!is.null(self$`binaryDataN2Information`)) { UpdatePetRequestObject[["binaryDataN2Information"]] <- @@ -62,7 +77,7 @@ UpdatePetRequest <- R6::R6Class( UpdatePetRequestObject[[key]] <- self$additional_properties[[key]] } - UpdatePetRequestObject + return(UpdatePetRequestObject) }, #' @description @@ -92,34 +107,22 @@ UpdatePetRequest <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return UpdatePetRequest in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`jsonData`)) { - sprintf( - '"jsonData": - %s - ', - jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`binaryDataN2Information`)) { - sprintf( - '"binaryDataN2Information": - "%s" - ', - self$`binaryDataN2Information` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/user.R b/samples/client/petstore/R-httr2-wrapper/R/user.R index df4396abb2ca..76a78edad38a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user.R @@ -104,10 +104,25 @@ User <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return User in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return User as a base R list. + #' @examples + #' # convert array of User (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { UserObject <- list() if (!is.null(self$`id`)) { UserObject[["id"]] <- @@ -145,7 +160,7 @@ User <- R6::R6Class( UserObject[[key]] <- self$additional_properties[[key]] } - UserObject + return(UserObject) }, #' @description @@ -191,82 +206,22 @@ User <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return User in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`username`)) { - sprintf( - '"username": - "%s" - ', - self$`username` - ) - }, - if (!is.null(self$`firstName`)) { - sprintf( - '"firstName": - "%s" - ', - self$`firstName` - ) - }, - if (!is.null(self$`lastName`)) { - sprintf( - '"lastName": - "%s" - ', - self$`lastName` - ) - }, - if (!is.null(self$`email`)) { - sprintf( - '"email": - "%s" - ', - self$`email` - ) - }, - if (!is.null(self$`password`)) { - sprintf( - '"password": - "%s" - ', - self$`password` - ) - }, - if (!is.null(self$`phone`)) { - sprintf( - '"phone": - "%s" - ', - self$`phone` - ) - }, - if (!is.null(self$`userStatus`)) { - sprintf( - '"userStatus": - %d - ', - self$`userStatus` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/whale.R b/samples/client/petstore/R-httr2-wrapper/R/whale.R index e39211045a76..ceb056aab2dd 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/whale.R +++ b/samples/client/petstore/R-httr2-wrapper/R/whale.R @@ -59,10 +59,25 @@ Whale <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Whale in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Whale as a base R list. + #' @examples + #' # convert array of Whale (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { WhaleObject <- list() if (!is.null(self$`hasBaleen`)) { WhaleObject[["hasBaleen"]] <- @@ -80,7 +95,7 @@ Whale <- R6::R6Class( WhaleObject[[key]] <- self$additional_properties[[key]] } - WhaleObject + return(WhaleObject) }, #' @description @@ -111,42 +126,22 @@ Whale <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Whale in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`hasBaleen`)) { - sprintf( - '"hasBaleen": - %s - ', - tolower(self$`hasBaleen`) - ) - }, - if (!is.null(self$`hasTeeth`)) { - sprintf( - '"hasTeeth": - %s - ', - tolower(self$`hasTeeth`) - ) - }, - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/zebra.R b/samples/client/petstore/R-httr2-wrapper/R/zebra.R index fb6d90d4d983..bbc678e1c5f3 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/zebra.R +++ b/samples/client/petstore/R-httr2-wrapper/R/zebra.R @@ -53,10 +53,25 @@ Zebra <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Zebra in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Zebra as a base R list. + #' @examples + #' # convert array of Zebra (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { ZebraObject <- list() if (!is.null(self$`type`)) { ZebraObject[["type"]] <- @@ -70,7 +85,7 @@ Zebra <- R6::R6Class( ZebraObject[[key]] <- self$additional_properties[[key]] } - ZebraObject + return(ZebraObject) }, #' @description @@ -101,34 +116,22 @@ Zebra <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Zebra in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index ff239b9cda9e..56ca03050bb8 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -67,10 +67,25 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return AllofTagApiResponse in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return AllofTagApiResponse as a base R list. + #' @examples + #' # convert array of AllofTagApiResponse (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { AllofTagApiResponseObject <- list() if (!is.null(self$`id`)) { AllofTagApiResponseObject[["id"]] <- @@ -92,7 +107,7 @@ AllofTagApiResponse <- R6::R6Class( AllofTagApiResponseObject[["message"]] <- self$`message` } - AllofTagApiResponseObject + return(AllofTagApiResponseObject) }, #' @description @@ -122,53 +137,19 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return AllofTagApiResponse in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`code`)) { - sprintf( - '"code": - %d - ', - self$`code` - ) - }, - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`message`)) { - sprintf( - '"message": - "%s" - ', - self$`message` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 4f1f8ab507c6..1c16faf39fd5 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -42,10 +42,25 @@ Animal <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Animal in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Animal as a base R list. + #' @examples + #' # convert array of Animal (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { AnimalObject <- list() if (!is.null(self$`className`)) { AnimalObject[["className"]] <- @@ -55,7 +70,7 @@ Animal <- R6::R6Class( AnimalObject[["color"]] <- self$`color` } - AnimalObject + return(AnimalObject) }, #' @description @@ -76,29 +91,19 @@ Animal <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Animal in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 6833f264bc7a..85986bfb649a 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -40,10 +40,25 @@ BasquePig <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return BasquePig in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return BasquePig as a base R list. + #' @examples + #' # convert array of BasquePig (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { BasquePigObject <- list() if (!is.null(self$`className`)) { BasquePigObject[["className"]] <- @@ -53,7 +68,7 @@ BasquePig <- R6::R6Class( BasquePigObject[["color"]] <- self$`color` } - BasquePigObject + return(BasquePigObject) }, #' @description @@ -74,29 +89,19 @@ BasquePig <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return BasquePig in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index d50bf428d8eb..b40ea9c6d32a 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -50,10 +50,25 @@ Cat <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Cat in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Cat as a base R list. + #' @examples + #' # convert array of Cat (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CatObject <- list() if (!is.null(self$`className`)) { CatObject[["className"]] <- @@ -67,7 +82,7 @@ Cat <- R6::R6Class( CatObject[["declawed"]] <- self$`declawed` } - CatObject + return(CatObject) }, #' @description @@ -91,37 +106,19 @@ Cat <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Cat in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`declawed`)) { - sprintf( - '"declawed": - %s - ', - tolower(self$`declawed`) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index 752d9b8024b1..f3d3fc922640 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -40,10 +40,25 @@ Category <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Category in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Category as a base R list. + #' @examples + #' # convert array of Category (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -53,7 +68,7 @@ Category <- R6::R6Class( CategoryObject[["name"]] <- self$`name` } - CategoryObject + return(CategoryObject) }, #' @description @@ -74,29 +89,19 @@ Category <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index d7e35b52e5e6..e9af6dc909da 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -40,10 +40,25 @@ DanishPig <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DanishPig in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DanishPig as a base R list. + #' @examples + #' # convert array of DanishPig (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DanishPigObject <- list() if (!is.null(self$`className`)) { DanishPigObject[["className"]] <- @@ -53,7 +68,7 @@ DanishPig <- R6::R6Class( DanishPigObject[["size"]] <- self$`size` } - DanishPigObject + return(DanishPigObject) }, #' @description @@ -74,29 +89,19 @@ DanishPig <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DanishPig in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`size`)) { - sprintf( - '"size": - %d - ', - self$`size` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/date.R b/samples/client/petstore/R-httr2/R/date.R index a822606b6b7b..b3e02045052c 100644 --- a/samples/client/petstore/R-httr2/R/date.R +++ b/samples/client/petstore/R-httr2/R/date.R @@ -53,10 +53,25 @@ Date <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Date in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Date as a base R list. + #' @examples + #' # convert array of Date (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DateObject <- list() if (!is.null(self$`className`)) { DateObject[["className"]] <- @@ -70,7 +85,7 @@ Date <- R6::R6Class( DateObject[["url_property"]] <- self$`url_property` } - DateObject + return(DateObject) }, #' @description @@ -98,37 +113,19 @@ Date <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Date in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`percent`)) { - sprintf( - '"percent_description": - "%s" - ', - self$`percent` - ) - }, - if (!is.null(self$`url_property`)) { - sprintf( - '"url_property": - "%s" - ', - self$`url_property` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 0851d7461d99..485a34aefd7b 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -50,10 +50,25 @@ Dog <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Dog in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Dog as a base R list. + #' @examples + #' # convert array of Dog (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DogObject <- list() if (!is.null(self$`className`)) { DogObject[["className"]] <- @@ -67,7 +82,7 @@ Dog <- R6::R6Class( DogObject[["breed"]] <- self$`breed` } - DogObject + return(DogObject) }, #' @description @@ -91,37 +106,19 @@ Dog <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Dog in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`breed`)) { - sprintf( - '"breed": - "%s" - ', - self$`breed` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/format_test.R b/samples/client/petstore/R-httr2/R/format_test.R index 117497304980..7ac21e6cb00d 100644 --- a/samples/client/petstore/R-httr2/R/format_test.R +++ b/samples/client/petstore/R-httr2/R/format_test.R @@ -148,10 +148,25 @@ FormatTest <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return FormatTest in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return FormatTest as a base R list. + #' @examples + #' # convert array of FormatTest (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { FormatTestObject <- list() if (!is.null(self$`integer`)) { FormatTestObject[["integer"]] <- @@ -213,7 +228,7 @@ FormatTest <- R6::R6Class( FormatTestObject[["pattern_with_digits_and_delimiter"]] <- self$`pattern_with_digits_and_delimiter` } - FormatTestObject + return(FormatTestObject) }, #' @description @@ -273,133 +288,19 @@ FormatTest <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return FormatTest in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`integer`)) { - sprintf( - '"integer": - %d - ', - self$`integer` - ) - }, - if (!is.null(self$`int32`)) { - sprintf( - '"int32": - %d - ', - self$`int32` - ) - }, - if (!is.null(self$`int64`)) { - sprintf( - '"int64": - %d - ', - self$`int64` - ) - }, - if (!is.null(self$`number`)) { - sprintf( - '"number": - %d - ', - self$`number` - ) - }, - if (!is.null(self$`float`)) { - sprintf( - '"float": - %d - ', - self$`float` - ) - }, - if (!is.null(self$`double`)) { - sprintf( - '"double": - %d - ', - self$`double` - ) - }, - if (!is.null(self$`string`)) { - sprintf( - '"string": - "%s" - ', - self$`string` - ) - }, - if (!is.null(self$`byte`)) { - sprintf( - '"byte": - "%s" - ', - self$`byte` - ) - }, - if (!is.null(self$`binary`)) { - sprintf( - '"binary": - "%s" - ', - self$`binary` - ) - }, - if (!is.null(self$`date`)) { - sprintf( - '"date": - "%s" - ', - self$`date` - ) - }, - if (!is.null(self$`dateTime`)) { - sprintf( - '"dateTime": - "%s" - ', - self$`dateTime` - ) - }, - if (!is.null(self$`uuid`)) { - sprintf( - '"uuid": - "%s" - ', - self$`uuid` - ) - }, - if (!is.null(self$`password`)) { - sprintf( - '"password": - "%s" - ', - self$`password` - ) - }, - if (!is.null(self$`pattern_with_digits`)) { - sprintf( - '"pattern_with_digits": - "%s" - ', - self$`pattern_with_digits` - ) - }, - if (!is.null(self$`pattern_with_digits_and_delimiter`)) { - sprintf( - '"pattern_with_digits_and_delimiter": - "%s" - ', - self$`pattern_with_digits_and_delimiter` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/just_model.R b/samples/client/petstore/R-httr2/R/just_model.R index 780533eb3db0..ddbf460f325e 100644 --- a/samples/client/petstore/R-httr2/R/just_model.R +++ b/samples/client/petstore/R-httr2/R/just_model.R @@ -31,16 +31,31 @@ JustModel <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return JustModel in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return JustModel as a base R list. + #' @examples + #' # convert array of JustModel (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { JustModelObject <- list() if (!is.null(self$`property`)) { JustModelObject[["property"]] <- self$`property` } - JustModelObject + return(JustModelObject) }, #' @description @@ -58,21 +73,19 @@ JustModel <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JustModel in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`property`)) { - sprintf( - '"property": - "%s" - ', - self$`property` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index 98814bedafbb..548f49c179d0 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -49,10 +49,25 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return ModelApiResponse in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return ModelApiResponse as a base R list. + #' @examples + #' # convert array of ModelApiResponse (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { ModelApiResponseObject <- list() if (!is.null(self$`code`)) { ModelApiResponseObject[["code"]] <- @@ -66,7 +81,7 @@ ModelApiResponse <- R6::R6Class( ModelApiResponseObject[["message"]] <- self$`message` } - ModelApiResponseObject + return(ModelApiResponseObject) }, #' @description @@ -90,37 +105,19 @@ ModelApiResponse <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return ModelApiResponse in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`code`)) { - sprintf( - '"code": - %d - ', - self$`code` - ) - }, - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`message`)) { - sprintf( - '"message": - "%s" - ', - self$`message` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index c1abefcacd8b..6966fd7c5585 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -38,10 +38,25 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return NestedOneOf in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return NestedOneOf as a base R list. + #' @examples + #' # convert array of NestedOneOf (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { NestedOneOfObject <- list() if (!is.null(self$`size`)) { NestedOneOfObject[["size"]] <- @@ -49,9 +64,9 @@ NestedOneOf <- R6::R6Class( } if (!is.null(self$`nested_pig`)) { NestedOneOfObject[["nested_pig"]] <- - self$`nested_pig`$toJSON() + self$`nested_pig`$toList() } - NestedOneOfObject + return(NestedOneOfObject) }, #' @description @@ -74,29 +89,19 @@ NestedOneOf <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`size`)) { - sprintf( - '"size": - %d - ', - self$`size` - ) - }, - if (!is.null(self$`nested_pig`)) { - sprintf( - '"nested_pig": - %s - ', - jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index 4155b311f316..ae6e7e6df372 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -79,10 +79,25 @@ Order <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Order in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Order as a base R list. + #' @examples + #' # convert array of Order (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { OrderObject <- list() if (!is.null(self$`id`)) { OrderObject[["id"]] <- @@ -108,7 +123,7 @@ Order <- R6::R6Class( OrderObject[["complete"]] <- self$`complete` } - OrderObject + return(OrderObject) }, #' @description @@ -144,61 +159,19 @@ Order <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Order in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`petId`)) { - sprintf( - '"petId": - %d - ', - self$`petId` - ) - }, - if (!is.null(self$`quantity`)) { - sprintf( - '"quantity": - %d - ', - self$`quantity` - ) - }, - if (!is.null(self$`shipDate`)) { - sprintf( - '"shipDate": - "%s" - ', - self$`shipDate` - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - }, - if (!is.null(self$`complete`)) { - sprintf( - '"complete": - %s - ', - tolower(self$`complete`) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index e3f3274dbc83..3f58a6f11708 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -75,10 +75,25 @@ Pet <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Pet in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Pet as a base R list. + #' @examples + #' # convert array of Pet (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -86,7 +101,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toJSON() + self$`category`$toList() } if (!is.null(self$`name`)) { PetObject[["name"]] <- @@ -98,13 +113,13 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toJSON()) + lapply(self$`tags`, function(x) x$toList()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- self$`status` } - PetObject + return(PetObject) }, #' @description @@ -142,61 +157,19 @@ Pet <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`category`)) { - sprintf( - '"category": - %s - ', - jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`photoUrls`)) { - sprintf( - '"photoUrls": - [%s] - ', - paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`tags`)) { - sprintf( - '"tags": - [%s] -', - paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pet_map.R b/samples/client/petstore/R-httr2/R/pet_map.R index 6a8b62a0a695..61242dcad103 100644 --- a/samples/client/petstore/R-httr2/R/pet_map.R +++ b/samples/client/petstore/R-httr2/R/pet_map.R @@ -30,16 +30,31 @@ PetMap <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return PetMap in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return PetMap as a base R list. + #' @examples + #' # convert array of PetMap (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetMapObject <- list() if (!is.null(self$`pet`)) { PetMapObject[["pet"]] <- self$`pet` } - PetMapObject + return(PetMapObject) }, #' @description @@ -57,21 +72,19 @@ PetMap <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return PetMap in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`pet`)) { - sprintf( - '"pet": - %s - ', - jsonlite::toJSON(lapply(self$`pet`, function(x){ x }), auto_unbox = TRUE, digits = NA) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index 4e4250f78d3c..f82ee61b5e10 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -87,10 +87,25 @@ Special <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Special in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Special as a base R list. + #' @examples + #' # convert array of Special (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { SpecialObject <- list() if (!is.null(self$`set_test`)) { SpecialObject[["set_test"]] <- @@ -120,7 +135,7 @@ Special <- R6::R6Class( SpecialObject[["empty_string"]] <- self$`empty_string` } - SpecialObject + return(SpecialObject) }, #' @description @@ -159,69 +174,19 @@ Special <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Special in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`set_test`)) { - sprintf( - '"set_test": - [%s] - ', - paste(unlist(lapply(self$`set_test`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`item_self`)) { - sprintf( - '"self": - %d - ', - self$`item_self` - ) - }, - if (!is.null(self$`item_private`)) { - sprintf( - '"private": - "%s" - ', - self$`item_private` - ) - }, - if (!is.null(self$`item_super`)) { - sprintf( - '"super": - "%s" - ', - self$`item_super` - ) - }, - if (!is.null(self$`123_number`)) { - sprintf( - '"123_number": - "%s" - ', - self$`123_number` - ) - }, - if (!is.null(self$`array[test]`)) { - sprintf( - '"array[test]": - "%s" - ', - self$`array[test]` - ) - }, - if (!is.null(self$`empty_string`)) { - sprintf( - '"empty_string": - "%s" - ', - self$`empty_string` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index 574b5c0395af..f6d5e1232674 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -40,10 +40,25 @@ Tag <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Tag in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Tag as a base R list. + #' @examples + #' # convert array of Tag (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -53,7 +68,7 @@ Tag <- R6::R6Class( TagObject[["name"]] <- self$`name` } - TagObject + return(TagObject) }, #' @description @@ -74,29 +89,19 @@ Tag <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index a5070554b03b..7e7a1d316462 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -35,20 +35,35 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return UpdatePetRequest in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return UpdatePetRequest as a base R list. + #' @examples + #' # convert array of UpdatePetRequest (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { UpdatePetRequestObject <- list() if (!is.null(self$`jsonData`)) { UpdatePetRequestObject[["jsonData"]] <- - self$`jsonData`$toJSON() + self$`jsonData`$toList() } if (!is.null(self$`binaryDataN2Information`)) { UpdatePetRequestObject[["binaryDataN2Information"]] <- self$`binaryDataN2Information` } - UpdatePetRequestObject + return(UpdatePetRequestObject) }, #' @description @@ -71,29 +86,19 @@ UpdatePetRequest <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return UpdatePetRequest in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`jsonData`)) { - sprintf( - '"jsonData": - %s - ', - jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`binaryDataN2Information`)) { - sprintf( - '"binaryDataN2Information": - "%s" - ', - self$`binaryDataN2Information` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index e7b911abc312..9d67f4b53a8c 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -94,10 +94,25 @@ User <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return User in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return User as a base R list. + #' @examples + #' # convert array of User (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { UserObject <- list() if (!is.null(self$`id`)) { UserObject[["id"]] <- @@ -131,7 +146,7 @@ User <- R6::R6Class( UserObject[["userStatus"]] <- self$`userStatus` } - UserObject + return(UserObject) }, #' @description @@ -170,77 +185,19 @@ User <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return User in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`username`)) { - sprintf( - '"username": - "%s" - ', - self$`username` - ) - }, - if (!is.null(self$`firstName`)) { - sprintf( - '"firstName": - "%s" - ', - self$`firstName` - ) - }, - if (!is.null(self$`lastName`)) { - sprintf( - '"lastName": - "%s" - ', - self$`lastName` - ) - }, - if (!is.null(self$`email`)) { - sprintf( - '"email": - "%s" - ', - self$`email` - ) - }, - if (!is.null(self$`password`)) { - sprintf( - '"password": - "%s" - ', - self$`password` - ) - }, - if (!is.null(self$`phone`)) { - sprintf( - '"phone": - "%s" - ', - self$`phone` - ) - }, - if (!is.null(self$`userStatus`)) { - sprintf( - '"userStatus": - %d - ', - self$`userStatus` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/whale.R b/samples/client/petstore/R-httr2/R/whale.R index 4656c11680d5..1dcb6f024119 100644 --- a/samples/client/petstore/R-httr2/R/whale.R +++ b/samples/client/petstore/R-httr2/R/whale.R @@ -49,10 +49,25 @@ Whale <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Whale in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Whale as a base R list. + #' @examples + #' # convert array of Whale (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { WhaleObject <- list() if (!is.null(self$`hasBaleen`)) { WhaleObject[["hasBaleen"]] <- @@ -66,7 +81,7 @@ Whale <- R6::R6Class( WhaleObject[["className"]] <- self$`className` } - WhaleObject + return(WhaleObject) }, #' @description @@ -90,37 +105,19 @@ Whale <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Whale in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`hasBaleen`)) { - sprintf( - '"hasBaleen": - %s - ', - tolower(self$`hasBaleen`) - ) - }, - if (!is.null(self$`hasTeeth`)) { - sprintf( - '"hasTeeth": - %s - ', - tolower(self$`hasTeeth`) - ) - }, - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/zebra.R b/samples/client/petstore/R-httr2/R/zebra.R index 95f216c3ce52..b461a9763cf7 100644 --- a/samples/client/petstore/R-httr2/R/zebra.R +++ b/samples/client/petstore/R-httr2/R/zebra.R @@ -43,10 +43,25 @@ Zebra <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Zebra in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Zebra as a base R list. + #' @examples + #' # convert array of Zebra (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { ZebraObject <- list() if (!is.null(self$`type`)) { ZebraObject[["type"]] <- @@ -56,7 +71,7 @@ Zebra <- R6::R6Class( ZebraObject[["className"]] <- self$`className` } - ZebraObject + return(ZebraObject) }, #' @description @@ -80,29 +95,19 @@ Zebra <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Zebra in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index 454e378a5c16..c4559b3e5145 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -77,10 +77,25 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return AllofTagApiResponse in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return AllofTagApiResponse as a base R list. + #' @examples + #' # convert array of AllofTagApiResponse (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { AllofTagApiResponseObject <- list() if (!is.null(self$`id`)) { AllofTagApiResponseObject[["id"]] <- @@ -106,7 +121,7 @@ AllofTagApiResponse <- R6::R6Class( AllofTagApiResponseObject[[key]] <- self$additional_properties[[key]] } - AllofTagApiResponseObject + return(AllofTagApiResponseObject) }, #' @description @@ -143,58 +158,22 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return AllofTagApiResponse in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`code`)) { - sprintf( - '"code": - %d - ', - self$`code` - ) - }, - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`message`)) { - sprintf( - '"message": - "%s" - ', - self$`message` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index 471a01afef3b..03da218e9927 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -52,10 +52,25 @@ Animal <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Animal in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Animal as a base R list. + #' @examples + #' # convert array of Animal (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { AnimalObject <- list() if (!is.null(self$`className`)) { AnimalObject[["className"]] <- @@ -69,7 +84,7 @@ Animal <- R6::R6Class( AnimalObject[[key]] <- self$additional_properties[[key]] } - AnimalObject + return(AnimalObject) }, #' @description @@ -97,34 +112,22 @@ Animal <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Animal in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index cce82cd7d932..5af7c69e8359 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -50,10 +50,25 @@ BasquePig <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return BasquePig in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return BasquePig as a base R list. + #' @examples + #' # convert array of BasquePig (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { BasquePigObject <- list() if (!is.null(self$`className`)) { BasquePigObject[["className"]] <- @@ -67,7 +82,7 @@ BasquePig <- R6::R6Class( BasquePigObject[[key]] <- self$additional_properties[[key]] } - BasquePigObject + return(BasquePigObject) }, #' @description @@ -95,34 +110,22 @@ BasquePig <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return BasquePig in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index b4014681ba49..072decc18b9c 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -60,10 +60,25 @@ Cat <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Cat in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Cat as a base R list. + #' @examples + #' # convert array of Cat (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CatObject <- list() if (!is.null(self$`className`)) { CatObject[["className"]] <- @@ -81,7 +96,7 @@ Cat <- R6::R6Class( CatObject[[key]] <- self$additional_properties[[key]] } - CatObject + return(CatObject) }, #' @description @@ -112,42 +127,22 @@ Cat <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Cat in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`declawed`)) { - sprintf( - '"declawed": - %s - ', - tolower(self$`declawed`) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 31106a3bc9e2..5793f3264f1a 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -50,10 +50,25 @@ Category <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Category in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Category as a base R list. + #' @examples + #' # convert array of Category (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -67,7 +82,7 @@ Category <- R6::R6Class( CategoryObject[[key]] <- self$additional_properties[[key]] } - CategoryObject + return(CategoryObject) }, #' @description @@ -95,34 +110,22 @@ Category <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index 08ca2b9e3eea..4f78411ab788 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -50,10 +50,25 @@ DanishPig <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DanishPig in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DanishPig as a base R list. + #' @examples + #' # convert array of DanishPig (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DanishPigObject <- list() if (!is.null(self$`className`)) { DanishPigObject[["className"]] <- @@ -67,7 +82,7 @@ DanishPig <- R6::R6Class( DanishPigObject[[key]] <- self$additional_properties[[key]] } - DanishPigObject + return(DanishPigObject) }, #' @description @@ -95,34 +110,22 @@ DanishPig <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DanishPig in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`size`)) { - sprintf( - '"size": - %d - ', - self$`size` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/date.R b/samples/client/petstore/R/R/date.R index d9b6ec0beb1b..e2f3816c2269 100644 --- a/samples/client/petstore/R/R/date.R +++ b/samples/client/petstore/R/R/date.R @@ -63,10 +63,25 @@ Date <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Date in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Date as a base R list. + #' @examples + #' # convert array of Date (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DateObject <- list() if (!is.null(self$`className`)) { DateObject[["className"]] <- @@ -84,7 +99,7 @@ Date <- R6::R6Class( DateObject[[key]] <- self$additional_properties[[key]] } - DateObject + return(DateObject) }, #' @description @@ -119,42 +134,22 @@ Date <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Date in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`percent_description`)) { - sprintf( - '"percent_description": - "%s" - ', - self$`percent_description` - ) - }, - if (!is.null(self$`url_property`)) { - sprintf( - '"url_property": - "%s" - ', - self$`url_property` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index 34ae29121163..4aa6742dcc78 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -60,10 +60,25 @@ Dog <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Dog in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Dog as a base R list. + #' @examples + #' # convert array of Dog (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DogObject <- list() if (!is.null(self$`className`)) { DogObject[["className"]] <- @@ -81,7 +96,7 @@ Dog <- R6::R6Class( DogObject[[key]] <- self$additional_properties[[key]] } - DogObject + return(DogObject) }, #' @description @@ -112,42 +127,22 @@ Dog <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Dog in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - }, - if (!is.null(self$`color`)) { - sprintf( - '"color": - "%s" - ', - self$`color` - ) - }, - if (!is.null(self$`breed`)) { - sprintf( - '"breed": - "%s" - ', - self$`breed` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/dummy_model.R b/samples/client/petstore/R/R/dummy_model.R index 12d3ab52a155..ec28d376d53f 100644 --- a/samples/client/petstore/R/R/dummy_model.R +++ b/samples/client/petstore/R/R/dummy_model.R @@ -41,10 +41,25 @@ DummyModel <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return DummyModel in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return DummyModel as a base R list. + #' @examples + #' # convert array of DummyModel (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { DummyModelObject <- list() if (!is.null(self$`property`)) { DummyModelObject[["property"]] <- @@ -54,7 +69,7 @@ DummyModel <- R6::R6Class( DummyModelObject[[key]] <- self$additional_properties[[key]] } - DummyModelObject + return(DummyModelObject) }, #' @description @@ -79,26 +94,22 @@ DummyModel <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DummyModel in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`property`)) { - sprintf( - '"property": - "%s" - ', - self$`property` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/format_test.R b/samples/client/petstore/R/R/format_test.R index f93bf1435c9a..f445caea8224 100644 --- a/samples/client/petstore/R/R/format_test.R +++ b/samples/client/petstore/R/R/format_test.R @@ -158,10 +158,25 @@ FormatTest <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return FormatTest in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return FormatTest as a base R list. + #' @examples + #' # convert array of FormatTest (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { FormatTestObject <- list() if (!is.null(self$`integer`)) { FormatTestObject[["integer"]] <- @@ -227,7 +242,7 @@ FormatTest <- R6::R6Class( FormatTestObject[[key]] <- self$additional_properties[[key]] } - FormatTestObject + return(FormatTestObject) }, #' @description @@ -294,138 +309,22 @@ FormatTest <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return FormatTest in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`integer`)) { - sprintf( - '"integer": - %d - ', - self$`integer` - ) - }, - if (!is.null(self$`int32`)) { - sprintf( - '"int32": - %d - ', - self$`int32` - ) - }, - if (!is.null(self$`int64`)) { - sprintf( - '"int64": - %d - ', - self$`int64` - ) - }, - if (!is.null(self$`number`)) { - sprintf( - '"number": - %d - ', - self$`number` - ) - }, - if (!is.null(self$`float`)) { - sprintf( - '"float": - %d - ', - self$`float` - ) - }, - if (!is.null(self$`double`)) { - sprintf( - '"double": - %d - ', - self$`double` - ) - }, - if (!is.null(self$`string`)) { - sprintf( - '"string": - "%s" - ', - self$`string` - ) - }, - if (!is.null(self$`byte`)) { - sprintf( - '"byte": - "%s" - ', - self$`byte` - ) - }, - if (!is.null(self$`binary`)) { - sprintf( - '"binary": - "%s" - ', - self$`binary` - ) - }, - if (!is.null(self$`date`)) { - sprintf( - '"date": - "%s" - ', - self$`date` - ) - }, - if (!is.null(self$`dateTime`)) { - sprintf( - '"dateTime": - "%s" - ', - self$`dateTime` - ) - }, - if (!is.null(self$`uuid`)) { - sprintf( - '"uuid": - "%s" - ', - self$`uuid` - ) - }, - if (!is.null(self$`password`)) { - sprintf( - '"password": - "%s" - ', - self$`password` - ) - }, - if (!is.null(self$`pattern_with_digits`)) { - sprintf( - '"pattern_with_digits": - "%s" - ', - self$`pattern_with_digits` - ) - }, - if (!is.null(self$`pattern_with_digits_and_delimiter`)) { - sprintf( - '"pattern_with_digits_and_delimiter": - "%s" - ', - self$`pattern_with_digits_and_delimiter` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index 9116e438fedc..3634304e857c 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -59,10 +59,25 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return ModelApiResponse in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return ModelApiResponse as a base R list. + #' @examples + #' # convert array of ModelApiResponse (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { ModelApiResponseObject <- list() if (!is.null(self$`code`)) { ModelApiResponseObject[["code"]] <- @@ -80,7 +95,7 @@ ModelApiResponse <- R6::R6Class( ModelApiResponseObject[[key]] <- self$additional_properties[[key]] } - ModelApiResponseObject + return(ModelApiResponseObject) }, #' @description @@ -111,42 +126,22 @@ ModelApiResponse <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return ModelApiResponse in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`code`)) { - sprintf( - '"code": - %d - ', - self$`code` - ) - }, - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`message`)) { - sprintf( - '"message": - "%s" - ', - self$`message` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index e04a31a69acd..b69969f79f68 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -48,10 +48,25 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return NestedOneOf in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return NestedOneOf as a base R list. + #' @examples + #' # convert array of NestedOneOf (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { NestedOneOfObject <- list() if (!is.null(self$`size`)) { NestedOneOfObject[["size"]] <- @@ -59,13 +74,13 @@ NestedOneOf <- R6::R6Class( } if (!is.null(self$`nested_pig`)) { NestedOneOfObject[["nested_pig"]] <- - self$`nested_pig`$toJSON() + self$`nested_pig`$toList() } for (key in names(self$additional_properties)) { NestedOneOfObject[[key]] <- self$additional_properties[[key]] } - NestedOneOfObject + return(NestedOneOfObject) }, #' @description @@ -95,34 +110,22 @@ NestedOneOf <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`size`)) { - sprintf( - '"size": - %d - ', - self$`size` - ) - }, - if (!is.null(self$`nested_pig`)) { - sprintf( - '"nested_pig": - %s - ', - jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index cd84eed74eef..57e8afb93f6d 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -89,10 +89,25 @@ Order <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Order in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Order as a base R list. + #' @examples + #' # convert array of Order (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { OrderObject <- list() if (!is.null(self$`id`)) { OrderObject[["id"]] <- @@ -122,7 +137,7 @@ Order <- R6::R6Class( OrderObject[[key]] <- self$additional_properties[[key]] } - OrderObject + return(OrderObject) }, #' @description @@ -165,66 +180,22 @@ Order <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Order in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`petId`)) { - sprintf( - '"petId": - %d - ', - self$`petId` - ) - }, - if (!is.null(self$`quantity`)) { - sprintf( - '"quantity": - %d - ', - self$`quantity` - ) - }, - if (!is.null(self$`shipDate`)) { - sprintf( - '"shipDate": - "%s" - ', - self$`shipDate` - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - }, - if (!is.null(self$`complete`)) { - sprintf( - '"complete": - %s - ', - tolower(self$`complete`) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 28e1693c419f..cc0083ccb2f5 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -85,10 +85,25 @@ Pet <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Pet in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Pet as a base R list. + #' @examples + #' # convert array of Pet (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -96,7 +111,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toJSON() + self$`category`$toList() } if (!is.null(self$`name`)) { PetObject[["name"]] <- @@ -108,7 +123,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toJSON()) + lapply(self$`tags`, function(x) x$toList()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- @@ -118,7 +133,7 @@ Pet <- R6::R6Class( PetObject[[key]] <- self$additional_properties[[key]] } - PetObject + return(PetObject) }, #' @description @@ -163,66 +178,22 @@ Pet <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`category`)) { - sprintf( - '"category": - %s - ', - jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - }, - if (!is.null(self$`photoUrls`)) { - sprintf( - '"photoUrls": - [%s] - ', - paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`tags`)) { - sprintf( - '"tags": - [%s] -', - paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") - ) - }, - if (!is.null(self$`status`)) { - sprintf( - '"status": - "%s" - ', - self$`status` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/pet_map.R b/samples/client/petstore/R/R/pet_map.R index 1fc910ac1da2..9d00d4d7cf5d 100644 --- a/samples/client/petstore/R/R/pet_map.R +++ b/samples/client/petstore/R/R/pet_map.R @@ -40,10 +40,25 @@ PetMap <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return PetMap in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return PetMap as a base R list. + #' @examples + #' # convert array of PetMap (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { PetMapObject <- list() if (!is.null(self$`pet`)) { PetMapObject[["pet"]] <- @@ -53,7 +68,7 @@ PetMap <- R6::R6Class( PetMapObject[[key]] <- self$additional_properties[[key]] } - PetMapObject + return(PetMapObject) }, #' @description @@ -78,26 +93,22 @@ PetMap <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return PetMap in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`pet`)) { - sprintf( - '"pet": - %s - ', - jsonlite::toJSON(lapply(self$`pet`, function(x){ x }), auto_unbox = TRUE, digits = NA) - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index 5841fc79dd39..fd8aa79b26ba 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -97,10 +97,25 @@ Special <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Special in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Special as a base R list. + #' @examples + #' # convert array of Special (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { SpecialObject <- list() if (!is.null(self$`set_test`)) { SpecialObject[["set_test"]] <- @@ -134,7 +149,7 @@ Special <- R6::R6Class( SpecialObject[[key]] <- self$additional_properties[[key]] } - SpecialObject + return(SpecialObject) }, #' @description @@ -180,74 +195,22 @@ Special <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Special in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`set_test`)) { - sprintf( - '"set_test": - [%s] - ', - paste(unlist(lapply(self$`set_test`, function(x) paste0('"', x, '"'))), collapse = ",") - ) - }, - if (!is.null(self$`item_self`)) { - sprintf( - '"self": - %d - ', - self$`item_self` - ) - }, - if (!is.null(self$`item_private`)) { - sprintf( - '"private": - "%s" - ', - self$`item_private` - ) - }, - if (!is.null(self$`item_super`)) { - sprintf( - '"super": - "%s" - ', - self$`item_super` - ) - }, - if (!is.null(self$`123_number`)) { - sprintf( - '"123_number": - "%s" - ', - self$`123_number` - ) - }, - if (!is.null(self$`array[test]`)) { - sprintf( - '"array[test]": - "%s" - ', - self$`array[test]` - ) - }, - if (!is.null(self$`empty_string`)) { - sprintf( - '"empty_string": - "%s" - ', - self$`empty_string` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index c9ec58ae6b82..ce13bc25c170 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -50,10 +50,25 @@ Tag <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Tag in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Tag as a base R list. + #' @examples + #' # convert array of Tag (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -67,7 +82,7 @@ Tag <- R6::R6Class( TagObject[[key]] <- self$additional_properties[[key]] } - TagObject + return(TagObject) }, #' @description @@ -95,34 +110,22 @@ Tag <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`name`)) { - sprintf( - '"name": - "%s" - ', - self$`name` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index 47369030cfac..c8e6bf91cb1a 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -45,14 +45,29 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return UpdatePetRequest in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return UpdatePetRequest as a base R list. + #' @examples + #' # convert array of UpdatePetRequest (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { UpdatePetRequestObject <- list() if (!is.null(self$`jsonData`)) { UpdatePetRequestObject[["jsonData"]] <- - self$`jsonData`$toJSON() + self$`jsonData`$toList() } if (!is.null(self$`binaryDataN2Information`)) { UpdatePetRequestObject[["binaryDataN2Information"]] <- @@ -62,7 +77,7 @@ UpdatePetRequest <- R6::R6Class( UpdatePetRequestObject[[key]] <- self$additional_properties[[key]] } - UpdatePetRequestObject + return(UpdatePetRequestObject) }, #' @description @@ -92,34 +107,22 @@ UpdatePetRequest <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return UpdatePetRequest in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`jsonData`)) { - sprintf( - '"jsonData": - %s - ', - jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox = TRUE, digits = NA) - ) - }, - if (!is.null(self$`binaryDataN2Information`)) { - sprintf( - '"binaryDataN2Information": - "%s" - ', - self$`binaryDataN2Information` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index df4396abb2ca..76a78edad38a 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -104,10 +104,25 @@ User <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return User in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return User as a base R list. + #' @examples + #' # convert array of User (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { UserObject <- list() if (!is.null(self$`id`)) { UserObject[["id"]] <- @@ -145,7 +160,7 @@ User <- R6::R6Class( UserObject[[key]] <- self$additional_properties[[key]] } - UserObject + return(UserObject) }, #' @description @@ -191,82 +206,22 @@ User <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return User in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`id`)) { - sprintf( - '"id": - %d - ', - self$`id` - ) - }, - if (!is.null(self$`username`)) { - sprintf( - '"username": - "%s" - ', - self$`username` - ) - }, - if (!is.null(self$`firstName`)) { - sprintf( - '"firstName": - "%s" - ', - self$`firstName` - ) - }, - if (!is.null(self$`lastName`)) { - sprintf( - '"lastName": - "%s" - ', - self$`lastName` - ) - }, - if (!is.null(self$`email`)) { - sprintf( - '"email": - "%s" - ', - self$`email` - ) - }, - if (!is.null(self$`password`)) { - sprintf( - '"password": - "%s" - ', - self$`password` - ) - }, - if (!is.null(self$`phone`)) { - sprintf( - '"phone": - "%s" - ', - self$`phone` - ) - }, - if (!is.null(self$`userStatus`)) { - sprintf( - '"userStatus": - %d - ', - self$`userStatus` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/whale.R b/samples/client/petstore/R/R/whale.R index e39211045a76..ceb056aab2dd 100644 --- a/samples/client/petstore/R/R/whale.R +++ b/samples/client/petstore/R/R/whale.R @@ -59,10 +59,25 @@ Whale <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Whale in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Whale as a base R list. + #' @examples + #' # convert array of Whale (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { WhaleObject <- list() if (!is.null(self$`hasBaleen`)) { WhaleObject[["hasBaleen"]] <- @@ -80,7 +95,7 @@ Whale <- R6::R6Class( WhaleObject[[key]] <- self$additional_properties[[key]] } - WhaleObject + return(WhaleObject) }, #' @description @@ -111,42 +126,22 @@ Whale <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Whale in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`hasBaleen`)) { - sprintf( - '"hasBaleen": - %s - ', - tolower(self$`hasBaleen`) - ) - }, - if (!is.null(self$`hasTeeth`)) { - sprintf( - '"hasTeeth": - %s - ', - tolower(self$`hasTeeth`) - ) - }, - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description diff --git a/samples/client/petstore/R/R/zebra.R b/samples/client/petstore/R/R/zebra.R index fb6d90d4d983..bbc678e1c5f3 100644 --- a/samples/client/petstore/R/R/zebra.R +++ b/samples/client/petstore/R/R/zebra.R @@ -53,10 +53,25 @@ Zebra <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return Zebra in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. toJSON = function() { + .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") + return(self$toList()) + }, + + #' @description + #' Convert to a List + #' + #' Convert the R6 object to a list to work more easily with other tooling. + #' + #' @return Zebra as a base R list. + #' @examples + #' # convert array of Zebra (x) to a data frame + #' \dontrun{ + #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' df + #' } + toList = function() { ZebraObject <- list() if (!is.null(self$`type`)) { ZebraObject[["type"]] <- @@ -70,7 +85,7 @@ Zebra <- R6::R6Class( ZebraObject[[key]] <- self$additional_properties[[key]] } - ZebraObject + return(ZebraObject) }, #' @description @@ -101,34 +116,22 @@ Zebra <- R6::R6Class( #' @description #' To JSON String - #' + #' + #' @param minify Logical. If `TRUE` remove all indentation and white space + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Zebra in JSON format - toJSONString = function() { - jsoncontent <- c( - if (!is.null(self$`type`)) { - sprintf( - '"type": - "%s" - ', - self$`type` - ) - }, - if (!is.null(self$`className`)) { - sprintf( - '"className": - "%s" - ', - self$`className` - ) - } - ) - jsoncontent <- paste(jsoncontent, collapse = ",") - json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) - json_obj <- jsonlite::fromJSON(json_string) + toJSONString = function(minify = TRUE, ...) { + json_obj <- self$toList() + for (key in names(self$additional_properties)) { json_obj[[key]] <- self$additional_properties[[key]] } - json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA))) + + json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) + if (minify) { + return(jsonlite::minify(json_string)) + } + return(json_string) }, #' @description From 637e8e9f060844cd6f00ba1cb36146387d994693 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Wed, 20 Nov 2024 13:22:06 -0500 Subject: [PATCH 2/7] fix type of json string --- .../src/main/resources/r/api.mustache | 2 +- .../src/main/resources/r/modelGeneric.mustache | 4 ++-- samples/client/echo_api/r/R/bird.R | 4 ++-- samples/client/echo_api/r/R/body_api.R | 14 +++++++------- samples/client/echo_api/r/R/category.R | 4 ++-- samples/client/echo_api/r/R/data_query.R | 4 ++-- samples/client/echo_api/r/R/default_value.R | 4 ++-- .../client/echo_api/r/R/number_properties_only.R | 4 ++-- samples/client/echo_api/r/R/pet.R | 4 ++-- samples/client/echo_api/r/R/query.R | 4 ++-- samples/client/echo_api/r/R/tag.R | 4 ++-- .../R/test_form_object_multipart_request_marker.R | 4 ++-- ...ode_true_object_all_of_query_object_parameter.R | 4 ++-- ...lode_true_array_string_query_object_parameter.R | 4 ++-- .../R-httr2-wrapper/R/allof_tag_api_response.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/animal.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/basque_pig.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/cat.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/category.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/danish_pig.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/date.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/dog.R | 4 ++-- .../petstore/R-httr2-wrapper/R/dummy_model.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/fake_api.R | 2 +- .../petstore/R-httr2-wrapper/R/format_test.R | 4 ++-- .../R-httr2-wrapper/R/model_api_response.R | 4 ++-- .../petstore/R-httr2-wrapper/R/nested_one_of.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/order.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/pet.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/pet_api.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/pet_map.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/special.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/store_api.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/tag.R | 4 ++-- .../R-httr2-wrapper/R/update_pet_request.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/user.R | 4 ++-- .../client/petstore/R-httr2-wrapper/R/user_api.R | 8 ++++---- samples/client/petstore/R-httr2-wrapper/R/whale.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/zebra.R | 4 ++-- .../petstore/R-httr2/R/allof_tag_api_response.R | 4 ++-- samples/client/petstore/R-httr2/R/animal.R | 4 ++-- samples/client/petstore/R-httr2/R/basque_pig.R | 4 ++-- samples/client/petstore/R-httr2/R/cat.R | 4 ++-- samples/client/petstore/R-httr2/R/category.R | 4 ++-- samples/client/petstore/R-httr2/R/danish_pig.R | 4 ++-- samples/client/petstore/R-httr2/R/date.R | 4 ++-- samples/client/petstore/R-httr2/R/dog.R | 4 ++-- samples/client/petstore/R-httr2/R/fake_api.R | 2 +- samples/client/petstore/R-httr2/R/format_test.R | 4 ++-- samples/client/petstore/R-httr2/R/just_model.R | 4 ++-- .../client/petstore/R-httr2/R/model_api_response.R | 4 ++-- samples/client/petstore/R-httr2/R/nested_one_of.R | 4 ++-- samples/client/petstore/R-httr2/R/order.R | 4 ++-- samples/client/petstore/R-httr2/R/pet.R | 4 ++-- samples/client/petstore/R-httr2/R/pet_api.R | 4 ++-- samples/client/petstore/R-httr2/R/pet_map.R | 4 ++-- samples/client/petstore/R-httr2/R/special.R | 4 ++-- samples/client/petstore/R-httr2/R/store_api.R | 2 +- samples/client/petstore/R-httr2/R/tag.R | 4 ++-- .../client/petstore/R-httr2/R/update_pet_request.R | 4 ++-- samples/client/petstore/R-httr2/R/user.R | 4 ++-- samples/client/petstore/R-httr2/R/user_api.R | 8 ++++---- samples/client/petstore/R-httr2/R/whale.R | 4 ++-- samples/client/petstore/R-httr2/R/zebra.R | 4 ++-- .../client/petstore/R/R/allof_tag_api_response.R | 4 ++-- samples/client/petstore/R/R/animal.R | 4 ++-- samples/client/petstore/R/R/basque_pig.R | 4 ++-- samples/client/petstore/R/R/cat.R | 4 ++-- samples/client/petstore/R/R/category.R | 4 ++-- samples/client/petstore/R/R/danish_pig.R | 4 ++-- samples/client/petstore/R/R/date.R | 4 ++-- samples/client/petstore/R/R/dog.R | 4 ++-- samples/client/petstore/R/R/dummy_model.R | 4 ++-- samples/client/petstore/R/R/fake_api.R | 2 +- samples/client/petstore/R/R/format_test.R | 4 ++-- samples/client/petstore/R/R/model_api_response.R | 4 ++-- samples/client/petstore/R/R/nested_one_of.R | 4 ++-- samples/client/petstore/R/R/order.R | 4 ++-- samples/client/petstore/R/R/pet.R | 4 ++-- samples/client/petstore/R/R/pet_api.R | 4 ++-- samples/client/petstore/R/R/pet_map.R | 4 ++-- samples/client/petstore/R/R/special.R | 4 ++-- samples/client/petstore/R/R/store_api.R | 2 +- samples/client/petstore/R/R/tag.R | 4 ++-- samples/client/petstore/R/R/update_pet_request.R | 4 ++-- samples/client/petstore/R/R/user.R | 4 ++-- samples/client/petstore/R/R/user_api.R | 8 ++++---- samples/client/petstore/R/R/whale.R | 4 ++-- samples/client/petstore/R/R/zebra.R | 4 ++-- 89 files changed, 182 insertions(+), 182 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 2895328c09c9..4f18c214f11a 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -456,7 +456,7 @@ local_var_body <- `{{paramName}}`$toJSONString() {{/isArray}} } else { - body <- NULL + local_var_body <- NULL } {{/bodyParams}} diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index 5fbb9d17ca2f..53834be7fb31 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -334,9 +334,9 @@ json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R index 4c04d98b8a0e..f3f85310b648 100644 --- a/samples/client/echo_api/r/R/bird.R +++ b/samples/client/echo_api/r/R/bird.R @@ -99,9 +99,9 @@ Bird <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/body_api.R b/samples/client/echo_api/r/R/body_api.R index 1be1cafba8b4..9f16d197edc0 100644 --- a/samples/client/echo_api/r/R/body_api.R +++ b/samples/client/echo_api/r/R/body_api.R @@ -304,7 +304,7 @@ BodyApi <- R6::R6Class( if (!is.null(`body`)) { local_var_body <- `body`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/body/application/octetstream/binary" @@ -586,7 +586,7 @@ BodyApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/echo/body/allOf/Pet" @@ -682,7 +682,7 @@ BodyApi <- R6::R6Class( if (!is.null(`body`)) { local_var_body <- `body`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/echo/body/FreeFormObject/response_string" @@ -778,7 +778,7 @@ BodyApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/echo/body/Pet" @@ -874,7 +874,7 @@ BodyApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/echo/body/Pet/response_string" @@ -970,7 +970,7 @@ BodyApi <- R6::R6Class( if (!is.null(`body`)) { local_var_body <- `body`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/echo/body/string_enum" @@ -1066,7 +1066,7 @@ BodyApi <- R6::R6Class( if (!is.null(`tag`)) { local_var_body <- `tag`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/echo/body/Tag/response_string" diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R index 6db564b8db4f..7b010e3535bc 100644 --- a/samples/client/echo_api/r/R/category.R +++ b/samples/client/echo_api/r/R/category.R @@ -99,9 +99,9 @@ Category <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R index 5c5d95694966..8289e40f5b1a 100644 --- a/samples/client/echo_api/r/R/data_query.R +++ b/samples/client/echo_api/r/R/data_query.R @@ -147,9 +147,9 @@ DataQuery <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R index 57f73b924d21..06ce83975d2b 100644 --- a/samples/client/echo_api/r/R/default_value.R +++ b/samples/client/echo_api/r/R/default_value.R @@ -188,9 +188,9 @@ DefaultValue <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R index d2f1a9a28462..dca68d84d3ce 100644 --- a/samples/client/echo_api/r/R/number_properties_only.R +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -112,9 +112,9 @@ NumberPropertiesOnly <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R index 6e25bc66043e..57bc5e894814 100644 --- a/samples/client/echo_api/r/R/pet.R +++ b/samples/client/echo_api/r/R/pet.R @@ -167,9 +167,9 @@ Pet <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R index 2d13cbf4fba3..31a0b45fee1a 100644 --- a/samples/client/echo_api/r/R/query.R +++ b/samples/client/echo_api/r/R/query.R @@ -98,9 +98,9 @@ Query <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R index cc1050408a15..70c5be0042d5 100644 --- a/samples/client/echo_api/r/R/tag.R +++ b/samples/client/echo_api/r/R/tag.R @@ -99,9 +99,9 @@ Tag <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R index 39946e0e5a40..28499ce0f5c3 100644 --- a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -83,9 +83,9 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R index 3d740ae75253..963ed80aad94 100644 --- a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -131,9 +131,9 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R index f92f2733a638..0200084c06a2 100644 --- a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -82,9 +82,9 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R index c4559b3e5145..3786a1054cf1 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R @@ -171,9 +171,9 @@ AllofTagApiResponse <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/animal.R b/samples/client/petstore/R-httr2-wrapper/R/animal.R index 03da218e9927..c8c823c30e62 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/animal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/animal.R @@ -125,9 +125,9 @@ Animal <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R index 5af7c69e8359..71e6f416962a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R @@ -123,9 +123,9 @@ BasquePig <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/cat.R b/samples/client/petstore/R-httr2-wrapper/R/cat.R index 072decc18b9c..2241b185eb79 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/cat.R +++ b/samples/client/petstore/R-httr2-wrapper/R/cat.R @@ -140,9 +140,9 @@ Cat <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/category.R b/samples/client/petstore/R-httr2-wrapper/R/category.R index 5793f3264f1a..d4163ceb79f1 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/category.R +++ b/samples/client/petstore/R-httr2-wrapper/R/category.R @@ -123,9 +123,9 @@ Category <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R index 4f78411ab788..e2648f71773b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R @@ -123,9 +123,9 @@ DanishPig <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/date.R b/samples/client/petstore/R-httr2-wrapper/R/date.R index e2f3816c2269..7b2a515b4a41 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/date.R +++ b/samples/client/petstore/R-httr2-wrapper/R/date.R @@ -147,9 +147,9 @@ Date <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/dog.R b/samples/client/petstore/R-httr2-wrapper/R/dog.R index 4aa6742dcc78..84f2f95d10ba 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dog.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dog.R @@ -140,9 +140,9 @@ Dog <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R index ec28d376d53f..f02b49b1689e 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R @@ -107,9 +107,9 @@ DummyModel <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R index 5dae105c228b..b314363f4b68 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R @@ -225,7 +225,7 @@ FakeApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/fake/test_optional_body_parameter" diff --git a/samples/client/petstore/R-httr2-wrapper/R/format_test.R b/samples/client/petstore/R-httr2-wrapper/R/format_test.R index f445caea8224..d0b00692018c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/format_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/format_test.R @@ -322,9 +322,9 @@ FormatTest <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R index 3634304e857c..84509e9ccc41 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R @@ -139,9 +139,9 @@ ModelApiResponse <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index b69969f79f68..ca50bdda493f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -123,9 +123,9 @@ NestedOneOf <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/order.R b/samples/client/petstore/R-httr2-wrapper/R/order.R index 57e8afb93f6d..d8a82a3de40d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/order.R +++ b/samples/client/petstore/R-httr2-wrapper/R/order.R @@ -193,9 +193,9 @@ Order <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet.R b/samples/client/petstore/R-httr2-wrapper/R/pet.R index cc0083ccb2f5..991beb2cee9e 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet.R @@ -191,9 +191,9 @@ Pet <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_api.R b/samples/client/petstore/R-httr2-wrapper/R/pet_api.R index b19e01d9d8ab..e32bd6cea711 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_api.R @@ -435,7 +435,7 @@ PetApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/pet" @@ -1288,7 +1288,7 @@ PetApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/pet" diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R index 9d00d4d7cf5d..7e10a74a873b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R @@ -106,9 +106,9 @@ PetMap <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/special.R b/samples/client/petstore/R-httr2-wrapper/R/special.R index fd8aa79b26ba..4257a85da203 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/special.R +++ b/samples/client/petstore/R-httr2-wrapper/R/special.R @@ -208,9 +208,9 @@ Special <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/store_api.R b/samples/client/petstore/R-httr2-wrapper/R/store_api.R index e49457700c0b..bbf86c4f21c0 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/store_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/store_api.R @@ -546,7 +546,7 @@ StoreApi <- R6::R6Class( if (!is.null(`order`)) { local_var_body <- `order`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/store/order" diff --git a/samples/client/petstore/R-httr2-wrapper/R/tag.R b/samples/client/petstore/R-httr2-wrapper/R/tag.R index ce13bc25c170..95f6072f617f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/tag.R +++ b/samples/client/petstore/R-httr2-wrapper/R/tag.R @@ -123,9 +123,9 @@ Tag <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R index c8e6bf91cb1a..357845b71f6f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R @@ -120,9 +120,9 @@ UpdatePetRequest <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/user.R b/samples/client/petstore/R-httr2-wrapper/R/user.R index 76a78edad38a..b99d4a9a0250 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user.R @@ -219,9 +219,9 @@ User <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/user_api.R b/samples/client/petstore/R-httr2-wrapper/R/user_api.R index 4c938c7ee3ad..a99c036736f8 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user_api.R @@ -318,7 +318,7 @@ UserApi <- R6::R6Class( if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user" @@ -428,7 +428,7 @@ UserApi <- R6::R6Class( })), collapse = ",") local_var_body <- paste0("[", body.items, "]") } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/createWithArray" @@ -538,7 +538,7 @@ UserApi <- R6::R6Class( })), collapse = ",") local_var_body <- paste0("[", body.items, "]") } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/createWithList" @@ -1099,7 +1099,7 @@ UserApi <- R6::R6Class( if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/{username}" diff --git a/samples/client/petstore/R-httr2-wrapper/R/whale.R b/samples/client/petstore/R-httr2-wrapper/R/whale.R index ceb056aab2dd..0e22bb97389f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/whale.R +++ b/samples/client/petstore/R-httr2-wrapper/R/whale.R @@ -139,9 +139,9 @@ Whale <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/zebra.R b/samples/client/petstore/R-httr2-wrapper/R/zebra.R index bbc678e1c5f3..7bfcddc488c3 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/zebra.R +++ b/samples/client/petstore/R-httr2-wrapper/R/zebra.R @@ -129,9 +129,9 @@ Zebra <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index 56ca03050bb8..a282309e2087 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -147,9 +147,9 @@ AllofTagApiResponse <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 1c16faf39fd5..5ae1cc1594e0 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -101,9 +101,9 @@ Animal <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 85986bfb649a..66d0e6c9b5b5 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -99,9 +99,9 @@ BasquePig <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index b40ea9c6d32a..10921e933ce3 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -116,9 +116,9 @@ Cat <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index f3d3fc922640..7783b3a84ef4 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -99,9 +99,9 @@ Category <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index e9af6dc909da..906552a38e9c 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -99,9 +99,9 @@ DanishPig <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/date.R b/samples/client/petstore/R-httr2/R/date.R index b3e02045052c..3ec04bc461e6 100644 --- a/samples/client/petstore/R-httr2/R/date.R +++ b/samples/client/petstore/R-httr2/R/date.R @@ -123,9 +123,9 @@ Date <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 485a34aefd7b..7f74def48a0f 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -116,9 +116,9 @@ Dog <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/fake_api.R b/samples/client/petstore/R-httr2/R/fake_api.R index 175540cf5ee6..2038aabaf7ee 100644 --- a/samples/client/petstore/R-httr2/R/fake_api.R +++ b/samples/client/petstore/R-httr2/R/fake_api.R @@ -225,7 +225,7 @@ FakeApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/fake/test_optional_body_parameter" diff --git a/samples/client/petstore/R-httr2/R/format_test.R b/samples/client/petstore/R-httr2/R/format_test.R index 7ac21e6cb00d..ffdf81deb5db 100644 --- a/samples/client/petstore/R-httr2/R/format_test.R +++ b/samples/client/petstore/R-httr2/R/format_test.R @@ -298,9 +298,9 @@ FormatTest <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/just_model.R b/samples/client/petstore/R-httr2/R/just_model.R index ddbf460f325e..ff0945474f3f 100644 --- a/samples/client/petstore/R-httr2/R/just_model.R +++ b/samples/client/petstore/R-httr2/R/just_model.R @@ -83,9 +83,9 @@ JustModel <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index 548f49c179d0..eb434390d981 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -115,9 +115,9 @@ ModelApiResponse <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index 6966fd7c5585..3a2f0ff9b948 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -99,9 +99,9 @@ NestedOneOf <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index ae6e7e6df372..96dc99b48d50 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -169,9 +169,9 @@ Order <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index 3f58a6f11708..8318b1471759 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -167,9 +167,9 @@ Pet <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pet_api.R b/samples/client/petstore/R-httr2/R/pet_api.R index f832c2ea5cbc..12e65404d914 100644 --- a/samples/client/petstore/R-httr2/R/pet_api.R +++ b/samples/client/petstore/R-httr2/R/pet_api.R @@ -435,7 +435,7 @@ PetApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/pet" @@ -1288,7 +1288,7 @@ PetApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/pet" diff --git a/samples/client/petstore/R-httr2/R/pet_map.R b/samples/client/petstore/R-httr2/R/pet_map.R index 61242dcad103..b0272cc819b8 100644 --- a/samples/client/petstore/R-httr2/R/pet_map.R +++ b/samples/client/petstore/R-httr2/R/pet_map.R @@ -82,9 +82,9 @@ PetMap <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index f82ee61b5e10..c018b13cead3 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -184,9 +184,9 @@ Special <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/store_api.R b/samples/client/petstore/R-httr2/R/store_api.R index f445fabf3c2b..fc4ff66dcab1 100644 --- a/samples/client/petstore/R-httr2/R/store_api.R +++ b/samples/client/petstore/R-httr2/R/store_api.R @@ -546,7 +546,7 @@ StoreApi <- R6::R6Class( if (!is.null(`order`)) { local_var_body <- `order`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/store/order" diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index f6d5e1232674..f7e1cda5bb38 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -99,9 +99,9 @@ Tag <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index 7e7a1d316462..1e4411deca96 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -96,9 +96,9 @@ UpdatePetRequest <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index 9d67f4b53a8c..f792027ca8e1 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -195,9 +195,9 @@ User <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/user_api.R b/samples/client/petstore/R-httr2/R/user_api.R index 9487ca7835b0..a1496d504727 100644 --- a/samples/client/petstore/R-httr2/R/user_api.R +++ b/samples/client/petstore/R-httr2/R/user_api.R @@ -318,7 +318,7 @@ UserApi <- R6::R6Class( if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user" @@ -428,7 +428,7 @@ UserApi <- R6::R6Class( })), collapse = ",") local_var_body <- paste0("[", body.items, "]") } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/createWithArray" @@ -538,7 +538,7 @@ UserApi <- R6::R6Class( })), collapse = ",") local_var_body <- paste0("[", body.items, "]") } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/createWithList" @@ -1099,7 +1099,7 @@ UserApi <- R6::R6Class( if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/{username}" diff --git a/samples/client/petstore/R-httr2/R/whale.R b/samples/client/petstore/R-httr2/R/whale.R index 1dcb6f024119..61fc073320b2 100644 --- a/samples/client/petstore/R-httr2/R/whale.R +++ b/samples/client/petstore/R-httr2/R/whale.R @@ -115,9 +115,9 @@ Whale <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/zebra.R b/samples/client/petstore/R-httr2/R/zebra.R index b461a9763cf7..b354f0f40a15 100644 --- a/samples/client/petstore/R-httr2/R/zebra.R +++ b/samples/client/petstore/R-httr2/R/zebra.R @@ -105,9 +105,9 @@ Zebra <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index c4559b3e5145..3786a1054cf1 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -171,9 +171,9 @@ AllofTagApiResponse <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index 03da218e9927..c8c823c30e62 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -125,9 +125,9 @@ Animal <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index 5af7c69e8359..71e6f416962a 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -123,9 +123,9 @@ BasquePig <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index 072decc18b9c..2241b185eb79 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -140,9 +140,9 @@ Cat <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 5793f3264f1a..d4163ceb79f1 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -123,9 +123,9 @@ Category <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index 4f78411ab788..e2648f71773b 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -123,9 +123,9 @@ DanishPig <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/date.R b/samples/client/petstore/R/R/date.R index e2f3816c2269..7b2a515b4a41 100644 --- a/samples/client/petstore/R/R/date.R +++ b/samples/client/petstore/R/R/date.R @@ -147,9 +147,9 @@ Date <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index 4aa6742dcc78..84f2f95d10ba 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -140,9 +140,9 @@ Dog <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/dummy_model.R b/samples/client/petstore/R/R/dummy_model.R index ec28d376d53f..f02b49b1689e 100644 --- a/samples/client/petstore/R/R/dummy_model.R +++ b/samples/client/petstore/R/R/dummy_model.R @@ -107,9 +107,9 @@ DummyModel <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/fake_api.R b/samples/client/petstore/R/R/fake_api.R index ee88e7eba789..452eab587ded 100644 --- a/samples/client/petstore/R/R/fake_api.R +++ b/samples/client/petstore/R/R/fake_api.R @@ -225,7 +225,7 @@ FakeApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/fake/test_optional_body_parameter" diff --git a/samples/client/petstore/R/R/format_test.R b/samples/client/petstore/R/R/format_test.R index f445caea8224..d0b00692018c 100644 --- a/samples/client/petstore/R/R/format_test.R +++ b/samples/client/petstore/R/R/format_test.R @@ -322,9 +322,9 @@ FormatTest <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index 3634304e857c..84509e9ccc41 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -139,9 +139,9 @@ ModelApiResponse <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index b69969f79f68..ca50bdda493f 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -123,9 +123,9 @@ NestedOneOf <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 57e8afb93f6d..d8a82a3de40d 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -193,9 +193,9 @@ Order <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index cc0083ccb2f5..991beb2cee9e 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -191,9 +191,9 @@ Pet <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index a19e01486290..6c74624fad21 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -435,7 +435,7 @@ PetApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/pet" @@ -1288,7 +1288,7 @@ PetApi <- R6::R6Class( if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/pet" diff --git a/samples/client/petstore/R/R/pet_map.R b/samples/client/petstore/R/R/pet_map.R index 9d00d4d7cf5d..7e10a74a873b 100644 --- a/samples/client/petstore/R/R/pet_map.R +++ b/samples/client/petstore/R/R/pet_map.R @@ -106,9 +106,9 @@ PetMap <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index fd8aa79b26ba..4257a85da203 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -208,9 +208,9 @@ Special <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/store_api.R b/samples/client/petstore/R/R/store_api.R index 6889cdf7aa70..81acb942675c 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -546,7 +546,7 @@ StoreApi <- R6::R6Class( if (!is.null(`order`)) { local_var_body <- `order`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/store/order" diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index ce13bc25c170..95f6072f617f 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -123,9 +123,9 @@ Tag <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index c8e6bf91cb1a..357845b71f6f 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -120,9 +120,9 @@ UpdatePetRequest <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index 76a78edad38a..b99d4a9a0250 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -219,9 +219,9 @@ User <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 389cc69b57e4..39b793e40f75 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -318,7 +318,7 @@ UserApi <- R6::R6Class( if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user" @@ -428,7 +428,7 @@ UserApi <- R6::R6Class( })), collapse = ",") local_var_body <- paste0("[", body.items, "]") } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/createWithArray" @@ -538,7 +538,7 @@ UserApi <- R6::R6Class( })), collapse = ",") local_var_body <- paste0("[", body.items, "]") } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/createWithList" @@ -1099,7 +1099,7 @@ UserApi <- R6::R6Class( if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() } else { - body <- NULL + local_var_body <- NULL } local_var_url_path <- "/user/{username}" diff --git a/samples/client/petstore/R/R/whale.R b/samples/client/petstore/R/R/whale.R index ceb056aab2dd..0e22bb97389f 100644 --- a/samples/client/petstore/R/R/whale.R +++ b/samples/client/petstore/R/R/whale.R @@ -139,9 +139,9 @@ Whale <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description diff --git a/samples/client/petstore/R/R/zebra.R b/samples/client/petstore/R/R/zebra.R index bbc678e1c5f3..7bfcddc488c3 100644 --- a/samples/client/petstore/R/R/zebra.R +++ b/samples/client/petstore/R/R/zebra.R @@ -129,9 +129,9 @@ Zebra <- R6::R6Class( json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) if (minify) { - return(jsonlite::minify(json_string)) + json_string <- jsonlite::minify(json_string) } - return(json_string) + return(as.character(json_string)) }, #' @description From 0fba5cbafbc6afa02d75305362ca0e42b308f3e5 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Thu, 21 Nov 2024 06:05:24 -0500 Subject: [PATCH 3/7] wip --- samples/client/petstore/R-httr2-wrapper/R/api_client.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/client/petstore/R-httr2-wrapper/R/api_client.R b/samples/client/petstore/R-httr2-wrapper/R/api_client.R index 9c5bba767310..05ce9da6d244 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/api_client.R +++ b/samples/client/petstore/R-httr2-wrapper/R/api_client.R @@ -46,7 +46,7 @@ ApiClient <- R6::R6Class( "ApiClient", public = list( # base path of all requests - base_path = "http://petstore.swagger.io/v2", + base_path = "http://localhost/v2", # user agent in the HTTP request user_agent = "PetstoreAgent", # default headers in the HTTP request diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index ca50bdda493f..7dc360e4d6eb 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -115,6 +115,7 @@ NestedOneOf <- R6::R6Class( #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format toJSONString = function(minify = TRUE, ...) { + browser() json_obj <- self$toList() for (key in names(self$additional_properties)) { From 839ed049d8a1af94f1c602ebf941027174a94b6c Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Thu, 21 Nov 2024 12:37:07 -0500 Subject: [PATCH 4/7] refactor pr --- .../src/main/resources/r/modelAnyOf.mustache | 29 ++++++++------- .../src/main/resources/r/modelEnum.mustache | 22 ++++++++---- .../main/resources/r/modelGeneric.mustache | 36 ++++++++++--------- .../src/main/resources/r/modelOneOf.mustache | 28 ++++++++++----- samples/client/echo_api/r/R/bird.R | 28 ++++++++------- samples/client/echo_api/r/R/category.R | 28 ++++++++------- samples/client/echo_api/r/R/data_query.R | 28 ++++++++------- samples/client/echo_api/r/R/default_value.R | 30 ++++++++-------- .../echo_api/r/R/number_properties_only.R | 28 ++++++++------- samples/client/echo_api/r/R/pet.R | 32 +++++++++-------- samples/client/echo_api/r/R/query.R | 28 ++++++++------- samples/client/echo_api/r/R/string_enum_ref.R | 22 ++++++++---- samples/client/echo_api/r/R/tag.R | 28 ++++++++------- ...est_form_object_multipart_request_marker.R | 28 ++++++++------- ...rue_object_all_of_query_object_parameter.R | 28 ++++++++------- ...true_array_string_query_object_parameter.R | 28 ++++++++------- .../R/allof_tag_api_response.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/animal.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/any_of_pig.R | 29 ++++++++------- .../R/any_of_primitive_type_test.R | 28 ++++++++++----- .../petstore/R-httr2-wrapper/R/api_client.R | 2 +- .../petstore/R-httr2-wrapper/R/basque_pig.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/cat.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/category.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/danish_pig.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/date.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/dog.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/dummy_model.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/format_test.R | 30 ++++++++-------- .../petstore/R-httr2-wrapper/R/mammal.R | 28 ++++++++++----- .../R-httr2-wrapper/R/model_api_response.R | 30 ++++++++-------- .../R-httr2-wrapper/R/nested_one_of.R | 33 ++++++++--------- .../R/one_of_primitive_type_test.R | 28 ++++++++++----- .../client/petstore/R-httr2-wrapper/R/order.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/pet.R | 34 +++++++++--------- .../petstore/R-httr2-wrapper/R/pet_map.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/pig.R | 28 ++++++++++----- .../petstore/R-httr2-wrapper/R/special.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/tag.R | 30 ++++++++-------- .../R-httr2-wrapper/R/update_pet_request.R | 32 +++++++++-------- .../client/petstore/R-httr2-wrapper/R/user.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/whale.R | 30 ++++++++-------- .../client/petstore/R-httr2-wrapper/R/zebra.R | 30 ++++++++-------- .../tests/testthat/test_petstore.R | 6 ++-- .../R-httr2/R/allof_tag_api_response.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/animal.R | 28 ++++++++------- .../client/petstore/R-httr2/R/any_of_pig.R | 29 ++++++++------- .../R-httr2/R/any_of_primitive_type_test.R | 28 ++++++++++----- .../client/petstore/R-httr2/R/api_client.R | 2 +- .../client/petstore/R-httr2/R/basque_pig.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/cat.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/category.R | 28 ++++++++------- .../client/petstore/R-httr2/R/danish_pig.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/date.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/dog.R | 28 ++++++++------- .../client/petstore/R-httr2/R/format_test.R | 28 ++++++++------- .../client/petstore/R-httr2/R/just_model.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/mammal.R | 28 ++++++++++----- .../petstore/R-httr2/R/model_api_response.R | 28 ++++++++------- .../client/petstore/R-httr2/R/nested_one_of.R | 30 ++++++++-------- .../R-httr2/R/one_of_primitive_type_test.R | 28 ++++++++++----- samples/client/petstore/R-httr2/R/order.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/pet.R | 32 +++++++++-------- samples/client/petstore/R-httr2/R/pet_map.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/pig.R | 28 ++++++++++----- samples/client/petstore/R-httr2/R/special.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/tag.R | 28 ++++++++------- .../petstore/R-httr2/R/update_pet_request.R | 30 ++++++++-------- samples/client/petstore/R-httr2/R/user.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/whale.R | 28 ++++++++------- samples/client/petstore/R-httr2/R/zebra.R | 28 ++++++++------- .../R-httr2/tests/testthat/test_petstore.R | 6 ++-- .../petstore/R/R/allof_tag_api_response.R | 30 ++++++++-------- samples/client/petstore/R/R/animal.R | 30 ++++++++-------- samples/client/petstore/R/R/any_of_pig.R | 29 ++++++++------- .../petstore/R/R/any_of_primitive_type_test.R | 28 ++++++++++----- samples/client/petstore/R/R/basque_pig.R | 30 ++++++++-------- samples/client/petstore/R/R/cat.R | 30 ++++++++-------- samples/client/petstore/R/R/category.R | 30 ++++++++-------- samples/client/petstore/R/R/danish_pig.R | 30 ++++++++-------- samples/client/petstore/R/R/date.R | 30 ++++++++-------- samples/client/petstore/R/R/dog.R | 30 ++++++++-------- samples/client/petstore/R/R/dummy_model.R | 30 ++++++++-------- samples/client/petstore/R/R/format_test.R | 30 ++++++++-------- samples/client/petstore/R/R/mammal.R | 28 ++++++++++----- .../client/petstore/R/R/model_api_response.R | 30 ++++++++-------- samples/client/petstore/R/R/nested_one_of.R | 32 +++++++++-------- .../petstore/R/R/one_of_primitive_type_test.R | 28 ++++++++++----- samples/client/petstore/R/R/order.R | 30 ++++++++-------- samples/client/petstore/R/R/pet.R | 34 +++++++++--------- samples/client/petstore/R/R/pet_map.R | 30 ++++++++-------- samples/client/petstore/R/R/pig.R | 28 ++++++++++----- samples/client/petstore/R/R/special.R | 30 ++++++++-------- samples/client/petstore/R/R/tag.R | 30 ++++++++-------- .../client/petstore/R/R/update_pet_request.R | 32 +++++++++-------- samples/client/petstore/R/R/user.R | 30 ++++++++-------- samples/client/petstore/R/R/whale.R | 30 ++++++++-------- samples/client/petstore/R/R/zebra.R | 30 ++++++++-------- .../petstore/R/tests/testthat/test_petstore.R | 6 ++-- 99 files changed, 1542 insertions(+), 1227 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache b/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache index 62e6dd7e41c1..c21378021fc5 100644 --- a/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache @@ -86,27 +86,32 @@ }, #' @description - #' Serialize {{{classname}}} to JSON string. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert {{{classname}}} to a base R type #' - #' @return JSON string representation of the {{{classname}}}. - toJSONString = function() { + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify((self$actual_instance$toJSONString()))) + return(self$actual_instance$toSimpleType()) } else { NULL } }, #' @description - #' Serialize {{{classname}}} to JSON. + #' Serialize {{{classname}}} to JSON string. #' - #' @return JSON representation of the {{{classname}}}. - toJSON = function() { - if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() - } else { - NULL - } + #' @param ... Parameters passed to `jsonlite::toJSON` + #' @return JSON string representation of the {{{classname}}}. + toJSONString = function(...) { + json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/modules/openapi-generator/src/main/resources/r/modelEnum.mustache b/modules/openapi-generator/src/main/resources/r/modelEnum.mustache index 64d136449be1..9f865e01ea4e 100644 --- a/modules/openapi-generator/src/main/resources/r/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelEnum.mustache @@ -38,11 +38,18 @@ }, #' @description - #' To JSON String - #' - #' @return {{{classname}}} in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - jsonlite::toJSON(private$value, auto_unbox = TRUE) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert {{{classname}}} to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { + return(private$value) }, #' @description @@ -60,10 +67,11 @@ #' @description #' To JSON String #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return {{{classname}}} in JSON format - toJSONString = function() { - as.character(jsonlite::toJSON(private$value, - auto_unbox = TRUE)) + toJSONString = function(...) { + json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index 53834be7fb31..7c932ab4d481 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -203,10 +203,10 @@ }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -222,6 +222,14 @@ #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert {{{classname}}} to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { {{classname}}Object <- list() {{#vars}} if (!is.null(self$`{{name}}`)) { @@ -232,7 +240,7 @@ self$`{{name}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - lapply(self$`{{name}}`, function(x) x$toList()) + lapply(self$`{{name}}`, function(x) x$toSimpleType()) {{/isPrimitiveType}} {{/isArray}} {{#isMap}} @@ -240,7 +248,7 @@ self$`{{name}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - lapply(self$`{{name}}`, function(x) x$toList()) + lapply(self$`{{name}}`, function(x) x$toSimpleType()) {{/isPrimitiveType}} {{/isMap}} {{/isContainer}} @@ -249,7 +257,7 @@ self$`{{name}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - self$`{{name}}`$toList() + self$`{{name}}`$toSimpleType() {{/isPrimitiveType}} {{/isContainer}} } @@ -320,23 +328,17 @@ #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return {{{classname}}} in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() {{#isAdditionalPropertiesTrue}} for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] + simple[[key]] <- self$additional_properties[[key]] } {{/isAdditionalPropertiesTrue}} - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache index 4fe94c4ad043..eddcf7eaa30c 100644 --- a/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache @@ -139,25 +139,35 @@ #' @description #' Serialize {{{classname}}} to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the {{{classname}}}. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize {{{classname}}} to JSON. - #' - #' @return JSON representation of the {{{classname}}}. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert {{{classname}}} to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R index f3f85310b648..6a6009390c67 100644 --- a/samples/client/echo_api/r/R/bird.R +++ b/samples/client/echo_api/r/R/bird.R @@ -40,10 +40,10 @@ Bird <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ Bird <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Bird to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { BirdObject <- list() if (!is.null(self$`size`)) { BirdObject[["size"]] <- @@ -90,18 +98,12 @@ Bird <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Bird in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R index 7b010e3535bc..a64675884f51 100644 --- a/samples/client/echo_api/r/R/category.R +++ b/samples/client/echo_api/r/R/category.R @@ -40,10 +40,10 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ Category <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Category to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -90,18 +98,12 @@ Category <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R index 8289e40f5b1a..42920cdfb16b 100644 --- a/samples/client/echo_api/r/R/data_query.R +++ b/samples/client/echo_api/r/R/data_query.R @@ -67,10 +67,10 @@ DataQuery <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -86,6 +86,14 @@ DataQuery <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DataQuery to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DataQueryObject <- list() if (!is.null(self$`id`)) { DataQueryObject[["id"]] <- @@ -138,18 +146,12 @@ DataQuery <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DataQuery in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R index 06ce83975d2b..375e0ae0c4b5 100644 --- a/samples/client/echo_api/r/R/default_value.R +++ b/samples/client/echo_api/r/R/default_value.R @@ -87,10 +87,10 @@ DefaultValue <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -106,10 +106,18 @@ DefaultValue <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DefaultValue to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DefaultValueObject <- list() if (!is.null(self$`array_string_enum_ref_default`)) { DefaultValueObject[["array_string_enum_ref_default"]] <- - lapply(self$`array_string_enum_ref_default`, function(x) x$toList()) + lapply(self$`array_string_enum_ref_default`, function(x) x$toSimpleType()) } if (!is.null(self$`array_string_enum_default`)) { DefaultValueObject[["array_string_enum_default"]] <- @@ -179,18 +187,12 @@ DefaultValue <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DefaultValue in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R index dca68d84d3ce..c368831c4306 100644 --- a/samples/client/echo_api/r/R/number_properties_only.R +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -46,10 +46,10 @@ NumberPropertiesOnly <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -65,6 +65,14 @@ NumberPropertiesOnly <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert NumberPropertiesOnly to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { NumberPropertiesOnlyObject <- list() if (!is.null(self$`number`)) { NumberPropertiesOnlyObject[["number"]] <- @@ -103,18 +111,12 @@ NumberPropertiesOnly <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NumberPropertiesOnly in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R index 57bc5e894814..a708db2bfdf2 100644 --- a/samples/client/echo_api/r/R/pet.R +++ b/samples/client/echo_api/r/R/pet.R @@ -75,10 +75,10 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -94,6 +94,14 @@ Pet <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pet to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -105,7 +113,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toList() + self$`category`$toSimpleType() } if (!is.null(self$`photoUrls`)) { PetObject[["photoUrls"]] <- @@ -113,7 +121,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toList()) + lapply(self$`tags`, function(x) x$toSimpleType()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- @@ -158,18 +166,12 @@ Pet <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R index 31a0b45fee1a..fc4fa18bae2f 100644 --- a/samples/client/echo_api/r/R/query.R +++ b/samples/client/echo_api/r/R/query.R @@ -39,10 +39,10 @@ Query <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -58,6 +58,14 @@ Query <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Query to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { QueryObject <- list() if (!is.null(self$`id`)) { QueryObject[["id"]] <- @@ -89,18 +97,12 @@ Query <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Query in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/string_enum_ref.R b/samples/client/echo_api/r/R/string_enum_ref.R index 1be463a16552..7e2865080c2c 100644 --- a/samples/client/echo_api/r/R/string_enum_ref.R +++ b/samples/client/echo_api/r/R/string_enum_ref.R @@ -37,11 +37,18 @@ StringEnumRef <- R6::R6Class( }, #' @description - #' To JSON String - #' - #' @return StringEnumRef in JSON format + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - jsonlite::toJSON(private$value, auto_unbox = TRUE) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert StringEnumRef to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { + return(private$value) }, #' @description @@ -59,10 +66,11 @@ StringEnumRef <- R6::R6Class( #' @description #' To JSON String #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return StringEnumRef in JSON format - toJSONString = function() { - as.character(jsonlite::toJSON(private$value, - auto_unbox = TRUE)) + toJSONString = function(...) { + json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R index 70c5be0042d5..73ccbfa95560 100644 --- a/samples/client/echo_api/r/R/tag.R +++ b/samples/client/echo_api/r/R/tag.R @@ -40,10 +40,10 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ Tag <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Tag to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -90,18 +98,12 @@ Tag <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R index 28499ce0f5c3..69f4600d71ba 100644 --- a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -31,10 +31,10 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -50,6 +50,14 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert TestFormObjectMultipartRequestMarker to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TestFormObjectMultipartRequestMarkerObject <- list() if (!is.null(self$`name`)) { TestFormObjectMultipartRequestMarkerObject[["name"]] <- @@ -74,18 +82,12 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return TestFormObjectMultipartRequestMarker in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R index 963ed80aad94..fa54e2db56d5 100644 --- a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -58,10 +58,10 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -77,6 +77,14 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject <- list() if (!is.null(self$`size`)) { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["size"]] <- @@ -122,18 +130,12 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R index 0200084c06a2..e8254d81be69 100644 --- a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -30,10 +30,10 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -49,6 +49,14 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject <- list() if (!is.null(self$`values`)) { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject[["values"]] <- @@ -73,18 +81,12 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R index 3786a1054cf1..3f49711346c1 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R @@ -77,10 +77,10 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -96,6 +96,14 @@ AllofTagApiResponse <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert AllofTagApiResponse to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { AllofTagApiResponseObject <- list() if (!is.null(self$`id`)) { AllofTagApiResponseObject[["id"]] <- @@ -159,21 +167,15 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return AllofTagApiResponse in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/animal.R b/samples/client/petstore/R-httr2-wrapper/R/animal.R index c8c823c30e62..ed2345cf0c37 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/animal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/animal.R @@ -52,10 +52,10 @@ Animal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -71,6 +71,14 @@ Animal <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Animal to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { AnimalObject <- list() if (!is.null(self$`className`)) { AnimalObject[["className"]] <- @@ -113,21 +121,15 @@ Animal <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Animal in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R b/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R index ba3c8ea856d9..8dc5f870441a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R @@ -91,27 +91,32 @@ AnyOfPig <- R6::R6Class( }, #' @description - #' Serialize AnyOfPig to JSON string. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert AnyOfPig to a base R type #' - #' @return JSON string representation of the AnyOfPig. - toJSONString = function() { + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify((self$actual_instance$toJSONString()))) + return(self$actual_instance$toSimpleType()) } else { NULL } }, #' @description - #' Serialize AnyOfPig to JSON. + #' Serialize AnyOfPig to JSON string. #' - #' @return JSON representation of the AnyOfPig. - toJSON = function() { - if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() - } else { - NULL - } + #' @param ... Parameters passed to `jsonlite::toJSON` + #' @return JSON string representation of the AnyOfPig. + toJSONString = function(...) { + json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R b/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R index 99aa52c73427..da3c94ba534e 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R @@ -111,25 +111,35 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Serialize AnyOfPrimitiveTypeTest to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the AnyOfPrimitiveTypeTest. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize AnyOfPrimitiveTypeTest to JSON. - #' - #' @return JSON representation of the AnyOfPrimitiveTypeTest. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert AnyOfPrimitiveTypeTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/api_client.R b/samples/client/petstore/R-httr2-wrapper/R/api_client.R index 05ce9da6d244..9c5bba767310 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/api_client.R +++ b/samples/client/petstore/R-httr2-wrapper/R/api_client.R @@ -46,7 +46,7 @@ ApiClient <- R6::R6Class( "ApiClient", public = list( # base path of all requests - base_path = "http://localhost/v2", + base_path = "http://petstore.swagger.io/v2", # user agent in the HTTP request user_agent = "PetstoreAgent", # default headers in the HTTP request diff --git a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R index 71e6f416962a..7b723e1e16f2 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R @@ -50,10 +50,10 @@ BasquePig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ BasquePig <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert BasquePig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { BasquePigObject <- list() if (!is.null(self$`className`)) { BasquePigObject[["className"]] <- @@ -111,21 +119,15 @@ BasquePig <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return BasquePig in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/cat.R b/samples/client/petstore/R-httr2-wrapper/R/cat.R index 2241b185eb79..71ae84011f2d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/cat.R +++ b/samples/client/petstore/R-httr2-wrapper/R/cat.R @@ -60,10 +60,10 @@ Cat <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -79,6 +79,14 @@ Cat <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Cat to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CatObject <- list() if (!is.null(self$`className`)) { CatObject[["className"]] <- @@ -128,21 +136,15 @@ Cat <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Cat in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/category.R b/samples/client/petstore/R-httr2-wrapper/R/category.R index d4163ceb79f1..60f30ed3d590 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/category.R +++ b/samples/client/petstore/R-httr2-wrapper/R/category.R @@ -50,10 +50,10 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ Category <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Category to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -111,21 +119,15 @@ Category <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R index e2648f71773b..3a1006b949d5 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R @@ -50,10 +50,10 @@ DanishPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ DanishPig <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DanishPig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DanishPigObject <- list() if (!is.null(self$`className`)) { DanishPigObject[["className"]] <- @@ -111,21 +119,15 @@ DanishPig <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DanishPig in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/date.R b/samples/client/petstore/R-httr2-wrapper/R/date.R index 7b2a515b4a41..de4b63119a69 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/date.R +++ b/samples/client/petstore/R-httr2-wrapper/R/date.R @@ -63,10 +63,10 @@ Date <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -82,6 +82,14 @@ Date <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Date to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DateObject <- list() if (!is.null(self$`className`)) { DateObject[["className"]] <- @@ -135,21 +143,15 @@ Date <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Date in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/dog.R b/samples/client/petstore/R-httr2-wrapper/R/dog.R index 84f2f95d10ba..4ac98c3001ad 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dog.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dog.R @@ -60,10 +60,10 @@ Dog <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -79,6 +79,14 @@ Dog <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Dog to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DogObject <- list() if (!is.null(self$`className`)) { DogObject[["className"]] <- @@ -128,21 +136,15 @@ Dog <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Dog in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R index f02b49b1689e..cefc60d560b7 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R @@ -41,10 +41,10 @@ DummyModel <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -60,6 +60,14 @@ DummyModel <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DummyModel to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DummyModelObject <- list() if (!is.null(self$`property`)) { DummyModelObject[["property"]] <- @@ -95,21 +103,15 @@ DummyModel <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DummyModel in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/format_test.R b/samples/client/petstore/R-httr2-wrapper/R/format_test.R index d0b00692018c..ba23603c71d3 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/format_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/format_test.R @@ -158,10 +158,10 @@ FormatTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -177,6 +177,14 @@ FormatTest <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert FormatTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { FormatTestObject <- list() if (!is.null(self$`integer`)) { FormatTestObject[["integer"]] <- @@ -310,21 +318,15 @@ FormatTest <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return FormatTest in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/mammal.R b/samples/client/petstore/R-httr2-wrapper/R/mammal.R index fe4f3577d0ce..22f5add3f711 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/mammal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/mammal.R @@ -135,25 +135,35 @@ Mammal <- R6::R6Class( #' @description #' Serialize Mammal to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the Mammal. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize Mammal to JSON. - #' - #' @return JSON representation of the Mammal. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert Mammal to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R index 84509e9ccc41..c957460a980a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R @@ -59,10 +59,10 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -78,6 +78,14 @@ ModelApiResponse <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert ModelApiResponse to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { ModelApiResponseObject <- list() if (!is.null(self$`code`)) { ModelApiResponseObject[["code"]] <- @@ -127,21 +135,15 @@ ModelApiResponse <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return ModelApiResponse in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index 7dc360e4d6eb..be617dc2b654 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -48,10 +48,10 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -67,6 +67,14 @@ NestedOneOf <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert NestedOneOf to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { NestedOneOfObject <- list() if (!is.null(self$`size`)) { NestedOneOfObject[["size"]] <- @@ -74,7 +82,7 @@ NestedOneOf <- R6::R6Class( } if (!is.null(self$`nested_pig`)) { NestedOneOfObject[["nested_pig"]] <- - self$`nested_pig`$toList() + self$`nested_pig`$toSimpleType() } for (key in names(self$additional_properties)) { NestedOneOfObject[[key]] <- self$additional_properties[[key]] @@ -111,22 +119,15 @@ NestedOneOf <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format - toJSONString = function(minify = TRUE, ...) { - browser() - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R b/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R index 8a9280a9b213..04e5675405d5 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R @@ -111,25 +111,35 @@ OneOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Serialize OneOfPrimitiveTypeTest to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the OneOfPrimitiveTypeTest. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize OneOfPrimitiveTypeTest to JSON. - #' - #' @return JSON representation of the OneOfPrimitiveTypeTest. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert OneOfPrimitiveTypeTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/order.R b/samples/client/petstore/R-httr2-wrapper/R/order.R index d8a82a3de40d..5aad96282a11 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/order.R +++ b/samples/client/petstore/R-httr2-wrapper/R/order.R @@ -89,10 +89,10 @@ Order <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -108,6 +108,14 @@ Order <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Order to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { OrderObject <- list() if (!is.null(self$`id`)) { OrderObject[["id"]] <- @@ -181,21 +189,15 @@ Order <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Order in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet.R b/samples/client/petstore/R-httr2-wrapper/R/pet.R index 991beb2cee9e..952b061b0258 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet.R @@ -85,10 +85,10 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -104,6 +104,14 @@ Pet <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pet to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -111,7 +119,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toList() + self$`category`$toSimpleType() } if (!is.null(self$`name`)) { PetObject[["name"]] <- @@ -123,7 +131,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toList()) + lapply(self$`tags`, function(x) x$toSimpleType()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- @@ -179,21 +187,15 @@ Pet <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R index 7e10a74a873b..2f1cd3c3b732 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R @@ -40,10 +40,10 @@ PetMap <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ PetMap <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert PetMap to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetMapObject <- list() if (!is.null(self$`pet`)) { PetMapObject[["pet"]] <- @@ -94,21 +102,15 @@ PetMap <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return PetMap in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/pig.R b/samples/client/petstore/R-httr2-wrapper/R/pig.R index 6e0242ca3e9e..53ce25eb1b22 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pig.R @@ -135,25 +135,35 @@ Pig <- R6::R6Class( #' @description #' Serialize Pig to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the Pig. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize Pig to JSON. - #' - #' @return JSON representation of the Pig. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/special.R b/samples/client/petstore/R-httr2-wrapper/R/special.R index 4257a85da203..251d7a203a4b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/special.R +++ b/samples/client/petstore/R-httr2-wrapper/R/special.R @@ -97,10 +97,10 @@ Special <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -116,6 +116,14 @@ Special <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Special to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { SpecialObject <- list() if (!is.null(self$`set_test`)) { SpecialObject[["set_test"]] <- @@ -196,21 +204,15 @@ Special <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Special in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/tag.R b/samples/client/petstore/R-httr2-wrapper/R/tag.R index 95f6072f617f..f70547525154 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/tag.R +++ b/samples/client/petstore/R-httr2-wrapper/R/tag.R @@ -50,10 +50,10 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ Tag <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Tag to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -111,21 +119,15 @@ Tag <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R index 357845b71f6f..071d4c2b13a1 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R @@ -45,10 +45,10 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -64,10 +64,18 @@ UpdatePetRequest <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert UpdatePetRequest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { UpdatePetRequestObject <- list() if (!is.null(self$`jsonData`)) { UpdatePetRequestObject[["jsonData"]] <- - self$`jsonData`$toList() + self$`jsonData`$toSimpleType() } if (!is.null(self$`binaryDataN2Information`)) { UpdatePetRequestObject[["binaryDataN2Information"]] <- @@ -108,21 +116,15 @@ UpdatePetRequest <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return UpdatePetRequest in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/user.R b/samples/client/petstore/R-httr2-wrapper/R/user.R index b99d4a9a0250..4fdd141e6764 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user.R @@ -104,10 +104,10 @@ User <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -123,6 +123,14 @@ User <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert User to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { UserObject <- list() if (!is.null(self$`id`)) { UserObject[["id"]] <- @@ -207,21 +215,15 @@ User <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return User in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/whale.R b/samples/client/petstore/R-httr2-wrapper/R/whale.R index 0e22bb97389f..0699335bf804 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/whale.R +++ b/samples/client/petstore/R-httr2-wrapper/R/whale.R @@ -59,10 +59,10 @@ Whale <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -78,6 +78,14 @@ Whale <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Whale to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { WhaleObject <- list() if (!is.null(self$`hasBaleen`)) { WhaleObject[["hasBaleen"]] <- @@ -127,21 +135,15 @@ Whale <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Whale in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/R/zebra.R b/samples/client/petstore/R-httr2-wrapper/R/zebra.R index 7bfcddc488c3..946b44b767ae 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/zebra.R +++ b/samples/client/petstore/R-httr2-wrapper/R/zebra.R @@ -53,10 +53,10 @@ Zebra <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -72,6 +72,14 @@ Zebra <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Zebra to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { ZebraObject <- list() if (!is.null(self$`type`)) { ZebraObject[["type"]] <- @@ -117,21 +125,15 @@ Zebra <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Zebra in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2-wrapper/tests/testthat/test_petstore.R b/samples/client/petstore/R-httr2-wrapper/tests/testthat/test_petstore.R index 917d3fb00ec4..f5c8c4edabf4 100644 --- a/samples/client/petstore/R-httr2-wrapper/tests/testthat/test_petstore.R +++ b/samples/client/petstore/R-httr2-wrapper/tests/testthat/test_petstore.R @@ -70,7 +70,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString print", { # tests for other pet objects pet0 <- Pet$new() - jsonpet <- pet0$toJSON() + jsonpet <- pet0$toSimpleType() pet2 <- pet0$fromJSON( jsonlite::toJSON(jsonpet, auto_unbox = TRUE) ) @@ -96,7 +96,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString print", { ), status = "available" ) - jsonpet <- pet1$toJSON() + jsonpet <- pet1$toSimpleType() pet2 <- pet1$fromJSON( jsonlite::toJSON(jsonpet, auto_unbox = TRUE) ) @@ -118,7 +118,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString print", { test_that("Test Category", { c1 <- Category$new(id = 450, name = "test_cat") c2 <- Category$new() - c2$fromJSON(jsonlite::toJSON(c1$toJSON(), auto_unbox = TRUE)) + c2$fromJSON(jsonlite::toJSON(c1$toSimpleType(), auto_unbox = TRUE)) expect_equal(c1, c2) c2$fromJSONString(c1$toJSONString()) expect_equal(c1, c2) diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index a282309e2087..64a169313a54 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -67,10 +67,10 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -86,6 +86,14 @@ AllofTagApiResponse <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert AllofTagApiResponse to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { AllofTagApiResponseObject <- list() if (!is.null(self$`id`)) { AllofTagApiResponseObject[["id"]] <- @@ -138,18 +146,12 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return AllofTagApiResponse in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 5ae1cc1594e0..5fe021c26521 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -42,10 +42,10 @@ Animal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -61,6 +61,14 @@ Animal <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Animal to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { AnimalObject <- list() if (!is.null(self$`className`)) { AnimalObject[["className"]] <- @@ -92,18 +100,12 @@ Animal <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Animal in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/any_of_pig.R b/samples/client/petstore/R-httr2/R/any_of_pig.R index ba3c8ea856d9..8dc5f870441a 100644 --- a/samples/client/petstore/R-httr2/R/any_of_pig.R +++ b/samples/client/petstore/R-httr2/R/any_of_pig.R @@ -91,27 +91,32 @@ AnyOfPig <- R6::R6Class( }, #' @description - #' Serialize AnyOfPig to JSON string. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert AnyOfPig to a base R type #' - #' @return JSON string representation of the AnyOfPig. - toJSONString = function() { + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify((self$actual_instance$toJSONString()))) + return(self$actual_instance$toSimpleType()) } else { NULL } }, #' @description - #' Serialize AnyOfPig to JSON. + #' Serialize AnyOfPig to JSON string. #' - #' @return JSON representation of the AnyOfPig. - toJSON = function() { - if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() - } else { - NULL - } + #' @param ... Parameters passed to `jsonlite::toJSON` + #' @return JSON string representation of the AnyOfPig. + toJSONString = function(...) { + json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R b/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R index 99aa52c73427..da3c94ba534e 100644 --- a/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R @@ -111,25 +111,35 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Serialize AnyOfPrimitiveTypeTest to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the AnyOfPrimitiveTypeTest. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize AnyOfPrimitiveTypeTest to JSON. - #' - #' @return JSON representation of the AnyOfPrimitiveTypeTest. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert AnyOfPrimitiveTypeTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2/R/api_client.R b/samples/client/petstore/R-httr2/R/api_client.R index 9c5bba767310..05ce9da6d244 100644 --- a/samples/client/petstore/R-httr2/R/api_client.R +++ b/samples/client/petstore/R-httr2/R/api_client.R @@ -46,7 +46,7 @@ ApiClient <- R6::R6Class( "ApiClient", public = list( # base path of all requests - base_path = "http://petstore.swagger.io/v2", + base_path = "http://localhost/v2", # user agent in the HTTP request user_agent = "PetstoreAgent", # default headers in the HTTP request diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 66d0e6c9b5b5..0925ffa5cfca 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -40,10 +40,10 @@ BasquePig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ BasquePig <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert BasquePig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { BasquePigObject <- list() if (!is.null(self$`className`)) { BasquePigObject[["className"]] <- @@ -90,18 +98,12 @@ BasquePig <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return BasquePig in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index 10921e933ce3..a849a85b3a64 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -50,10 +50,10 @@ Cat <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ Cat <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Cat to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CatObject <- list() if (!is.null(self$`className`)) { CatObject[["className"]] <- @@ -107,18 +115,12 @@ Cat <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Cat in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index 7783b3a84ef4..c28dd249d4e6 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -40,10 +40,10 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ Category <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Category to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -90,18 +98,12 @@ Category <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index 906552a38e9c..9c13b5944ae1 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -40,10 +40,10 @@ DanishPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ DanishPig <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DanishPig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DanishPigObject <- list() if (!is.null(self$`className`)) { DanishPigObject[["className"]] <- @@ -90,18 +98,12 @@ DanishPig <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DanishPig in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/date.R b/samples/client/petstore/R-httr2/R/date.R index 3ec04bc461e6..20f637ef55f1 100644 --- a/samples/client/petstore/R-httr2/R/date.R +++ b/samples/client/petstore/R-httr2/R/date.R @@ -53,10 +53,10 @@ Date <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -72,6 +72,14 @@ Date <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Date to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DateObject <- list() if (!is.null(self$`className`)) { DateObject[["className"]] <- @@ -114,18 +122,12 @@ Date <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Date in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 7f74def48a0f..71897115af32 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -50,10 +50,10 @@ Dog <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ Dog <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Dog to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DogObject <- list() if (!is.null(self$`className`)) { DogObject[["className"]] <- @@ -107,18 +115,12 @@ Dog <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Dog in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/format_test.R b/samples/client/petstore/R-httr2/R/format_test.R index ffdf81deb5db..0ee8e63fe4e0 100644 --- a/samples/client/petstore/R-httr2/R/format_test.R +++ b/samples/client/petstore/R-httr2/R/format_test.R @@ -148,10 +148,10 @@ FormatTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -167,6 +167,14 @@ FormatTest <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert FormatTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { FormatTestObject <- list() if (!is.null(self$`integer`)) { FormatTestObject[["integer"]] <- @@ -289,18 +297,12 @@ FormatTest <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return FormatTest in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/just_model.R b/samples/client/petstore/R-httr2/R/just_model.R index ff0945474f3f..0db76a8c5a65 100644 --- a/samples/client/petstore/R-httr2/R/just_model.R +++ b/samples/client/petstore/R-httr2/R/just_model.R @@ -31,10 +31,10 @@ JustModel <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -50,6 +50,14 @@ JustModel <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert JustModel to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { JustModelObject <- list() if (!is.null(self$`property`)) { JustModelObject[["property"]] <- @@ -74,18 +82,12 @@ JustModel <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JustModel in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/mammal.R b/samples/client/petstore/R-httr2/R/mammal.R index bbd57ed00acb..a330ccda7bf5 100644 --- a/samples/client/petstore/R-httr2/R/mammal.R +++ b/samples/client/petstore/R-httr2/R/mammal.R @@ -109,25 +109,35 @@ Mammal <- R6::R6Class( #' @description #' Serialize Mammal to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the Mammal. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize Mammal to JSON. - #' - #' @return JSON representation of the Mammal. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert Mammal to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index eb434390d981..c4c0a3e131f7 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -49,10 +49,10 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -68,6 +68,14 @@ ModelApiResponse <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert ModelApiResponse to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { ModelApiResponseObject <- list() if (!is.null(self$`code`)) { ModelApiResponseObject[["code"]] <- @@ -106,18 +114,12 @@ ModelApiResponse <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return ModelApiResponse in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index 3a2f0ff9b948..30b245973ade 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -38,10 +38,10 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -57,6 +57,14 @@ NestedOneOf <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert NestedOneOf to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { NestedOneOfObject <- list() if (!is.null(self$`size`)) { NestedOneOfObject[["size"]] <- @@ -64,7 +72,7 @@ NestedOneOf <- R6::R6Class( } if (!is.null(self$`nested_pig`)) { NestedOneOfObject[["nested_pig"]] <- - self$`nested_pig`$toList() + self$`nested_pig`$toSimpleType() } return(NestedOneOfObject) }, @@ -90,18 +98,12 @@ NestedOneOf <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R b/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R index 8a9280a9b213..04e5675405d5 100644 --- a/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R @@ -111,25 +111,35 @@ OneOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Serialize OneOfPrimitiveTypeTest to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the OneOfPrimitiveTypeTest. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize OneOfPrimitiveTypeTest to JSON. - #' - #' @return JSON representation of the OneOfPrimitiveTypeTest. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert OneOfPrimitiveTypeTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index 96dc99b48d50..9018d9d27763 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -79,10 +79,10 @@ Order <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -98,6 +98,14 @@ Order <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Order to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { OrderObject <- list() if (!is.null(self$`id`)) { OrderObject[["id"]] <- @@ -160,18 +168,12 @@ Order <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Order in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index 8318b1471759..03ec24ff0e04 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -75,10 +75,10 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -94,6 +94,14 @@ Pet <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pet to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -101,7 +109,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toList() + self$`category`$toSimpleType() } if (!is.null(self$`name`)) { PetObject[["name"]] <- @@ -113,7 +121,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toList()) + lapply(self$`tags`, function(x) x$toSimpleType()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- @@ -158,18 +166,12 @@ Pet <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pet_map.R b/samples/client/petstore/R-httr2/R/pet_map.R index b0272cc819b8..371534ae064f 100644 --- a/samples/client/petstore/R-httr2/R/pet_map.R +++ b/samples/client/petstore/R-httr2/R/pet_map.R @@ -30,10 +30,10 @@ PetMap <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -49,6 +49,14 @@ PetMap <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert PetMap to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetMapObject <- list() if (!is.null(self$`pet`)) { PetMapObject[["pet"]] <- @@ -73,18 +81,12 @@ PetMap <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return PetMap in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/pig.R b/samples/client/petstore/R-httr2/R/pig.R index 596a9307d4dc..bda5505b0e3c 100644 --- a/samples/client/petstore/R-httr2/R/pig.R +++ b/samples/client/petstore/R-httr2/R/pig.R @@ -109,25 +109,35 @@ Pig <- R6::R6Class( #' @description #' Serialize Pig to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the Pig. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize Pig to JSON. - #' - #' @return JSON representation of the Pig. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index c018b13cead3..5dab22bb2366 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -87,10 +87,10 @@ Special <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -106,6 +106,14 @@ Special <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Special to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { SpecialObject <- list() if (!is.null(self$`set_test`)) { SpecialObject[["set_test"]] <- @@ -175,18 +183,12 @@ Special <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Special in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index f7e1cda5bb38..11ab8f75c24b 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -40,10 +40,10 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ Tag <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Tag to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -90,18 +98,12 @@ Tag <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index 1e4411deca96..cedbd62dfa8b 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -35,10 +35,10 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -54,10 +54,18 @@ UpdatePetRequest <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert UpdatePetRequest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { UpdatePetRequestObject <- list() if (!is.null(self$`jsonData`)) { UpdatePetRequestObject[["jsonData"]] <- - self$`jsonData`$toList() + self$`jsonData`$toSimpleType() } if (!is.null(self$`binaryDataN2Information`)) { UpdatePetRequestObject[["binaryDataN2Information"]] <- @@ -87,18 +95,12 @@ UpdatePetRequest <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return UpdatePetRequest in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index f792027ca8e1..1163e984dc50 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -94,10 +94,10 @@ User <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -113,6 +113,14 @@ User <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert User to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { UserObject <- list() if (!is.null(self$`id`)) { UserObject[["id"]] <- @@ -186,18 +194,12 @@ User <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return User in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/whale.R b/samples/client/petstore/R-httr2/R/whale.R index 61fc073320b2..a6ee888ddce7 100644 --- a/samples/client/petstore/R-httr2/R/whale.R +++ b/samples/client/petstore/R-httr2/R/whale.R @@ -49,10 +49,10 @@ Whale <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -68,6 +68,14 @@ Whale <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Whale to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { WhaleObject <- list() if (!is.null(self$`hasBaleen`)) { WhaleObject[["hasBaleen"]] <- @@ -106,18 +114,12 @@ Whale <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Whale in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/R/zebra.R b/samples/client/petstore/R-httr2/R/zebra.R index b354f0f40a15..479e71c17b1a 100644 --- a/samples/client/petstore/R-httr2/R/zebra.R +++ b/samples/client/petstore/R-httr2/R/zebra.R @@ -43,10 +43,10 @@ Zebra <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -62,6 +62,14 @@ Zebra <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Zebra to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { ZebraObject <- list() if (!is.null(self$`type`)) { ZebraObject[["type"]] <- @@ -96,18 +104,12 @@ Zebra <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Zebra in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) - } - return(as.character(json_string)) + toJSONString = function(...) { + simple <- self$toSimpleType() + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R b/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R index b612714b8122..ec1816d3c39d 100644 --- a/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R +++ b/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R @@ -23,7 +23,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", { # tests for other pet objects pet0 <- Pet$new() - jsonpet <- pet0$toJSON() + jsonpet <- pet0$toSimpleType() pet2 <- pet0$fromJSON( jsonlite::toJSON(jsonpet, auto_unbox = TRUE) ) @@ -49,7 +49,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", { ), status = "available" ) - jsonpet <- pet1$toJSON() + jsonpet <- pet1$toSimpleType() pet2 <- pet1$fromJSON( jsonlite::toJSON(jsonpet, auto_unbox = TRUE) ) @@ -71,7 +71,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", { test_that("Test Category", { c1 <- Category$new(id = 450, name = "test_cat") c2 <- Category$new() - c2$fromJSON(jsonlite::toJSON(c1$toJSON(), auto_unbox = TRUE)) + c2$fromJSON(jsonlite::toJSON(c1$toSimpleType(), auto_unbox = TRUE)) expect_equal(c1, c2) c2$fromJSONString(c1$toJSONString()) expect_equal(c1, c2) diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index 3786a1054cf1..3f49711346c1 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -77,10 +77,10 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -96,6 +96,14 @@ AllofTagApiResponse <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert AllofTagApiResponse to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { AllofTagApiResponseObject <- list() if (!is.null(self$`id`)) { AllofTagApiResponseObject[["id"]] <- @@ -159,21 +167,15 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return AllofTagApiResponse in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index c8c823c30e62..ed2345cf0c37 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -52,10 +52,10 @@ Animal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -71,6 +71,14 @@ Animal <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Animal to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { AnimalObject <- list() if (!is.null(self$`className`)) { AnimalObject[["className"]] <- @@ -113,21 +121,15 @@ Animal <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Animal in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/any_of_pig.R b/samples/client/petstore/R/R/any_of_pig.R index ba3c8ea856d9..8dc5f870441a 100644 --- a/samples/client/petstore/R/R/any_of_pig.R +++ b/samples/client/petstore/R/R/any_of_pig.R @@ -91,27 +91,32 @@ AnyOfPig <- R6::R6Class( }, #' @description - #' Serialize AnyOfPig to JSON string. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert AnyOfPig to a base R type #' - #' @return JSON string representation of the AnyOfPig. - toJSONString = function() { + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify((self$actual_instance$toJSONString()))) + return(self$actual_instance$toSimpleType()) } else { NULL } }, #' @description - #' Serialize AnyOfPig to JSON. + #' Serialize AnyOfPig to JSON string. #' - #' @return JSON representation of the AnyOfPig. - toJSON = function() { - if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() - } else { - NULL - } + #' @param ... Parameters passed to `jsonlite::toJSON` + #' @return JSON string representation of the AnyOfPig. + toJSONString = function(...) { + json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/any_of_primitive_type_test.R b/samples/client/petstore/R/R/any_of_primitive_type_test.R index 99aa52c73427..da3c94ba534e 100644 --- a/samples/client/petstore/R/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R/R/any_of_primitive_type_test.R @@ -111,25 +111,35 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Serialize AnyOfPrimitiveTypeTest to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the AnyOfPrimitiveTypeTest. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize AnyOfPrimitiveTypeTest to JSON. - #' - #' @return JSON representation of the AnyOfPrimitiveTypeTest. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert AnyOfPrimitiveTypeTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index 71e6f416962a..7b723e1e16f2 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -50,10 +50,10 @@ BasquePig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ BasquePig <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert BasquePig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { BasquePigObject <- list() if (!is.null(self$`className`)) { BasquePigObject[["className"]] <- @@ -111,21 +119,15 @@ BasquePig <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return BasquePig in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index 2241b185eb79..71ae84011f2d 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -60,10 +60,10 @@ Cat <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -79,6 +79,14 @@ Cat <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Cat to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CatObject <- list() if (!is.null(self$`className`)) { CatObject[["className"]] <- @@ -128,21 +136,15 @@ Cat <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Cat in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index d4163ceb79f1..60f30ed3d590 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -50,10 +50,10 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ Category <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Category to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { CategoryObject <- list() if (!is.null(self$`id`)) { CategoryObject[["id"]] <- @@ -111,21 +119,15 @@ Category <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Category in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index e2648f71773b..3a1006b949d5 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -50,10 +50,10 @@ DanishPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ DanishPig <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DanishPig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DanishPigObject <- list() if (!is.null(self$`className`)) { DanishPigObject[["className"]] <- @@ -111,21 +119,15 @@ DanishPig <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DanishPig in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/date.R b/samples/client/petstore/R/R/date.R index 7b2a515b4a41..de4b63119a69 100644 --- a/samples/client/petstore/R/R/date.R +++ b/samples/client/petstore/R/R/date.R @@ -63,10 +63,10 @@ Date <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -82,6 +82,14 @@ Date <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Date to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DateObject <- list() if (!is.null(self$`className`)) { DateObject[["className"]] <- @@ -135,21 +143,15 @@ Date <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Date in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index 84f2f95d10ba..4ac98c3001ad 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -60,10 +60,10 @@ Dog <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -79,6 +79,14 @@ Dog <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Dog to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DogObject <- list() if (!is.null(self$`className`)) { DogObject[["className"]] <- @@ -128,21 +136,15 @@ Dog <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Dog in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/dummy_model.R b/samples/client/petstore/R/R/dummy_model.R index f02b49b1689e..cefc60d560b7 100644 --- a/samples/client/petstore/R/R/dummy_model.R +++ b/samples/client/petstore/R/R/dummy_model.R @@ -41,10 +41,10 @@ DummyModel <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -60,6 +60,14 @@ DummyModel <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert DummyModel to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { DummyModelObject <- list() if (!is.null(self$`property`)) { DummyModelObject[["property"]] <- @@ -95,21 +103,15 @@ DummyModel <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return DummyModel in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/format_test.R b/samples/client/petstore/R/R/format_test.R index d0b00692018c..ba23603c71d3 100644 --- a/samples/client/petstore/R/R/format_test.R +++ b/samples/client/petstore/R/R/format_test.R @@ -158,10 +158,10 @@ FormatTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -177,6 +177,14 @@ FormatTest <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert FormatTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { FormatTestObject <- list() if (!is.null(self$`integer`)) { FormatTestObject[["integer"]] <- @@ -310,21 +318,15 @@ FormatTest <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return FormatTest in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/mammal.R b/samples/client/petstore/R/R/mammal.R index bbd57ed00acb..a330ccda7bf5 100644 --- a/samples/client/petstore/R/R/mammal.R +++ b/samples/client/petstore/R/R/mammal.R @@ -109,25 +109,35 @@ Mammal <- R6::R6Class( #' @description #' Serialize Mammal to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the Mammal. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize Mammal to JSON. - #' - #' @return JSON representation of the Mammal. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert Mammal to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index 84509e9ccc41..c957460a980a 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -59,10 +59,10 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -78,6 +78,14 @@ ModelApiResponse <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert ModelApiResponse to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { ModelApiResponseObject <- list() if (!is.null(self$`code`)) { ModelApiResponseObject[["code"]] <- @@ -127,21 +135,15 @@ ModelApiResponse <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return ModelApiResponse in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index ca50bdda493f..be617dc2b654 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -48,10 +48,10 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -67,6 +67,14 @@ NestedOneOf <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert NestedOneOf to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { NestedOneOfObject <- list() if (!is.null(self$`size`)) { NestedOneOfObject[["size"]] <- @@ -74,7 +82,7 @@ NestedOneOf <- R6::R6Class( } if (!is.null(self$`nested_pig`)) { NestedOneOfObject[["nested_pig"]] <- - self$`nested_pig`$toList() + self$`nested_pig`$toSimpleType() } for (key in names(self$additional_properties)) { NestedOneOfObject[[key]] <- self$additional_properties[[key]] @@ -111,21 +119,15 @@ NestedOneOf <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return NestedOneOf in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/one_of_primitive_type_test.R b/samples/client/petstore/R/R/one_of_primitive_type_test.R index 8a9280a9b213..04e5675405d5 100644 --- a/samples/client/petstore/R/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R/R/one_of_primitive_type_test.R @@ -111,25 +111,35 @@ OneOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Serialize OneOfPrimitiveTypeTest to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the OneOfPrimitiveTypeTest. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize OneOfPrimitiveTypeTest to JSON. - #' - #' @return JSON representation of the OneOfPrimitiveTypeTest. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert OneOfPrimitiveTypeTest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index d8a82a3de40d..5aad96282a11 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -89,10 +89,10 @@ Order <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -108,6 +108,14 @@ Order <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Order to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { OrderObject <- list() if (!is.null(self$`id`)) { OrderObject[["id"]] <- @@ -181,21 +189,15 @@ Order <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Order in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 991beb2cee9e..952b061b0258 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -85,10 +85,10 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -104,6 +104,14 @@ Pet <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pet to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetObject <- list() if (!is.null(self$`id`)) { PetObject[["id"]] <- @@ -111,7 +119,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`category`)) { PetObject[["category"]] <- - self$`category`$toList() + self$`category`$toSimpleType() } if (!is.null(self$`name`)) { PetObject[["name"]] <- @@ -123,7 +131,7 @@ Pet <- R6::R6Class( } if (!is.null(self$`tags`)) { PetObject[["tags"]] <- - lapply(self$`tags`, function(x) x$toList()) + lapply(self$`tags`, function(x) x$toSimpleType()) } if (!is.null(self$`status`)) { PetObject[["status"]] <- @@ -179,21 +187,15 @@ Pet <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Pet in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/pet_map.R b/samples/client/petstore/R/R/pet_map.R index 7e10a74a873b..2f1cd3c3b732 100644 --- a/samples/client/petstore/R/R/pet_map.R +++ b/samples/client/petstore/R/R/pet_map.R @@ -40,10 +40,10 @@ PetMap <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -59,6 +59,14 @@ PetMap <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert PetMap to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { PetMapObject <- list() if (!is.null(self$`pet`)) { PetMapObject[["pet"]] <- @@ -94,21 +102,15 @@ PetMap <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return PetMap in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/pig.R b/samples/client/petstore/R/R/pig.R index 596a9307d4dc..bda5505b0e3c 100644 --- a/samples/client/petstore/R/R/pig.R +++ b/samples/client/petstore/R/R/pig.R @@ -109,25 +109,35 @@ Pig <- R6::R6Class( #' @description #' Serialize Pig to JSON string. - #' + #' + #' @param ... Parameters passed to `jsonlite::toJSON` #' @return JSON string representation of the Pig. - toJSONString = function() { + toJSONString = function(...) { + simple <- self$toSimpleType() if (!is.null(self$actual_instance)) { - as.character(jsonlite::minify(self$actual_instance$toJSONString())) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...) + return(as.character(jsonlite::minify(json))) } else { - NULL + return(NULL) } }, #' @description - #' Serialize Pig to JSON. - #' - #' @return JSON representation of the Pig. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) + }, + + #' @description + #' Convert Pig to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { if (!is.null(self$actual_instance)) { - self$actual_instance$toJSON() + return(self$actual_instance$toSimpleType()) } else { - NULL + return(NULL) } }, diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index 4257a85da203..251d7a203a4b 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -97,10 +97,10 @@ Special <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -116,6 +116,14 @@ Special <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Special to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { SpecialObject <- list() if (!is.null(self$`set_test`)) { SpecialObject[["set_test"]] <- @@ -196,21 +204,15 @@ Special <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Special in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index 95f6072f617f..f70547525154 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -50,10 +50,10 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -69,6 +69,14 @@ Tag <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Tag to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { TagObject <- list() if (!is.null(self$`id`)) { TagObject[["id"]] <- @@ -111,21 +119,15 @@ Tag <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Tag in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index 357845b71f6f..071d4c2b13a1 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -45,10 +45,10 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -64,10 +64,18 @@ UpdatePetRequest <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert UpdatePetRequest to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { UpdatePetRequestObject <- list() if (!is.null(self$`jsonData`)) { UpdatePetRequestObject[["jsonData"]] <- - self$`jsonData`$toList() + self$`jsonData`$toSimpleType() } if (!is.null(self$`binaryDataN2Information`)) { UpdatePetRequestObject[["binaryDataN2Information"]] <- @@ -108,21 +116,15 @@ UpdatePetRequest <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return UpdatePetRequest in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index b99d4a9a0250..4fdd141e6764 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -104,10 +104,10 @@ User <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -123,6 +123,14 @@ User <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert User to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { UserObject <- list() if (!is.null(self$`id`)) { UserObject[["id"]] <- @@ -207,21 +215,15 @@ User <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return User in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/whale.R b/samples/client/petstore/R/R/whale.R index 0e22bb97389f..0699335bf804 100644 --- a/samples/client/petstore/R/R/whale.R +++ b/samples/client/petstore/R/R/whale.R @@ -59,10 +59,10 @@ Whale <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -78,6 +78,14 @@ Whale <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Whale to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { WhaleObject <- list() if (!is.null(self$`hasBaleen`)) { WhaleObject[["hasBaleen"]] <- @@ -127,21 +135,15 @@ Whale <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Whale in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/R/zebra.R b/samples/client/petstore/R/R/zebra.R index 7bfcddc488c3..946b44b767ae 100644 --- a/samples/client/petstore/R/R/zebra.R +++ b/samples/client/petstore/R/R/zebra.R @@ -53,10 +53,10 @@ Zebra <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toList()` instead. + #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toList", msg = "Use the '$toList()' method instead since that is more learly named. Use '$toJSONstring()' to get a JSON string") - return(self$toList()) + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + return(self$toSimpleType()) }, #' @description @@ -72,6 +72,14 @@ Zebra <- R6::R6Class( #' df #' } toList = function() { + return(self$toSimpleType()) + }, + + #' @description + #' Convert Zebra to a base R type + #' + #' @return A base R type, e.g. a list or numeric/character array. + toSimpleType = function() { ZebraObject <- list() if (!is.null(self$`type`)) { ZebraObject[["type"]] <- @@ -117,21 +125,15 @@ Zebra <- R6::R6Class( #' @description #' To JSON String #' - #' @param minify Logical. If `TRUE` remove all indentation and white space #' @param ... Parameters passed to `jsonlite::toJSON` #' @return Zebra in JSON format - toJSONString = function(minify = TRUE, ...) { - json_obj <- self$toList() - + toJSONString = function(...) { + simple <- self$toSimpleType() for (key in names(self$additional_properties)) { - json_obj[[key]] <- self$additional_properties[[key]] - } - - json_string <- jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA, ...) - if (minify) { - json_string <- jsonlite::minify(json_string) + simple[[key]] <- self$additional_properties[[key]] } - return(as.character(json_string)) + json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...) + return(as.character(jsonlite::minify(json))) }, #' @description diff --git a/samples/client/petstore/R/tests/testthat/test_petstore.R b/samples/client/petstore/R/tests/testthat/test_petstore.R index f7a70df4f9d5..641e2cbb2751 100644 --- a/samples/client/petstore/R/tests/testthat/test_petstore.R +++ b/samples/client/petstore/R/tests/testthat/test_petstore.R @@ -42,7 +42,7 @@ test_that("Test FindPetByStatus", { test_that("Test toJSON toJSONString fromJSON fromJSONString", { pet0 <- Pet$new() - jsonpet <- pet0$toJSON() + jsonpet <- pet0$toSimpleType() pet2 <- pet0$fromJSON( jsonlite::toJSON(jsonpet, auto_unbox = TRUE) ) @@ -68,7 +68,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", { ), status = "available" ) - jsonpet <- pet1$toJSON() + jsonpet <- pet1$toSimpleType() pet2 <- pet1$fromJSON( jsonlite::toJSON(jsonpet, auto_unbox = TRUE) ) @@ -90,7 +90,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", { test_that("Test Category", { c1 <- Category$new(id = 450, name = "test_cat") c2 <- Category$new() - c2$fromJSON(jsonlite::toJSON(c1$toJSON(), auto_unbox = TRUE)) + c2$fromJSON(jsonlite::toJSON(c1$toSimpleType(), auto_unbox = TRUE)) expect_equal(c1, c2) c2$fromJSONString(c1$toJSONString()) expect_equal(c1, c2) From 6b9ceddcd529b5dfddcf68d264df1bd4a081a7a5 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Thu, 21 Nov 2024 12:47:30 -0500 Subject: [PATCH 5/7] regenerate samples --- .../openapi-generator/src/main/resources/r/modelAnyOf.mustache | 2 +- .../openapi-generator/src/main/resources/r/modelEnum.mustache | 2 +- .../src/main/resources/r/modelGeneric.mustache | 2 +- .../openapi-generator/src/main/resources/r/modelOneOf.mustache | 2 +- samples/client/echo_api/r/R/bird.R | 2 +- samples/client/echo_api/r/R/category.R | 2 +- samples/client/echo_api/r/R/data_query.R | 2 +- samples/client/echo_api/r/R/default_value.R | 2 +- samples/client/echo_api/r/R/number_properties_only.R | 2 +- samples/client/echo_api/r/R/pet.R | 2 +- samples/client/echo_api/r/R/query.R | 2 +- samples/client/echo_api/r/R/string_enum_ref.R | 2 +- samples/client/echo_api/r/R/tag.R | 2 +- .../echo_api/r/R/test_form_object_multipart_request_marker.R | 2 +- ...p_object_explode_true_object_all_of_query_object_parameter.R | 2 +- ...tyle_form_explode_true_array_string_query_object_parameter.R | 2 +- .../client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/animal.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R | 2 +- .../petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/basque_pig.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/cat.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/category.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/danish_pig.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/date.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/dog.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/dummy_model.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/format_test.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/mammal.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/model_api_response.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R | 2 +- .../petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/order.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/pet.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/pet_map.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/pig.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/special.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/tag.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/user.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/whale.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/zebra.R | 2 +- samples/client/petstore/R-httr2/R/allof_tag_api_response.R | 2 +- samples/client/petstore/R-httr2/R/animal.R | 2 +- samples/client/petstore/R-httr2/R/any_of_pig.R | 2 +- samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2/R/api_client.R | 2 +- samples/client/petstore/R-httr2/R/basque_pig.R | 2 +- samples/client/petstore/R-httr2/R/cat.R | 2 +- samples/client/petstore/R-httr2/R/category.R | 2 +- samples/client/petstore/R-httr2/R/danish_pig.R | 2 +- samples/client/petstore/R-httr2/R/date.R | 2 +- samples/client/petstore/R-httr2/R/dog.R | 2 +- samples/client/petstore/R-httr2/R/format_test.R | 2 +- samples/client/petstore/R-httr2/R/just_model.R | 2 +- samples/client/petstore/R-httr2/R/mammal.R | 2 +- samples/client/petstore/R-httr2/R/model_api_response.R | 2 +- samples/client/petstore/R-httr2/R/nested_one_of.R | 2 +- samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2/R/order.R | 2 +- samples/client/petstore/R-httr2/R/pet.R | 2 +- samples/client/petstore/R-httr2/R/pet_map.R | 2 +- samples/client/petstore/R-httr2/R/pig.R | 2 +- samples/client/petstore/R-httr2/R/special.R | 2 +- samples/client/petstore/R-httr2/R/tag.R | 2 +- samples/client/petstore/R-httr2/R/update_pet_request.R | 2 +- samples/client/petstore/R-httr2/R/user.R | 2 +- samples/client/petstore/R-httr2/R/whale.R | 2 +- samples/client/petstore/R-httr2/R/zebra.R | 2 +- samples/client/petstore/R/R/allof_tag_api_response.R | 2 +- samples/client/petstore/R/R/animal.R | 2 +- samples/client/petstore/R/R/any_of_pig.R | 2 +- samples/client/petstore/R/R/any_of_primitive_type_test.R | 2 +- samples/client/petstore/R/R/basque_pig.R | 2 +- samples/client/petstore/R/R/cat.R | 2 +- samples/client/petstore/R/R/category.R | 2 +- samples/client/petstore/R/R/danish_pig.R | 2 +- samples/client/petstore/R/R/date.R | 2 +- samples/client/petstore/R/R/dog.R | 2 +- samples/client/petstore/R/R/dummy_model.R | 2 +- samples/client/petstore/R/R/format_test.R | 2 +- samples/client/petstore/R/R/mammal.R | 2 +- samples/client/petstore/R/R/model_api_response.R | 2 +- samples/client/petstore/R/R/nested_one_of.R | 2 +- samples/client/petstore/R/R/one_of_primitive_type_test.R | 2 +- samples/client/petstore/R/R/order.R | 2 +- samples/client/petstore/R/R/pet.R | 2 +- samples/client/petstore/R/R/pet_map.R | 2 +- samples/client/petstore/R/R/pig.R | 2 +- samples/client/petstore/R/R/special.R | 2 +- samples/client/petstore/R/R/tag.R | 2 +- samples/client/petstore/R/R/update_pet_request.R | 2 +- samples/client/petstore/R/R/user.R | 2 +- samples/client/petstore/R/R/whale.R | 2 +- samples/client/petstore/R/R/zebra.R | 2 +- 95 files changed, 95 insertions(+), 95 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache b/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache index c21378021fc5..fcaca0d85681 100644 --- a/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache @@ -86,7 +86,7 @@ }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/modules/openapi-generator/src/main/resources/r/modelEnum.mustache b/modules/openapi-generator/src/main/resources/r/modelEnum.mustache index 9f865e01ea4e..0589f8073c4e 100644 --- a/modules/openapi-generator/src/main/resources/r/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelEnum.mustache @@ -38,7 +38,7 @@ }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index 7c932ab4d481..a27fb43e45a9 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -203,7 +203,7 @@ }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache index eddcf7eaa30c..87f7859766bc 100644 --- a/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache @@ -153,7 +153,7 @@ }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R index 6a6009390c67..5ed63c53bc3a 100644 --- a/samples/client/echo_api/r/R/bird.R +++ b/samples/client/echo_api/r/R/bird.R @@ -40,7 +40,7 @@ Bird <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R index a64675884f51..9d9b611baac9 100644 --- a/samples/client/echo_api/r/R/category.R +++ b/samples/client/echo_api/r/R/category.R @@ -40,7 +40,7 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R index 42920cdfb16b..3e42b42f56b3 100644 --- a/samples/client/echo_api/r/R/data_query.R +++ b/samples/client/echo_api/r/R/data_query.R @@ -67,7 +67,7 @@ DataQuery <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R index 375e0ae0c4b5..643ce97b3ea3 100644 --- a/samples/client/echo_api/r/R/default_value.R +++ b/samples/client/echo_api/r/R/default_value.R @@ -87,7 +87,7 @@ DefaultValue <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R index c368831c4306..6f3e1662a977 100644 --- a/samples/client/echo_api/r/R/number_properties_only.R +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -46,7 +46,7 @@ NumberPropertiesOnly <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R index a708db2bfdf2..83a517e7c39e 100644 --- a/samples/client/echo_api/r/R/pet.R +++ b/samples/client/echo_api/r/R/pet.R @@ -75,7 +75,7 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R index fc4fa18bae2f..6d7a2ebf0fe5 100644 --- a/samples/client/echo_api/r/R/query.R +++ b/samples/client/echo_api/r/R/query.R @@ -39,7 +39,7 @@ Query <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/string_enum_ref.R b/samples/client/echo_api/r/R/string_enum_ref.R index 7e2865080c2c..4ebf1811debb 100644 --- a/samples/client/echo_api/r/R/string_enum_ref.R +++ b/samples/client/echo_api/r/R/string_enum_ref.R @@ -37,7 +37,7 @@ StringEnumRef <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R index 73ccbfa95560..25c30d5d09a5 100644 --- a/samples/client/echo_api/r/R/tag.R +++ b/samples/client/echo_api/r/R/tag.R @@ -40,7 +40,7 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R index 69f4600d71ba..f895f4122f29 100644 --- a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -31,7 +31,7 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R index fa54e2db56d5..e5c6fea9d537 100644 --- a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -58,7 +58,7 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R index e8254d81be69..575ffd309e4f 100644 --- a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -30,7 +30,7 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R index 3f49711346c1..bdcec7fc2635 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R @@ -77,7 +77,7 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/animal.R b/samples/client/petstore/R-httr2-wrapper/R/animal.R index ed2345cf0c37..bcc8a8e04955 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/animal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/animal.R @@ -52,7 +52,7 @@ Animal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R b/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R index 8dc5f870441a..fdef3fb4a6d4 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R @@ -91,7 +91,7 @@ AnyOfPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R b/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R index da3c94ba534e..527200bfaece 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R @@ -125,7 +125,7 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R index 7b723e1e16f2..e414ea3fcda6 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R @@ -50,7 +50,7 @@ BasquePig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/cat.R b/samples/client/petstore/R-httr2-wrapper/R/cat.R index 71ae84011f2d..66fe7758be1b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/cat.R +++ b/samples/client/petstore/R-httr2-wrapper/R/cat.R @@ -60,7 +60,7 @@ Cat <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/category.R b/samples/client/petstore/R-httr2-wrapper/R/category.R index 60f30ed3d590..753ede681c05 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/category.R +++ b/samples/client/petstore/R-httr2-wrapper/R/category.R @@ -50,7 +50,7 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R index 3a1006b949d5..27b07b03da46 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R @@ -50,7 +50,7 @@ DanishPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/date.R b/samples/client/petstore/R-httr2-wrapper/R/date.R index de4b63119a69..572c3f1dd3f9 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/date.R +++ b/samples/client/petstore/R-httr2-wrapper/R/date.R @@ -63,7 +63,7 @@ Date <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/dog.R b/samples/client/petstore/R-httr2-wrapper/R/dog.R index 4ac98c3001ad..aceb2be15c8d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dog.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dog.R @@ -60,7 +60,7 @@ Dog <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R index cefc60d560b7..1a15f463ced8 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R @@ -41,7 +41,7 @@ DummyModel <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/format_test.R b/samples/client/petstore/R-httr2-wrapper/R/format_test.R index ba23603c71d3..d89c0bb52962 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/format_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/format_test.R @@ -158,7 +158,7 @@ FormatTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/mammal.R b/samples/client/petstore/R-httr2-wrapper/R/mammal.R index 22f5add3f711..c20a9a4f672d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/mammal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/mammal.R @@ -149,7 +149,7 @@ Mammal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R index c957460a980a..a10d7ac6b39c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R @@ -59,7 +59,7 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index be617dc2b654..261b87f409b2 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -48,7 +48,7 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R b/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R index 04e5675405d5..7d913427c788 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R @@ -125,7 +125,7 @@ OneOfPrimitiveTypeTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/order.R b/samples/client/petstore/R-httr2-wrapper/R/order.R index 5aad96282a11..61ceefd6fe05 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/order.R +++ b/samples/client/petstore/R-httr2-wrapper/R/order.R @@ -89,7 +89,7 @@ Order <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet.R b/samples/client/petstore/R-httr2-wrapper/R/pet.R index 952b061b0258..b0e158bf7ddc 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet.R @@ -85,7 +85,7 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R index 2f1cd3c3b732..001fe86fb104 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R @@ -40,7 +40,7 @@ PetMap <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/pig.R b/samples/client/petstore/R-httr2-wrapper/R/pig.R index 53ce25eb1b22..520b6efd760b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pig.R @@ -149,7 +149,7 @@ Pig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/special.R b/samples/client/petstore/R-httr2-wrapper/R/special.R index 251d7a203a4b..ad15ad8664b3 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/special.R +++ b/samples/client/petstore/R-httr2-wrapper/R/special.R @@ -97,7 +97,7 @@ Special <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/tag.R b/samples/client/petstore/R-httr2-wrapper/R/tag.R index f70547525154..22370cfca973 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/tag.R +++ b/samples/client/petstore/R-httr2-wrapper/R/tag.R @@ -50,7 +50,7 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R index 071d4c2b13a1..e191d65cf902 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R @@ -45,7 +45,7 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/user.R b/samples/client/petstore/R-httr2-wrapper/R/user.R index 4fdd141e6764..c4a273fb57fe 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user.R @@ -104,7 +104,7 @@ User <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/whale.R b/samples/client/petstore/R-httr2-wrapper/R/whale.R index 0699335bf804..0fc23964d616 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/whale.R +++ b/samples/client/petstore/R-httr2-wrapper/R/whale.R @@ -59,7 +59,7 @@ Whale <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2-wrapper/R/zebra.R b/samples/client/petstore/R-httr2-wrapper/R/zebra.R index 946b44b767ae..46e56453274e 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/zebra.R +++ b/samples/client/petstore/R-httr2-wrapper/R/zebra.R @@ -53,7 +53,7 @@ Zebra <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index 64a169313a54..86cbfb3943fd 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -67,7 +67,7 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 5fe021c26521..6bca8bd4df6d 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -42,7 +42,7 @@ Animal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/any_of_pig.R b/samples/client/petstore/R-httr2/R/any_of_pig.R index 8dc5f870441a..fdef3fb4a6d4 100644 --- a/samples/client/petstore/R-httr2/R/any_of_pig.R +++ b/samples/client/petstore/R-httr2/R/any_of_pig.R @@ -91,7 +91,7 @@ AnyOfPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R b/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R index da3c94ba534e..527200bfaece 100644 --- a/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R @@ -125,7 +125,7 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/api_client.R b/samples/client/petstore/R-httr2/R/api_client.R index 05ce9da6d244..9c5bba767310 100644 --- a/samples/client/petstore/R-httr2/R/api_client.R +++ b/samples/client/petstore/R-httr2/R/api_client.R @@ -46,7 +46,7 @@ ApiClient <- R6::R6Class( "ApiClient", public = list( # base path of all requests - base_path = "http://localhost/v2", + base_path = "http://petstore.swagger.io/v2", # user agent in the HTTP request user_agent = "PetstoreAgent", # default headers in the HTTP request diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 0925ffa5cfca..7d9e47714d7d 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -40,7 +40,7 @@ BasquePig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index a849a85b3a64..d31568ba827e 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -50,7 +50,7 @@ Cat <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index c28dd249d4e6..ed6af1879258 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -40,7 +40,7 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index 9c13b5944ae1..3e6b13ca848f 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -40,7 +40,7 @@ DanishPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/date.R b/samples/client/petstore/R-httr2/R/date.R index 20f637ef55f1..78e163874a0e 100644 --- a/samples/client/petstore/R-httr2/R/date.R +++ b/samples/client/petstore/R-httr2/R/date.R @@ -53,7 +53,7 @@ Date <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 71897115af32..2b4ec4dfbb65 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -50,7 +50,7 @@ Dog <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/format_test.R b/samples/client/petstore/R-httr2/R/format_test.R index 0ee8e63fe4e0..eaef7016c881 100644 --- a/samples/client/petstore/R-httr2/R/format_test.R +++ b/samples/client/petstore/R-httr2/R/format_test.R @@ -148,7 +148,7 @@ FormatTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/just_model.R b/samples/client/petstore/R-httr2/R/just_model.R index 0db76a8c5a65..081c1c99d162 100644 --- a/samples/client/petstore/R-httr2/R/just_model.R +++ b/samples/client/petstore/R-httr2/R/just_model.R @@ -31,7 +31,7 @@ JustModel <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/mammal.R b/samples/client/petstore/R-httr2/R/mammal.R index a330ccda7bf5..19909a4b2c06 100644 --- a/samples/client/petstore/R-httr2/R/mammal.R +++ b/samples/client/petstore/R-httr2/R/mammal.R @@ -123,7 +123,7 @@ Mammal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index c4c0a3e131f7..367a8ea08c29 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -49,7 +49,7 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index 30b245973ade..aed7e43ea11f 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -38,7 +38,7 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R b/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R index 04e5675405d5..7d913427c788 100644 --- a/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R @@ -125,7 +125,7 @@ OneOfPrimitiveTypeTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index 9018d9d27763..f7dbf1266364 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -79,7 +79,7 @@ Order <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index 03ec24ff0e04..dbf65c83b529 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -75,7 +75,7 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/pet_map.R b/samples/client/petstore/R-httr2/R/pet_map.R index 371534ae064f..24f7554ca244 100644 --- a/samples/client/petstore/R-httr2/R/pet_map.R +++ b/samples/client/petstore/R-httr2/R/pet_map.R @@ -30,7 +30,7 @@ PetMap <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/pig.R b/samples/client/petstore/R-httr2/R/pig.R index bda5505b0e3c..702eb529f58f 100644 --- a/samples/client/petstore/R-httr2/R/pig.R +++ b/samples/client/petstore/R-httr2/R/pig.R @@ -123,7 +123,7 @@ Pig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index 5dab22bb2366..9d2ebba2eabd 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -87,7 +87,7 @@ Special <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index 11ab8f75c24b..2fdc3a61b312 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -40,7 +40,7 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index cedbd62dfa8b..7312ae6be59f 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -35,7 +35,7 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index 1163e984dc50..4f8b2005d91e 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -94,7 +94,7 @@ User <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/whale.R b/samples/client/petstore/R-httr2/R/whale.R index a6ee888ddce7..7e8e89644da7 100644 --- a/samples/client/petstore/R-httr2/R/whale.R +++ b/samples/client/petstore/R-httr2/R/whale.R @@ -49,7 +49,7 @@ Whale <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R-httr2/R/zebra.R b/samples/client/petstore/R-httr2/R/zebra.R index 479e71c17b1a..9b86bf121637 100644 --- a/samples/client/petstore/R-httr2/R/zebra.R +++ b/samples/client/petstore/R-httr2/R/zebra.R @@ -43,7 +43,7 @@ Zebra <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index 3f49711346c1..bdcec7fc2635 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -77,7 +77,7 @@ AllofTagApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index ed2345cf0c37..bcc8a8e04955 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -52,7 +52,7 @@ Animal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/any_of_pig.R b/samples/client/petstore/R/R/any_of_pig.R index 8dc5f870441a..fdef3fb4a6d4 100644 --- a/samples/client/petstore/R/R/any_of_pig.R +++ b/samples/client/petstore/R/R/any_of_pig.R @@ -91,7 +91,7 @@ AnyOfPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/any_of_primitive_type_test.R b/samples/client/petstore/R/R/any_of_primitive_type_test.R index da3c94ba534e..527200bfaece 100644 --- a/samples/client/petstore/R/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R/R/any_of_primitive_type_test.R @@ -125,7 +125,7 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index 7b723e1e16f2..e414ea3fcda6 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -50,7 +50,7 @@ BasquePig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index 71ae84011f2d..66fe7758be1b 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -60,7 +60,7 @@ Cat <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 60f30ed3d590..753ede681c05 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -50,7 +50,7 @@ Category <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index 3a1006b949d5..27b07b03da46 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -50,7 +50,7 @@ DanishPig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/date.R b/samples/client/petstore/R/R/date.R index de4b63119a69..572c3f1dd3f9 100644 --- a/samples/client/petstore/R/R/date.R +++ b/samples/client/petstore/R/R/date.R @@ -63,7 +63,7 @@ Date <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index 4ac98c3001ad..aceb2be15c8d 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -60,7 +60,7 @@ Dog <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/dummy_model.R b/samples/client/petstore/R/R/dummy_model.R index cefc60d560b7..1a15f463ced8 100644 --- a/samples/client/petstore/R/R/dummy_model.R +++ b/samples/client/petstore/R/R/dummy_model.R @@ -41,7 +41,7 @@ DummyModel <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/format_test.R b/samples/client/petstore/R/R/format_test.R index ba23603c71d3..d89c0bb52962 100644 --- a/samples/client/petstore/R/R/format_test.R +++ b/samples/client/petstore/R/R/format_test.R @@ -158,7 +158,7 @@ FormatTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/mammal.R b/samples/client/petstore/R/R/mammal.R index a330ccda7bf5..19909a4b2c06 100644 --- a/samples/client/petstore/R/R/mammal.R +++ b/samples/client/petstore/R/R/mammal.R @@ -123,7 +123,7 @@ Mammal <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index c957460a980a..a10d7ac6b39c 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -59,7 +59,7 @@ ModelApiResponse <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index be617dc2b654..261b87f409b2 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -48,7 +48,7 @@ NestedOneOf <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/one_of_primitive_type_test.R b/samples/client/petstore/R/R/one_of_primitive_type_test.R index 04e5675405d5..7d913427c788 100644 --- a/samples/client/petstore/R/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R/R/one_of_primitive_type_test.R @@ -125,7 +125,7 @@ OneOfPrimitiveTypeTest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 5aad96282a11..61ceefd6fe05 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -89,7 +89,7 @@ Order <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 952b061b0258..b0e158bf7ddc 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -85,7 +85,7 @@ Pet <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/pet_map.R b/samples/client/petstore/R/R/pet_map.R index 2f1cd3c3b732..001fe86fb104 100644 --- a/samples/client/petstore/R/R/pet_map.R +++ b/samples/client/petstore/R/R/pet_map.R @@ -40,7 +40,7 @@ PetMap <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/pig.R b/samples/client/petstore/R/R/pig.R index bda5505b0e3c..702eb529f58f 100644 --- a/samples/client/petstore/R/R/pig.R +++ b/samples/client/petstore/R/R/pig.R @@ -123,7 +123,7 @@ Pig <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index 251d7a203a4b..ad15ad8664b3 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -97,7 +97,7 @@ Special <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index f70547525154..22370cfca973 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -50,7 +50,7 @@ Tag <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index 071d4c2b13a1..e191d65cf902 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -45,7 +45,7 @@ UpdatePetRequest <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index 4fdd141e6764..c4a273fb57fe 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -104,7 +104,7 @@ User <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/whale.R b/samples/client/petstore/R/R/whale.R index 0699335bf804..0fc23964d616 100644 --- a/samples/client/petstore/R/R/whale.R +++ b/samples/client/petstore/R/R/whale.R @@ -59,7 +59,7 @@ Whale <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) diff --git a/samples/client/petstore/R/R/zebra.R b/samples/client/petstore/R/R/zebra.R index 946b44b767ae..46e56453274e 100644 --- a/samples/client/petstore/R/R/zebra.R +++ b/samples/client/petstore/R/R/zebra.R @@ -53,7 +53,7 @@ Zebra <- R6::R6Class( }, #' @description - #' Convert to a list. This method was misnamed, it actually returns a list. Use `toSimpleType()` instead. + #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) From 90145b617fe2134be7350f9ef907fe29f9818357 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Mon, 25 Nov 2024 16:52:36 -0500 Subject: [PATCH 6/7] update to-dataframe example to use non-superceded tidyverse functions --- .../src/main/resources/r/modelGeneric.mustache | 4 +++- samples/client/echo_api/r/R/bird.R | 4 +++- samples/client/echo_api/r/R/category.R | 4 +++- samples/client/echo_api/r/R/data_query.R | 4 +++- samples/client/echo_api/r/R/default_value.R | 4 +++- samples/client/echo_api/r/R/number_properties_only.R | 4 +++- samples/client/echo_api/r/R/pet.R | 4 +++- samples/client/echo_api/r/R/query.R | 4 +++- samples/client/echo_api/r/R/tag.R | 4 +++- .../echo_api/r/R/test_form_object_multipart_request_marker.R | 4 +++- ...object_explode_true_object_all_of_query_object_parameter.R | 4 +++- ...le_form_explode_true_array_string_query_object_parameter.R | 4 +++- .../petstore/R-httr2-wrapper/R/allof_tag_api_response.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/animal.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/basque_pig.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/cat.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/category.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/danish_pig.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/date.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/dog.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/dummy_model.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/format_test.R | 4 +++- .../client/petstore/R-httr2-wrapper/R/model_api_response.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/order.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/pet.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/pet_map.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/special.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/tag.R | 4 +++- .../client/petstore/R-httr2-wrapper/R/update_pet_request.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/user.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/whale.R | 4 +++- samples/client/petstore/R-httr2-wrapper/R/zebra.R | 4 +++- samples/client/petstore/R-httr2/R/allof_tag_api_response.R | 4 +++- samples/client/petstore/R-httr2/R/animal.R | 4 +++- samples/client/petstore/R-httr2/R/basque_pig.R | 4 +++- samples/client/petstore/R-httr2/R/cat.R | 4 +++- samples/client/petstore/R-httr2/R/category.R | 4 +++- samples/client/petstore/R-httr2/R/danish_pig.R | 4 +++- samples/client/petstore/R-httr2/R/date.R | 4 +++- samples/client/petstore/R-httr2/R/dog.R | 4 +++- samples/client/petstore/R-httr2/R/format_test.R | 4 +++- samples/client/petstore/R-httr2/R/just_model.R | 4 +++- samples/client/petstore/R-httr2/R/model_api_response.R | 4 +++- samples/client/petstore/R-httr2/R/nested_one_of.R | 4 +++- samples/client/petstore/R-httr2/R/order.R | 4 +++- samples/client/petstore/R-httr2/R/pet.R | 4 +++- samples/client/petstore/R-httr2/R/pet_map.R | 4 +++- samples/client/petstore/R-httr2/R/special.R | 4 +++- samples/client/petstore/R-httr2/R/tag.R | 4 +++- samples/client/petstore/R-httr2/R/update_pet_request.R | 4 +++- samples/client/petstore/R-httr2/R/user.R | 4 +++- samples/client/petstore/R-httr2/R/whale.R | 4 +++- samples/client/petstore/R-httr2/R/zebra.R | 4 +++- samples/client/petstore/R/R/allof_tag_api_response.R | 4 +++- samples/client/petstore/R/R/animal.R | 4 +++- samples/client/petstore/R/R/basque_pig.R | 4 +++- samples/client/petstore/R/R/cat.R | 4 +++- samples/client/petstore/R/R/category.R | 4 +++- samples/client/petstore/R/R/danish_pig.R | 4 +++- samples/client/petstore/R/R/date.R | 4 +++- samples/client/petstore/R/R/dog.R | 4 +++- samples/client/petstore/R/R/dummy_model.R | 4 +++- samples/client/petstore/R/R/format_test.R | 4 +++- samples/client/petstore/R/R/model_api_response.R | 4 +++- samples/client/petstore/R/R/nested_one_of.R | 4 +++- samples/client/petstore/R/R/order.R | 4 +++- samples/client/petstore/R/R/pet.R | 4 +++- samples/client/petstore/R/R/pet_map.R | 4 +++- samples/client/petstore/R/R/special.R | 4 +++- samples/client/petstore/R/R/tag.R | 4 +++- samples/client/petstore/R/R/update_pet_request.R | 4 +++- samples/client/petstore/R/R/user.R | 4 +++- samples/client/petstore/R/R/whale.R | 4 +++- samples/client/petstore/R/R/zebra.R | 4 +++- 75 files changed, 225 insertions(+), 75 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index a27fb43e45a9..675d7de605e4 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -218,7 +218,9 @@ #' @examples #' # convert array of {{{classname}}} (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R index 5ed63c53bc3a..7a180ef11e0f 100644 --- a/samples/client/echo_api/r/R/bird.R +++ b/samples/client/echo_api/r/R/bird.R @@ -55,7 +55,9 @@ Bird <- R6::R6Class( #' @examples #' # convert array of Bird (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R index 9d9b611baac9..b4ae39ba2cdf 100644 --- a/samples/client/echo_api/r/R/category.R +++ b/samples/client/echo_api/r/R/category.R @@ -55,7 +55,9 @@ Category <- R6::R6Class( #' @examples #' # convert array of Category (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R index 3e42b42f56b3..0fa519f753e4 100644 --- a/samples/client/echo_api/r/R/data_query.R +++ b/samples/client/echo_api/r/R/data_query.R @@ -82,7 +82,9 @@ DataQuery <- R6::R6Class( #' @examples #' # convert array of DataQuery (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R index 643ce97b3ea3..4ed97e9c7b37 100644 --- a/samples/client/echo_api/r/R/default_value.R +++ b/samples/client/echo_api/r/R/default_value.R @@ -102,7 +102,9 @@ DefaultValue <- R6::R6Class( #' @examples #' # convert array of DefaultValue (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R index 6f3e1662a977..2fabbeb350b2 100644 --- a/samples/client/echo_api/r/R/number_properties_only.R +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -61,7 +61,9 @@ NumberPropertiesOnly <- R6::R6Class( #' @examples #' # convert array of NumberPropertiesOnly (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R index 83a517e7c39e..2f8002179fc4 100644 --- a/samples/client/echo_api/r/R/pet.R +++ b/samples/client/echo_api/r/R/pet.R @@ -90,7 +90,9 @@ Pet <- R6::R6Class( #' @examples #' # convert array of Pet (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R index 6d7a2ebf0fe5..c5725669d8ee 100644 --- a/samples/client/echo_api/r/R/query.R +++ b/samples/client/echo_api/r/R/query.R @@ -54,7 +54,9 @@ Query <- R6::R6Class( #' @examples #' # convert array of Query (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R index 25c30d5d09a5..06cb6900b9d5 100644 --- a/samples/client/echo_api/r/R/tag.R +++ b/samples/client/echo_api/r/R/tag.R @@ -55,7 +55,9 @@ Tag <- R6::R6Class( #' @examples #' # convert array of Tag (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R index f895f4122f29..42d3a1701562 100644 --- a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -46,7 +46,9 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( #' @examples #' # convert array of TestFormObjectMultipartRequestMarker (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R index e5c6fea9d537..f804c0f4e7a4 100644 --- a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -73,7 +73,9 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas #' @examples #' # convert array of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R index 575ffd309e4f..a2481e602e2a 100644 --- a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -45,7 +45,9 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( #' @examples #' # convert array of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R index bdcec7fc2635..b05a56bc1337 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R @@ -92,7 +92,9 @@ AllofTagApiResponse <- R6::R6Class( #' @examples #' # convert array of AllofTagApiResponse (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/animal.R b/samples/client/petstore/R-httr2-wrapper/R/animal.R index bcc8a8e04955..186f4b522a8d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/animal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/animal.R @@ -67,7 +67,9 @@ Animal <- R6::R6Class( #' @examples #' # convert array of Animal (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R index e414ea3fcda6..117e4430dc6a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R @@ -65,7 +65,9 @@ BasquePig <- R6::R6Class( #' @examples #' # convert array of BasquePig (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/cat.R b/samples/client/petstore/R-httr2-wrapper/R/cat.R index 66fe7758be1b..d9de174efa10 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/cat.R +++ b/samples/client/petstore/R-httr2-wrapper/R/cat.R @@ -75,7 +75,9 @@ Cat <- R6::R6Class( #' @examples #' # convert array of Cat (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/category.R b/samples/client/petstore/R-httr2-wrapper/R/category.R index 753ede681c05..2f476b8b171c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/category.R +++ b/samples/client/petstore/R-httr2-wrapper/R/category.R @@ -65,7 +65,9 @@ Category <- R6::R6Class( #' @examples #' # convert array of Category (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R index 27b07b03da46..a3e1a1d84b2f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R @@ -65,7 +65,9 @@ DanishPig <- R6::R6Class( #' @examples #' # convert array of DanishPig (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/date.R b/samples/client/petstore/R-httr2-wrapper/R/date.R index 572c3f1dd3f9..a1f8285489ee 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/date.R +++ b/samples/client/petstore/R-httr2-wrapper/R/date.R @@ -78,7 +78,9 @@ Date <- R6::R6Class( #' @examples #' # convert array of Date (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/dog.R b/samples/client/petstore/R-httr2-wrapper/R/dog.R index aceb2be15c8d..8563193e9358 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dog.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dog.R @@ -75,7 +75,9 @@ Dog <- R6::R6Class( #' @examples #' # convert array of Dog (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R index 1a15f463ced8..bbf7c149086f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R @@ -56,7 +56,9 @@ DummyModel <- R6::R6Class( #' @examples #' # convert array of DummyModel (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/format_test.R b/samples/client/petstore/R-httr2-wrapper/R/format_test.R index d89c0bb52962..199facda8a3c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/format_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/format_test.R @@ -173,7 +173,9 @@ FormatTest <- R6::R6Class( #' @examples #' # convert array of FormatTest (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R index a10d7ac6b39c..bc059800ddf7 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R @@ -74,7 +74,9 @@ ModelApiResponse <- R6::R6Class( #' @examples #' # convert array of ModelApiResponse (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index 261b87f409b2..da38df94fe12 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -63,7 +63,9 @@ NestedOneOf <- R6::R6Class( #' @examples #' # convert array of NestedOneOf (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/order.R b/samples/client/petstore/R-httr2-wrapper/R/order.R index 61ceefd6fe05..2065ee88f5d5 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/order.R +++ b/samples/client/petstore/R-httr2-wrapper/R/order.R @@ -104,7 +104,9 @@ Order <- R6::R6Class( #' @examples #' # convert array of Order (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet.R b/samples/client/petstore/R-httr2-wrapper/R/pet.R index b0e158bf7ddc..6da3e7239d61 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet.R @@ -100,7 +100,9 @@ Pet <- R6::R6Class( #' @examples #' # convert array of Pet (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R index 001fe86fb104..17127ef4979d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R @@ -55,7 +55,9 @@ PetMap <- R6::R6Class( #' @examples #' # convert array of PetMap (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/special.R b/samples/client/petstore/R-httr2-wrapper/R/special.R index ad15ad8664b3..b5ac200ff4d4 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/special.R +++ b/samples/client/petstore/R-httr2-wrapper/R/special.R @@ -112,7 +112,9 @@ Special <- R6::R6Class( #' @examples #' # convert array of Special (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/tag.R b/samples/client/petstore/R-httr2-wrapper/R/tag.R index 22370cfca973..63b42cfdb321 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/tag.R +++ b/samples/client/petstore/R-httr2-wrapper/R/tag.R @@ -65,7 +65,9 @@ Tag <- R6::R6Class( #' @examples #' # convert array of Tag (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R index e191d65cf902..1c2792a2e0c9 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R @@ -60,7 +60,9 @@ UpdatePetRequest <- R6::R6Class( #' @examples #' # convert array of UpdatePetRequest (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/user.R b/samples/client/petstore/R-httr2-wrapper/R/user.R index c4a273fb57fe..53186a06e87d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user.R @@ -119,7 +119,9 @@ User <- R6::R6Class( #' @examples #' # convert array of User (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/whale.R b/samples/client/petstore/R-httr2-wrapper/R/whale.R index 0fc23964d616..a48f38618352 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/whale.R +++ b/samples/client/petstore/R-httr2-wrapper/R/whale.R @@ -74,7 +74,9 @@ Whale <- R6::R6Class( #' @examples #' # convert array of Whale (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2-wrapper/R/zebra.R b/samples/client/petstore/R-httr2-wrapper/R/zebra.R index 46e56453274e..133fa4b4a4a7 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/zebra.R +++ b/samples/client/petstore/R-httr2-wrapper/R/zebra.R @@ -68,7 +68,9 @@ Zebra <- R6::R6Class( #' @examples #' # convert array of Zebra (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index 86cbfb3943fd..b3da87d6bf28 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -82,7 +82,9 @@ AllofTagApiResponse <- R6::R6Class( #' @examples #' # convert array of AllofTagApiResponse (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 6bca8bd4df6d..af87bab87f81 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -57,7 +57,9 @@ Animal <- R6::R6Class( #' @examples #' # convert array of Animal (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 7d9e47714d7d..9ff125d84483 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -55,7 +55,9 @@ BasquePig <- R6::R6Class( #' @examples #' # convert array of BasquePig (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index d31568ba827e..ad997e12313b 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -65,7 +65,9 @@ Cat <- R6::R6Class( #' @examples #' # convert array of Cat (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index ed6af1879258..5217cad9f9aa 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -55,7 +55,9 @@ Category <- R6::R6Class( #' @examples #' # convert array of Category (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index 3e6b13ca848f..8a315d48862d 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -55,7 +55,9 @@ DanishPig <- R6::R6Class( #' @examples #' # convert array of DanishPig (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/date.R b/samples/client/petstore/R-httr2/R/date.R index 78e163874a0e..e14d02d6e385 100644 --- a/samples/client/petstore/R-httr2/R/date.R +++ b/samples/client/petstore/R-httr2/R/date.R @@ -68,7 +68,9 @@ Date <- R6::R6Class( #' @examples #' # convert array of Date (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 2b4ec4dfbb65..976920339720 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -65,7 +65,9 @@ Dog <- R6::R6Class( #' @examples #' # convert array of Dog (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/format_test.R b/samples/client/petstore/R-httr2/R/format_test.R index eaef7016c881..64530e1c3bbc 100644 --- a/samples/client/petstore/R-httr2/R/format_test.R +++ b/samples/client/petstore/R-httr2/R/format_test.R @@ -163,7 +163,9 @@ FormatTest <- R6::R6Class( #' @examples #' # convert array of FormatTest (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/just_model.R b/samples/client/petstore/R-httr2/R/just_model.R index 081c1c99d162..7b120718cdca 100644 --- a/samples/client/petstore/R-httr2/R/just_model.R +++ b/samples/client/petstore/R-httr2/R/just_model.R @@ -46,7 +46,9 @@ JustModel <- R6::R6Class( #' @examples #' # convert array of JustModel (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index 367a8ea08c29..f58a6cdfc3d1 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -64,7 +64,9 @@ ModelApiResponse <- R6::R6Class( #' @examples #' # convert array of ModelApiResponse (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index aed7e43ea11f..2c4bfc66a685 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -53,7 +53,9 @@ NestedOneOf <- R6::R6Class( #' @examples #' # convert array of NestedOneOf (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index f7dbf1266364..f80824e55a7f 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -94,7 +94,9 @@ Order <- R6::R6Class( #' @examples #' # convert array of Order (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index dbf65c83b529..2e6f2b351a4b 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -90,7 +90,9 @@ Pet <- R6::R6Class( #' @examples #' # convert array of Pet (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/pet_map.R b/samples/client/petstore/R-httr2/R/pet_map.R index 24f7554ca244..3d04aa204b80 100644 --- a/samples/client/petstore/R-httr2/R/pet_map.R +++ b/samples/client/petstore/R-httr2/R/pet_map.R @@ -45,7 +45,9 @@ PetMap <- R6::R6Class( #' @examples #' # convert array of PetMap (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index 9d2ebba2eabd..c02a1a4732bc 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -102,7 +102,9 @@ Special <- R6::R6Class( #' @examples #' # convert array of Special (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index 2fdc3a61b312..cebbb3111d02 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -55,7 +55,9 @@ Tag <- R6::R6Class( #' @examples #' # convert array of Tag (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index 7312ae6be59f..e965ce115d8a 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -50,7 +50,9 @@ UpdatePetRequest <- R6::R6Class( #' @examples #' # convert array of UpdatePetRequest (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index 4f8b2005d91e..c56c8957dc33 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -109,7 +109,9 @@ User <- R6::R6Class( #' @examples #' # convert array of User (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/whale.R b/samples/client/petstore/R-httr2/R/whale.R index 7e8e89644da7..6cf4a0db8c46 100644 --- a/samples/client/petstore/R-httr2/R/whale.R +++ b/samples/client/petstore/R-httr2/R/whale.R @@ -64,7 +64,9 @@ Whale <- R6::R6Class( #' @examples #' # convert array of Whale (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R-httr2/R/zebra.R b/samples/client/petstore/R-httr2/R/zebra.R index 9b86bf121637..6a38b4cfe929 100644 --- a/samples/client/petstore/R-httr2/R/zebra.R +++ b/samples/client/petstore/R-httr2/R/zebra.R @@ -58,7 +58,9 @@ Zebra <- R6::R6Class( #' @examples #' # convert array of Zebra (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index bdcec7fc2635..b05a56bc1337 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -92,7 +92,9 @@ AllofTagApiResponse <- R6::R6Class( #' @examples #' # convert array of AllofTagApiResponse (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index bcc8a8e04955..186f4b522a8d 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -67,7 +67,9 @@ Animal <- R6::R6Class( #' @examples #' # convert array of Animal (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index e414ea3fcda6..117e4430dc6a 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -65,7 +65,9 @@ BasquePig <- R6::R6Class( #' @examples #' # convert array of BasquePig (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index 66fe7758be1b..d9de174efa10 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -75,7 +75,9 @@ Cat <- R6::R6Class( #' @examples #' # convert array of Cat (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 753ede681c05..2f476b8b171c 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -65,7 +65,9 @@ Category <- R6::R6Class( #' @examples #' # convert array of Category (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index 27b07b03da46..a3e1a1d84b2f 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -65,7 +65,9 @@ DanishPig <- R6::R6Class( #' @examples #' # convert array of DanishPig (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/date.R b/samples/client/petstore/R/R/date.R index 572c3f1dd3f9..a1f8285489ee 100644 --- a/samples/client/petstore/R/R/date.R +++ b/samples/client/petstore/R/R/date.R @@ -78,7 +78,9 @@ Date <- R6::R6Class( #' @examples #' # convert array of Date (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index aceb2be15c8d..8563193e9358 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -75,7 +75,9 @@ Dog <- R6::R6Class( #' @examples #' # convert array of Dog (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/dummy_model.R b/samples/client/petstore/R/R/dummy_model.R index 1a15f463ced8..bbf7c149086f 100644 --- a/samples/client/petstore/R/R/dummy_model.R +++ b/samples/client/petstore/R/R/dummy_model.R @@ -56,7 +56,9 @@ DummyModel <- R6::R6Class( #' @examples #' # convert array of DummyModel (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/format_test.R b/samples/client/petstore/R/R/format_test.R index d89c0bb52962..199facda8a3c 100644 --- a/samples/client/petstore/R/R/format_test.R +++ b/samples/client/petstore/R/R/format_test.R @@ -173,7 +173,9 @@ FormatTest <- R6::R6Class( #' @examples #' # convert array of FormatTest (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index a10d7ac6b39c..bc059800ddf7 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -74,7 +74,9 @@ ModelApiResponse <- R6::R6Class( #' @examples #' # convert array of ModelApiResponse (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index 261b87f409b2..da38df94fe12 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -63,7 +63,9 @@ NestedOneOf <- R6::R6Class( #' @examples #' # convert array of NestedOneOf (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 61ceefd6fe05..2065ee88f5d5 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -104,7 +104,9 @@ Order <- R6::R6Class( #' @examples #' # convert array of Order (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index b0e158bf7ddc..6da3e7239d61 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -100,7 +100,9 @@ Pet <- R6::R6Class( #' @examples #' # convert array of Pet (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/pet_map.R b/samples/client/petstore/R/R/pet_map.R index 001fe86fb104..17127ef4979d 100644 --- a/samples/client/petstore/R/R/pet_map.R +++ b/samples/client/petstore/R/R/pet_map.R @@ -55,7 +55,9 @@ PetMap <- R6::R6Class( #' @examples #' # convert array of PetMap (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index ad15ad8664b3..b5ac200ff4d4 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -112,7 +112,9 @@ Special <- R6::R6Class( #' @examples #' # convert array of Special (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index 22370cfca973..63b42cfdb321 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -65,7 +65,9 @@ Tag <- R6::R6Class( #' @examples #' # convert array of Tag (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index e191d65cf902..1c2792a2e0c9 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -60,7 +60,9 @@ UpdatePetRequest <- R6::R6Class( #' @examples #' # convert array of UpdatePetRequest (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index c4a273fb57fe..53186a06e87d 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -119,7 +119,9 @@ User <- R6::R6Class( #' @examples #' # convert array of User (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/whale.R b/samples/client/petstore/R/R/whale.R index 0fc23964d616..a48f38618352 100644 --- a/samples/client/petstore/R/R/whale.R +++ b/samples/client/petstore/R/R/whale.R @@ -74,7 +74,9 @@ Whale <- R6::R6Class( #' @examples #' # convert array of Whale (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { diff --git a/samples/client/petstore/R/R/zebra.R b/samples/client/petstore/R/R/zebra.R index 46e56453274e..133fa4b4a4a7 100644 --- a/samples/client/petstore/R/R/zebra.R +++ b/samples/client/petstore/R/R/zebra.R @@ -68,7 +68,9 @@ Zebra <- R6::R6Class( #' @examples #' # convert array of Zebra (x) to a data frame #' \dontrun{ - #' df <- x |> purrr::map_dfr(\(y)y$toList()) + #' library(purrr) + #' library(tibble) + #' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind() #' df #' } toList = function() { From 0ddf0bbcf08bc7ea52318f2677e37c5e51526466 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Wed, 27 Nov 2024 05:11:21 -0500 Subject: [PATCH 7/7] fix typo --- .../openapi-generator/src/main/resources/r/modelAnyOf.mustache | 2 +- .../openapi-generator/src/main/resources/r/modelEnum.mustache | 2 +- .../src/main/resources/r/modelGeneric.mustache | 2 +- .../openapi-generator/src/main/resources/r/modelOneOf.mustache | 2 +- samples/client/echo_api/r/R/bird.R | 2 +- samples/client/echo_api/r/R/category.R | 2 +- samples/client/echo_api/r/R/data_query.R | 2 +- samples/client/echo_api/r/R/default_value.R | 2 +- samples/client/echo_api/r/R/number_properties_only.R | 2 +- samples/client/echo_api/r/R/pet.R | 2 +- samples/client/echo_api/r/R/query.R | 2 +- samples/client/echo_api/r/R/string_enum_ref.R | 2 +- samples/client/echo_api/r/R/tag.R | 2 +- .../echo_api/r/R/test_form_object_multipart_request_marker.R | 2 +- ...p_object_explode_true_object_all_of_query_object_parameter.R | 2 +- ...tyle_form_explode_true_array_string_query_object_parameter.R | 2 +- .../client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/animal.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R | 2 +- .../petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/basque_pig.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/cat.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/category.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/danish_pig.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/date.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/dog.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/dummy_model.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/format_test.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/mammal.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/model_api_response.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R | 2 +- .../petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/order.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/pet.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/pet_map.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/pig.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/special.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/tag.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/user.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/whale.R | 2 +- samples/client/petstore/R-httr2-wrapper/R/zebra.R | 2 +- samples/client/petstore/R-httr2/R/allof_tag_api_response.R | 2 +- samples/client/petstore/R-httr2/R/animal.R | 2 +- samples/client/petstore/R-httr2/R/any_of_pig.R | 2 +- samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2/R/basque_pig.R | 2 +- samples/client/petstore/R-httr2/R/cat.R | 2 +- samples/client/petstore/R-httr2/R/category.R | 2 +- samples/client/petstore/R-httr2/R/danish_pig.R | 2 +- samples/client/petstore/R-httr2/R/date.R | 2 +- samples/client/petstore/R-httr2/R/dog.R | 2 +- samples/client/petstore/R-httr2/R/format_test.R | 2 +- samples/client/petstore/R-httr2/R/just_model.R | 2 +- samples/client/petstore/R-httr2/R/mammal.R | 2 +- samples/client/petstore/R-httr2/R/model_api_response.R | 2 +- samples/client/petstore/R-httr2/R/nested_one_of.R | 2 +- samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R | 2 +- samples/client/petstore/R-httr2/R/order.R | 2 +- samples/client/petstore/R-httr2/R/pet.R | 2 +- samples/client/petstore/R-httr2/R/pet_map.R | 2 +- samples/client/petstore/R-httr2/R/pig.R | 2 +- samples/client/petstore/R-httr2/R/special.R | 2 +- samples/client/petstore/R-httr2/R/tag.R | 2 +- samples/client/petstore/R-httr2/R/update_pet_request.R | 2 +- samples/client/petstore/R-httr2/R/user.R | 2 +- samples/client/petstore/R-httr2/R/whale.R | 2 +- samples/client/petstore/R-httr2/R/zebra.R | 2 +- samples/client/petstore/R/R/allof_tag_api_response.R | 2 +- samples/client/petstore/R/R/animal.R | 2 +- samples/client/petstore/R/R/any_of_pig.R | 2 +- samples/client/petstore/R/R/any_of_primitive_type_test.R | 2 +- samples/client/petstore/R/R/basque_pig.R | 2 +- samples/client/petstore/R/R/cat.R | 2 +- samples/client/petstore/R/R/category.R | 2 +- samples/client/petstore/R/R/danish_pig.R | 2 +- samples/client/petstore/R/R/date.R | 2 +- samples/client/petstore/R/R/dog.R | 2 +- samples/client/petstore/R/R/dummy_model.R | 2 +- samples/client/petstore/R/R/format_test.R | 2 +- samples/client/petstore/R/R/mammal.R | 2 +- samples/client/petstore/R/R/model_api_response.R | 2 +- samples/client/petstore/R/R/nested_one_of.R | 2 +- samples/client/petstore/R/R/one_of_primitive_type_test.R | 2 +- samples/client/petstore/R/R/order.R | 2 +- samples/client/petstore/R/R/pet.R | 2 +- samples/client/petstore/R/R/pet_map.R | 2 +- samples/client/petstore/R/R/pig.R | 2 +- samples/client/petstore/R/R/special.R | 2 +- samples/client/petstore/R/R/tag.R | 2 +- samples/client/petstore/R/R/update_pet_request.R | 2 +- samples/client/petstore/R/R/user.R | 2 +- samples/client/petstore/R/R/whale.R | 2 +- samples/client/petstore/R/R/zebra.R | 2 +- 94 files changed, 94 insertions(+), 94 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache b/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache index fcaca0d85681..1cdb306be667 100644 --- a/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache @@ -88,7 +88,7 @@ #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/modules/openapi-generator/src/main/resources/r/modelEnum.mustache b/modules/openapi-generator/src/main/resources/r/modelEnum.mustache index 0589f8073c4e..c0dc60149aa1 100644 --- a/modules/openapi-generator/src/main/resources/r/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelEnum.mustache @@ -40,7 +40,7 @@ #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index 675d7de605e4..0da6607925aa 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -205,7 +205,7 @@ #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache index 87f7859766bc..998687b5efb5 100644 --- a/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelOneOf.mustache @@ -155,7 +155,7 @@ #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R index 7a180ef11e0f..97921b1c4c89 100644 --- a/samples/client/echo_api/r/R/bird.R +++ b/samples/client/echo_api/r/R/bird.R @@ -42,7 +42,7 @@ Bird <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R index b4ae39ba2cdf..56aa69671774 100644 --- a/samples/client/echo_api/r/R/category.R +++ b/samples/client/echo_api/r/R/category.R @@ -42,7 +42,7 @@ Category <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R index 0fa519f753e4..1340544416d0 100644 --- a/samples/client/echo_api/r/R/data_query.R +++ b/samples/client/echo_api/r/R/data_query.R @@ -69,7 +69,7 @@ DataQuery <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R index 4ed97e9c7b37..2a3a83f32655 100644 --- a/samples/client/echo_api/r/R/default_value.R +++ b/samples/client/echo_api/r/R/default_value.R @@ -89,7 +89,7 @@ DefaultValue <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R index 2fabbeb350b2..7b146800ad34 100644 --- a/samples/client/echo_api/r/R/number_properties_only.R +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -48,7 +48,7 @@ NumberPropertiesOnly <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R index 2f8002179fc4..6f59d7ea1f6c 100644 --- a/samples/client/echo_api/r/R/pet.R +++ b/samples/client/echo_api/r/R/pet.R @@ -77,7 +77,7 @@ Pet <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R index c5725669d8ee..fd286ab3016d 100644 --- a/samples/client/echo_api/r/R/query.R +++ b/samples/client/echo_api/r/R/query.R @@ -41,7 +41,7 @@ Query <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/string_enum_ref.R b/samples/client/echo_api/r/R/string_enum_ref.R index 4ebf1811debb..ee9afe6cf4a1 100644 --- a/samples/client/echo_api/r/R/string_enum_ref.R +++ b/samples/client/echo_api/r/R/string_enum_ref.R @@ -39,7 +39,7 @@ StringEnumRef <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R index 06cb6900b9d5..3a0d3c1d2390 100644 --- a/samples/client/echo_api/r/R/tag.R +++ b/samples/client/echo_api/r/R/tag.R @@ -42,7 +42,7 @@ Tag <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R index 42d3a1701562..5c9776f78ebe 100644 --- a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -33,7 +33,7 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R index f804c0f4e7a4..a441c20a8be3 100644 --- a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -60,7 +60,7 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R index a2481e602e2a..9a874c05c0d1 100644 --- a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -32,7 +32,7 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R index b05a56bc1337..018600362d38 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/allof_tag_api_response.R @@ -79,7 +79,7 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/animal.R b/samples/client/petstore/R-httr2-wrapper/R/animal.R index 186f4b522a8d..cf2e97f9af30 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/animal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/animal.R @@ -54,7 +54,7 @@ Animal <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R b/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R index fdef3fb4a6d4..7480eec76961 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/any_of_pig.R @@ -93,7 +93,7 @@ AnyOfPig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R b/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R index 527200bfaece..f76defe9f4aa 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/any_of_primitive_type_test.R @@ -127,7 +127,7 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R index 117e4430dc6a..ca8601f4c3b1 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/basque_pig.R @@ -52,7 +52,7 @@ BasquePig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/cat.R b/samples/client/petstore/R-httr2-wrapper/R/cat.R index d9de174efa10..270b87c21643 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/cat.R +++ b/samples/client/petstore/R-httr2-wrapper/R/cat.R @@ -62,7 +62,7 @@ Cat <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/category.R b/samples/client/petstore/R-httr2-wrapper/R/category.R index 2f476b8b171c..0dcbd1b81610 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/category.R +++ b/samples/client/petstore/R-httr2-wrapper/R/category.R @@ -52,7 +52,7 @@ Category <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R index a3e1a1d84b2f..02d2208639b0 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/danish_pig.R @@ -52,7 +52,7 @@ DanishPig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/date.R b/samples/client/petstore/R-httr2-wrapper/R/date.R index a1f8285489ee..411249d3fba1 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/date.R +++ b/samples/client/petstore/R-httr2-wrapper/R/date.R @@ -65,7 +65,7 @@ Date <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/dog.R b/samples/client/petstore/R-httr2-wrapper/R/dog.R index 8563193e9358..4d6dab71c61b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dog.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dog.R @@ -62,7 +62,7 @@ Dog <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R index bbf7c149086f..cbea7830b824 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R +++ b/samples/client/petstore/R-httr2-wrapper/R/dummy_model.R @@ -43,7 +43,7 @@ DummyModel <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/format_test.R b/samples/client/petstore/R-httr2-wrapper/R/format_test.R index 199facda8a3c..7d1bded3c5a8 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/format_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/format_test.R @@ -160,7 +160,7 @@ FormatTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/mammal.R b/samples/client/petstore/R-httr2-wrapper/R/mammal.R index c20a9a4f672d..29b32a31bcb8 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/mammal.R +++ b/samples/client/petstore/R-httr2-wrapper/R/mammal.R @@ -151,7 +151,7 @@ Mammal <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R index bc059800ddf7..a3a46dfb7907 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/model_api_response.R @@ -61,7 +61,7 @@ ModelApiResponse <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R index da38df94fe12..31dcc2f10d01 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2-wrapper/R/nested_one_of.R @@ -50,7 +50,7 @@ NestedOneOf <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R b/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R index 7d913427c788..e5b566985620 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2-wrapper/R/one_of_primitive_type_test.R @@ -127,7 +127,7 @@ OneOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/order.R b/samples/client/petstore/R-httr2-wrapper/R/order.R index 2065ee88f5d5..07378f03666c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/order.R +++ b/samples/client/petstore/R-httr2-wrapper/R/order.R @@ -91,7 +91,7 @@ Order <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet.R b/samples/client/petstore/R-httr2-wrapper/R/pet.R index 6da3e7239d61..27db68d8fdbd 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet.R @@ -87,7 +87,7 @@ Pet <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R index 17127ef4979d..aa59c50a09c0 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_map.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_map.R @@ -42,7 +42,7 @@ PetMap <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/pig.R b/samples/client/petstore/R-httr2-wrapper/R/pig.R index 520b6efd760b..11c4f531b94f 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pig.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pig.R @@ -151,7 +151,7 @@ Pig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/special.R b/samples/client/petstore/R-httr2-wrapper/R/special.R index b5ac200ff4d4..4c27190313fb 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/special.R +++ b/samples/client/petstore/R-httr2-wrapper/R/special.R @@ -99,7 +99,7 @@ Special <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/tag.R b/samples/client/petstore/R-httr2-wrapper/R/tag.R index 63b42cfdb321..b4c893dfe77e 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/tag.R +++ b/samples/client/petstore/R-httr2-wrapper/R/tag.R @@ -52,7 +52,7 @@ Tag <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R index 1c2792a2e0c9..3559d3c4d838 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2-wrapper/R/update_pet_request.R @@ -47,7 +47,7 @@ UpdatePetRequest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/user.R b/samples/client/petstore/R-httr2-wrapper/R/user.R index 53186a06e87d..361d0d454f21 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user.R @@ -106,7 +106,7 @@ User <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/whale.R b/samples/client/petstore/R-httr2-wrapper/R/whale.R index a48f38618352..ea54d3bdf71c 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/whale.R +++ b/samples/client/petstore/R-httr2-wrapper/R/whale.R @@ -61,7 +61,7 @@ Whale <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2-wrapper/R/zebra.R b/samples/client/petstore/R-httr2-wrapper/R/zebra.R index 133fa4b4a4a7..6b85dbff4093 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/zebra.R +++ b/samples/client/petstore/R-httr2-wrapper/R/zebra.R @@ -55,7 +55,7 @@ Zebra <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index b3da87d6bf28..37fa07aaa475 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -69,7 +69,7 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index af87bab87f81..8b7e9dba4ffe 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -44,7 +44,7 @@ Animal <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/any_of_pig.R b/samples/client/petstore/R-httr2/R/any_of_pig.R index fdef3fb4a6d4..7480eec76961 100644 --- a/samples/client/petstore/R-httr2/R/any_of_pig.R +++ b/samples/client/petstore/R-httr2/R/any_of_pig.R @@ -93,7 +93,7 @@ AnyOfPig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R b/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R index 527200bfaece..f76defe9f4aa 100644 --- a/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2/R/any_of_primitive_type_test.R @@ -127,7 +127,7 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 9ff125d84483..77af09db6a04 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -42,7 +42,7 @@ BasquePig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index ad997e12313b..54784f94e2b5 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -52,7 +52,7 @@ Cat <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index 5217cad9f9aa..9448df38190e 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -42,7 +42,7 @@ Category <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index 8a315d48862d..e5eeb4446146 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -42,7 +42,7 @@ DanishPig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/date.R b/samples/client/petstore/R-httr2/R/date.R index e14d02d6e385..81dc68d4feec 100644 --- a/samples/client/petstore/R-httr2/R/date.R +++ b/samples/client/petstore/R-httr2/R/date.R @@ -55,7 +55,7 @@ Date <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 976920339720..1928ffc3985c 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -52,7 +52,7 @@ Dog <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/format_test.R b/samples/client/petstore/R-httr2/R/format_test.R index 64530e1c3bbc..1e8a62b2fd9c 100644 --- a/samples/client/petstore/R-httr2/R/format_test.R +++ b/samples/client/petstore/R-httr2/R/format_test.R @@ -150,7 +150,7 @@ FormatTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/just_model.R b/samples/client/petstore/R-httr2/R/just_model.R index 7b120718cdca..89d14ef99c3a 100644 --- a/samples/client/petstore/R-httr2/R/just_model.R +++ b/samples/client/petstore/R-httr2/R/just_model.R @@ -33,7 +33,7 @@ JustModel <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/mammal.R b/samples/client/petstore/R-httr2/R/mammal.R index 19909a4b2c06..3d93ab765e39 100644 --- a/samples/client/petstore/R-httr2/R/mammal.R +++ b/samples/client/petstore/R-httr2/R/mammal.R @@ -125,7 +125,7 @@ Mammal <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index f58a6cdfc3d1..d65c1860ce2c 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -51,7 +51,7 @@ ModelApiResponse <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index 2c4bfc66a685..d0ef1f9b67a5 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -40,7 +40,7 @@ NestedOneOf <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R b/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R index 7d913427c788..e5b566985620 100644 --- a/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R-httr2/R/one_of_primitive_type_test.R @@ -127,7 +127,7 @@ OneOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index f80824e55a7f..cf6bcb48bc85 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -81,7 +81,7 @@ Order <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index 2e6f2b351a4b..c3d0bc32fd61 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -77,7 +77,7 @@ Pet <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/pet_map.R b/samples/client/petstore/R-httr2/R/pet_map.R index 3d04aa204b80..e0e63305d0fd 100644 --- a/samples/client/petstore/R-httr2/R/pet_map.R +++ b/samples/client/petstore/R-httr2/R/pet_map.R @@ -32,7 +32,7 @@ PetMap <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/pig.R b/samples/client/petstore/R-httr2/R/pig.R index 702eb529f58f..94067ec4d720 100644 --- a/samples/client/petstore/R-httr2/R/pig.R +++ b/samples/client/petstore/R-httr2/R/pig.R @@ -125,7 +125,7 @@ Pig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index c02a1a4732bc..2e4c8ccdc0cf 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -89,7 +89,7 @@ Special <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index cebbb3111d02..96383b87f07f 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -42,7 +42,7 @@ Tag <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index e965ce115d8a..e42c9a114546 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -37,7 +37,7 @@ UpdatePetRequest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index c56c8957dc33..76c4970a45d6 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -96,7 +96,7 @@ User <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/whale.R b/samples/client/petstore/R-httr2/R/whale.R index 6cf4a0db8c46..fef88a7c6375 100644 --- a/samples/client/petstore/R-httr2/R/whale.R +++ b/samples/client/petstore/R-httr2/R/whale.R @@ -51,7 +51,7 @@ Whale <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R-httr2/R/zebra.R b/samples/client/petstore/R-httr2/R/zebra.R index 6a38b4cfe929..c5165a867082 100644 --- a/samples/client/petstore/R-httr2/R/zebra.R +++ b/samples/client/petstore/R-httr2/R/zebra.R @@ -45,7 +45,7 @@ Zebra <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index b05a56bc1337..018600362d38 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -79,7 +79,7 @@ AllofTagApiResponse <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index 186f4b522a8d..cf2e97f9af30 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -54,7 +54,7 @@ Animal <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/any_of_pig.R b/samples/client/petstore/R/R/any_of_pig.R index fdef3fb4a6d4..7480eec76961 100644 --- a/samples/client/petstore/R/R/any_of_pig.R +++ b/samples/client/petstore/R/R/any_of_pig.R @@ -93,7 +93,7 @@ AnyOfPig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/any_of_primitive_type_test.R b/samples/client/petstore/R/R/any_of_primitive_type_test.R index 527200bfaece..f76defe9f4aa 100644 --- a/samples/client/petstore/R/R/any_of_primitive_type_test.R +++ b/samples/client/petstore/R/R/any_of_primitive_type_test.R @@ -127,7 +127,7 @@ AnyOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index 117e4430dc6a..ca8601f4c3b1 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -52,7 +52,7 @@ BasquePig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index d9de174efa10..270b87c21643 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -62,7 +62,7 @@ Cat <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 2f476b8b171c..0dcbd1b81610 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -52,7 +52,7 @@ Category <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index a3e1a1d84b2f..02d2208639b0 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -52,7 +52,7 @@ DanishPig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/date.R b/samples/client/petstore/R/R/date.R index a1f8285489ee..411249d3fba1 100644 --- a/samples/client/petstore/R/R/date.R +++ b/samples/client/petstore/R/R/date.R @@ -65,7 +65,7 @@ Date <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index 8563193e9358..4d6dab71c61b 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -62,7 +62,7 @@ Dog <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/dummy_model.R b/samples/client/petstore/R/R/dummy_model.R index bbf7c149086f..cbea7830b824 100644 --- a/samples/client/petstore/R/R/dummy_model.R +++ b/samples/client/petstore/R/R/dummy_model.R @@ -43,7 +43,7 @@ DummyModel <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/format_test.R b/samples/client/petstore/R/R/format_test.R index 199facda8a3c..7d1bded3c5a8 100644 --- a/samples/client/petstore/R/R/format_test.R +++ b/samples/client/petstore/R/R/format_test.R @@ -160,7 +160,7 @@ FormatTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/mammal.R b/samples/client/petstore/R/R/mammal.R index 19909a4b2c06..3d93ab765e39 100644 --- a/samples/client/petstore/R/R/mammal.R +++ b/samples/client/petstore/R/R/mammal.R @@ -125,7 +125,7 @@ Mammal <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index bc059800ddf7..a3a46dfb7907 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -61,7 +61,7 @@ ModelApiResponse <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index da38df94fe12..31dcc2f10d01 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -50,7 +50,7 @@ NestedOneOf <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/one_of_primitive_type_test.R b/samples/client/petstore/R/R/one_of_primitive_type_test.R index 7d913427c788..e5b566985620 100644 --- a/samples/client/petstore/R/R/one_of_primitive_type_test.R +++ b/samples/client/petstore/R/R/one_of_primitive_type_test.R @@ -127,7 +127,7 @@ OneOfPrimitiveTypeTest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 2065ee88f5d5..07378f03666c 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -91,7 +91,7 @@ Order <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 6da3e7239d61..27db68d8fdbd 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -87,7 +87,7 @@ Pet <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/pet_map.R b/samples/client/petstore/R/R/pet_map.R index 17127ef4979d..aa59c50a09c0 100644 --- a/samples/client/petstore/R/R/pet_map.R +++ b/samples/client/petstore/R/R/pet_map.R @@ -42,7 +42,7 @@ PetMap <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/pig.R b/samples/client/petstore/R/R/pig.R index 702eb529f58f..94067ec4d720 100644 --- a/samples/client/petstore/R/R/pig.R +++ b/samples/client/petstore/R/R/pig.R @@ -125,7 +125,7 @@ Pig <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index b5ac200ff4d4..4c27190313fb 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -99,7 +99,7 @@ Special <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index 63b42cfdb321..b4c893dfe77e 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -52,7 +52,7 @@ Tag <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index 1c2792a2e0c9..3559d3c4d838 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -47,7 +47,7 @@ UpdatePetRequest <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index 53186a06e87d..361d0d454f21 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -106,7 +106,7 @@ User <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/whale.R b/samples/client/petstore/R/R/whale.R index a48f38618352..ea54d3bdf71c 100644 --- a/samples/client/petstore/R/R/whale.R +++ b/samples/client/petstore/R/R/whale.R @@ -61,7 +61,7 @@ Whale <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) }, diff --git a/samples/client/petstore/R/R/zebra.R b/samples/client/petstore/R/R/zebra.R index 133fa4b4a4a7..6b85dbff4093 100644 --- a/samples/client/petstore/R/R/zebra.R +++ b/samples/client/petstore/R/R/zebra.R @@ -55,7 +55,7 @@ Zebra <- R6::R6Class( #' @description #' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead. toJSON = function() { - .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more learly named. Use '$toJSONString()' to get a JSON string") + .Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string") return(self$toSimpleType()) },