add additional properties support in r client (#13317)

This commit is contained in:
William Cheng 2022-08-31 15:06:40 +08:00 committed by GitHub
parent d63caf2539
commit cebdbb6a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 785 additions and 116 deletions

View File

@ -10,3 +10,4 @@ additionalProperties:
returnExceptionOnFailure: true
errorObjectType: "ModelApiResponse"
operationIdNaming: PascalCase #default
disallowAdditionalPropertiesIfNotPresent: false

View File

@ -13,3 +13,4 @@ additionalProperties:
operationIdNaming: snake_case
generateWrapper: true
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false

View File

@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|errorObjectType|Error object type.| |null|
|exceptionPackage|Specify the exception handling package|<dl><dt>**default**</dt><dd>Use stop() for raising exceptions.</dd><dt>**rlang**</dt><dd>Use rlang package for exceptions.</dd></dl>|default|
|generateWrapper|Generate a wrapper class (single point of access) for the R client. This option only works with `httr2` library.| |false|

View File

@ -216,6 +216,20 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
setLibrary(HTTR);
cliOptions.add(CliOption.newBoolean(GENERATE_WRAPPER, "Generate a wrapper class (single point of access) for the R client. This option only works with `httr2` library."));
// option to change how we process + set the data in the 'additionalProperties' keyword.
CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean(
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT,
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString());
Map<String, String> disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>();
disallowAdditionalPropertiesIfNotPresentOpts.put("false",
"The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.");
disallowAdditionalPropertiesIfNotPresentOpts.put("true",
"Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
}
@Override
@ -272,6 +286,11 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup);
}
if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) {
this.setDisallowAdditionalPropertiesIfNotPresent(Boolean.parseBoolean(additionalProperties
.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString()));
}
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
additionalProperties.put(CodegenConstants.EXCEPTION_ON_FAILURE, returnExceptionOnFailure);

View File

@ -10,6 +10,9 @@
{{#vars}}
#' @field {{name}} {{title}} {{{vendorExtensions.x-r-doc-type}}}{{^required}} [optional]{{/required}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
#' @field additional_properties named list(character) [optional]
{{/isAdditionalPropertiesTrue}}
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -22,6 +25,9 @@
{{#vars}}
`{{{name}}}` = NULL,
{{/vars}}
{{#isAdditionalPropertiesTrue}}
`additional_properties` = NULL,
{{/isAdditionalPropertiesTrue}}
#' Initialize a new {{{classname}}} class.
#'
#' @description
@ -33,10 +39,13 @@
{{#optionalVars}}
#' @param {{name}} {{#lambdaRdocEscape}}{{{description}}}{{/lambdaRdocEscape}}{{^description}}{{{name}}}{{/description}}{{#defaultValue}}. Default to {{{.}}}.{{/defaultValue}}
{{/optionalVars}}
{{#isAdditionalPropertiesTrue}}
#' @param additional_properties additonal properties (optional)
{{/isAdditionalPropertiesTrue}}
#' @param ... Other optional arguments.
#' @export
initialize = function(
{{#requiredVars}}`{{name}}`, {{/requiredVars}}{{#optionalVars}}`{{name}}` = {{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}...
{{#requiredVars}}`{{name}}`, {{/requiredVars}}{{#optionalVars}}`{{name}}` = {{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}{{#isAdditionalPropertiesTrue}}additional_properties = NULL, {{/isAdditionalPropertiesTrue}}...
) {
{{#requiredVars}}
if (!missing(`{{name}}`)) {
@ -126,6 +135,13 @@
self$`{{name}}` <- `{{name}}`
}
{{/optionalVars}}
{{#isAdditionalPropertiesTrue}}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
{{/isAdditionalPropertiesTrue}}
},
#' To JSON string
#'
@ -167,7 +183,12 @@
{{/isContainer}}
}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
for (key in names(self$additional_properties)) {
{{classname}}Object[[key]] <- self$additional_properties[[key]]
}
{{/isAdditionalPropertiesTrue}}
{{classname}}Object
},
#' Deserialize JSON string into an instance of {{{classname}}}
@ -266,7 +287,14 @@
{{/vars}}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
{{#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}}
},
#' Deserialize JSON string into an instance of {{{classname}}}
#'

View File

@ -12,6 +12,7 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -23,6 +24,7 @@ AllofTagApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
#' Initialize a new AllofTagApiResponse class.
#'
#' @description
@ -33,10 +35,11 @@ AllofTagApiResponse <- R6::R6Class(
#' @param code code
#' @param type type
#' @param message message
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, ...
`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -58,6 +61,11 @@ AllofTagApiResponse <- R6::R6Class(
stopifnot(is.character(`message`), length(`message`) == 1)
self$`message` <- `message`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -88,6 +96,9 @@ AllofTagApiResponse <- R6::R6Class(
AllofTagApiResponseObject[["message"]] <-
self$`message`
}
for (key in names(self$additional_properties)) {
AllofTagApiResponseObject[[key]] <- self$additional_properties[[key]]
}
AllofTagApiResponseObject
},
@ -169,7 +180,12 @@ AllofTagApiResponse <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of AllofTagApiResponse
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Animal <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
#' Initialize a new Animal class.
#'
#' @description
@ -24,10 +26,11 @@ Animal <- R6::R6Class(
#'
#' @param className className
#' @param color color. Default to "red".
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color` = "red", ...
`className`, `color` = "red", additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ Animal <- R6::R6Class(
stopifnot(is.character(`color`), length(`color`) == 1)
self$`color` <- `color`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Animal <- R6::R6Class(
AnimalObject[["color"]] <-
self$`color`
}
for (key in names(self$additional_properties)) {
AnimalObject[[key]] <- self$additional_properties[[key]]
}
AnimalObject
},
@ -103,7 +114,12 @@ Animal <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Animal
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ BasquePig <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
#' Initialize a new BasquePig class.
#'
#' @description
@ -24,10 +26,11 @@ BasquePig <- R6::R6Class(
#'
#' @param className className
#' @param color color
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color`, ...
`className`, `color`, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ BasquePig <- R6::R6Class(
stopifnot(is.character(`color`), length(`color`) == 1)
self$`color` <- `color`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ BasquePig <- R6::R6Class(
BasquePigObject[["color"]] <-
self$`color`
}
for (key in names(self$additional_properties)) {
BasquePigObject[[key]] <- self$additional_properties[[key]]
}
BasquePigObject
},
@ -103,7 +114,12 @@ BasquePig <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of BasquePig
#'

View File

@ -10,6 +10,7 @@
#' @field className character
#' @field color character [optional]
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,6 +21,7 @@ Cat <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`declawed` = NULL,
`additional_properties` = NULL,
#' Initialize a new Cat class.
#'
#' @description
@ -28,10 +30,11 @@ Cat <- R6::R6Class(
#' @param className className
#' @param color color. Default to "red".
#' @param declawed declawed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color` = "red", `declawed` = NULL, ...
`className`, `color` = "red", `declawed` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -45,6 +48,11 @@ Cat <- R6::R6Class(
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
self$`declawed` <- `declawed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -67,6 +75,9 @@ Cat <- R6::R6Class(
CatObject[["declawed"]] <-
self$`declawed`
}
for (key in names(self$additional_properties)) {
CatObject[[key]] <- self$additional_properties[[key]]
}
CatObject
},
@ -126,7 +137,12 @@ Cat <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Cat
#'

View File

@ -8,6 +8,7 @@
#' @description CatAllOf Class
#' @format An \code{R6Class} generator object
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -15,21 +16,28 @@ CatAllOf <- R6::R6Class(
"CatAllOf",
public = list(
`declawed` = NULL,
`additional_properties` = NULL,
#' Initialize a new CatAllOf class.
#'
#' @description
#' Initialize a new CatAllOf class.
#'
#' @param declawed declawed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`declawed` = NULL, ...
`declawed` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`declawed`)) {
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
self$`declawed` <- `declawed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -44,6 +52,9 @@ CatAllOf <- R6::R6Class(
CatAllOfObject[["declawed"]] <-
self$`declawed`
}
for (key in names(self$additional_properties)) {
CatAllOfObject[[key]] <- self$additional_properties[[key]]
}
CatAllOfObject
},
@ -81,7 +92,12 @@ CatAllOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of CatAllOf
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Category <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
#' Initialize a new Category class.
#'
#' @description
@ -24,10 +26,11 @@ Category <- R6::R6Class(
#'
#' @param id id
#' @param name name
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `name` = NULL, ...
`id` = NULL, `name` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -37,6 +40,11 @@ Category <- R6::R6Class(
stopifnot(is.character(`name`), length(`name`) == 1)
self$`name` <- `name`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Category <- R6::R6Class(
CategoryObject[["name"]] <-
self$`name`
}
for (key in names(self$additional_properties)) {
CategoryObject[[key]] <- self$additional_properties[[key]]
}
CategoryObject
},
@ -103,7 +114,12 @@ Category <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Category
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field size integer
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ DanishPig <- R6::R6Class(
public = list(
`className` = NULL,
`size` = NULL,
`additional_properties` = NULL,
#' Initialize a new DanishPig class.
#'
#' @description
@ -24,10 +26,11 @@ DanishPig <- R6::R6Class(
#'
#' @param className className
#' @param size size
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `size`, ...
`className`, `size`, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ DanishPig <- R6::R6Class(
stopifnot(is.numeric(`size`), length(`size`) == 1)
self$`size` <- `size`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ DanishPig <- R6::R6Class(
DanishPigObject[["size"]] <-
self$`size`
}
for (key in names(self$additional_properties)) {
DanishPigObject[[key]] <- self$additional_properties[[key]]
}
DanishPigObject
},
@ -103,7 +114,12 @@ DanishPig <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of DanishPig
#'

View File

@ -10,6 +10,7 @@
#' @field className character
#' @field color character [optional]
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,6 +21,7 @@ Dog <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`breed` = NULL,
`additional_properties` = NULL,
#' Initialize a new Dog class.
#'
#' @description
@ -28,10 +30,11 @@ Dog <- R6::R6Class(
#' @param className className
#' @param color color. Default to "red".
#' @param breed breed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color` = "red", `breed` = NULL, ...
`className`, `color` = "red", `breed` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -45,6 +48,11 @@ Dog <- R6::R6Class(
stopifnot(is.character(`breed`), length(`breed`) == 1)
self$`breed` <- `breed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -67,6 +75,9 @@ Dog <- R6::R6Class(
DogObject[["breed"]] <-
self$`breed`
}
for (key in names(self$additional_properties)) {
DogObject[[key]] <- self$additional_properties[[key]]
}
DogObject
},
@ -126,7 +137,12 @@ Dog <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Dog
#'

View File

@ -8,6 +8,7 @@
#' @description DogAllOf Class
#' @format An \code{R6Class} generator object
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -15,21 +16,28 @@ DogAllOf <- R6::R6Class(
"DogAllOf",
public = list(
`breed` = NULL,
`additional_properties` = NULL,
#' Initialize a new DogAllOf class.
#'
#' @description
#' Initialize a new DogAllOf class.
#'
#' @param breed breed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`breed` = NULL, ...
`breed` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`breed`)) {
stopifnot(is.character(`breed`), length(`breed`) == 1)
self$`breed` <- `breed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -44,6 +52,9 @@ DogAllOf <- R6::R6Class(
DogAllOfObject[["breed"]] <-
self$`breed`
}
for (key in names(self$additional_properties)) {
DogAllOfObject[[key]] <- self$additional_properties[[key]]
}
DogAllOfObject
},
@ -81,7 +92,12 @@ DogAllOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of DogAllOf
#'

View File

@ -10,6 +10,7 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -19,6 +20,7 @@ ModelApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
#' Initialize a new ModelApiResponse class.
#'
#' @description
@ -27,10 +29,11 @@ ModelApiResponse <- R6::R6Class(
#' @param code code
#' @param type type
#' @param message message
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`code` = NULL, `type` = NULL, `message` = NULL, ...
`code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`code`)) {
stopifnot(is.numeric(`code`), length(`code`) == 1)
@ -44,6 +47,11 @@ ModelApiResponse <- R6::R6Class(
stopifnot(is.character(`message`), length(`message`) == 1)
self$`message` <- `message`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -66,6 +74,9 @@ ModelApiResponse <- R6::R6Class(
ModelApiResponseObject[["message"]] <-
self$`message`
}
for (key in names(self$additional_properties)) {
ModelApiResponseObject[[key]] <- self$additional_properties[[key]]
}
ModelApiResponseObject
},
@ -125,7 +136,12 @@ ModelApiResponse <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of ModelApiResponse
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field size integer [optional]
#' @field nested_pig \link{Pig} [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ NestedOneOf <- R6::R6Class(
public = list(
`size` = NULL,
`nested_pig` = NULL,
`additional_properties` = NULL,
#' Initialize a new NestedOneOf class.
#'
#' @description
@ -24,10 +26,11 @@ NestedOneOf <- R6::R6Class(
#'
#' @param size size
#' @param nested_pig nested_pig
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`size` = NULL, `nested_pig` = NULL, ...
`size` = NULL, `nested_pig` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`size`)) {
stopifnot(is.numeric(`size`), length(`size`) == 1)
@ -37,6 +40,11 @@ NestedOneOf <- R6::R6Class(
stopifnot(R6::is.R6(`nested_pig`))
self$`nested_pig` <- `nested_pig`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ NestedOneOf <- R6::R6Class(
NestedOneOfObject[["nested_pig"]] <-
self$`nested_pig`$toJSON()
}
for (key in names(self$additional_properties)) {
NestedOneOfObject[[key]] <- self$additional_properties[[key]]
}
NestedOneOfObject
},
@ -105,7 +116,12 @@ NestedOneOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of NestedOneOf
#'

View File

@ -13,6 +13,7 @@
#' @field shipDate character [optional]
#' @field status character [optional]
#' @field complete character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -25,6 +26,7 @@ Order <- R6::R6Class(
`shipDate` = NULL,
`status` = NULL,
`complete` = NULL,
`additional_properties` = NULL,
#' Initialize a new Order class.
#'
#' @description
@ -36,10 +38,11 @@ Order <- R6::R6Class(
#' @param shipDate shipDate
#' @param status Order Status
#' @param complete complete. Default to FALSE.
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `petId` = NULL, `quantity` = NULL, `shipDate` = NULL, `status` = NULL, `complete` = FALSE, ...
`id` = NULL, `petId` = NULL, `quantity` = NULL, `shipDate` = NULL, `status` = NULL, `complete` = FALSE, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -65,6 +68,11 @@ Order <- R6::R6Class(
stopifnot(is.logical(`complete`), length(`complete`) == 1)
self$`complete` <- `complete`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -99,6 +107,9 @@ Order <- R6::R6Class(
OrderObject[["complete"]] <-
self$`complete`
}
for (key in names(self$additional_properties)) {
OrderObject[[key]] <- self$additional_properties[[key]]
}
OrderObject
},
@ -191,7 +202,12 @@ Order <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Order
#'

View File

@ -13,6 +13,7 @@
#' @field photoUrls list(character)
#' @field tags list(\link{Tag}) [optional]
#' @field status character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -25,6 +26,7 @@ Pet <- R6::R6Class(
`photoUrls` = NULL,
`tags` = NULL,
`status` = NULL,
`additional_properties` = NULL,
#' Initialize a new Pet class.
#'
#' @description
@ -36,10 +38,11 @@ Pet <- R6::R6Class(
#' @param category category
#' @param tags tags
#' @param status pet status in the store
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, ...
`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, additional_properties = NULL, ...
) {
if (!missing(`name`)) {
stopifnot(is.character(`name`), length(`name`) == 1)
@ -67,6 +70,11 @@ Pet <- R6::R6Class(
stopifnot(is.character(`status`), length(`status`) == 1)
self$`status` <- `status`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -101,6 +109,9 @@ Pet <- R6::R6Class(
PetObject[["status"]] <-
self$`status`
}
for (key in names(self$additional_properties)) {
PetObject[[key]] <- self$additional_properties[[key]]
}
PetObject
},
@ -195,7 +206,12 @@ Pet <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Pet
#'

View File

@ -13,6 +13,7 @@
#' @field 123_number character [optional]
#' @field array[test] character [optional]
#' @field empty_string character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -25,6 +26,7 @@ Special <- R6::R6Class(
`123_number` = NULL,
`array[test]` = NULL,
`empty_string` = NULL,
`additional_properties` = NULL,
#' Initialize a new Special class.
#'
#' @description
@ -36,10 +38,11 @@ Special <- R6::R6Class(
#' @param 123_number 123_number
#' @param array[test] array[test]
#' @param empty_string empty_string
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`item_self` = NULL, `item_private` = NULL, `item_super` = NULL, `123_number` = NULL, `array[test]` = NULL, `empty_string` = NULL, ...
`item_self` = NULL, `item_private` = NULL, `item_super` = NULL, `123_number` = NULL, `array[test]` = NULL, `empty_string` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`item_self`)) {
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
@ -65,6 +68,11 @@ Special <- R6::R6Class(
stopifnot(is.character(`empty_string`), length(`empty_string`) == 1)
self$`empty_string` <- `empty_string`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -99,6 +107,9 @@ Special <- R6::R6Class(
SpecialObject[["empty_string"]] <-
self$`empty_string`
}
for (key in names(self$additional_properties)) {
SpecialObject[[key]] <- self$additional_properties[[key]]
}
SpecialObject
},
@ -191,7 +202,12 @@ Special <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Special
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Tag <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
#' Initialize a new Tag class.
#'
#' @description
@ -24,10 +26,11 @@ Tag <- R6::R6Class(
#'
#' @param id id
#' @param name name
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `name` = NULL, ...
`id` = NULL, `name` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -37,6 +40,11 @@ Tag <- R6::R6Class(
stopifnot(is.character(`name`), length(`name`) == 1)
self$`name` <- `name`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Tag <- R6::R6Class(
TagObject[["name"]] <-
self$`name`
}
for (key in names(self$additional_properties)) {
TagObject[[key]] <- self$additional_properties[[key]]
}
TagObject
},
@ -103,7 +114,12 @@ Tag <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Tag
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field jsonData \link{Pet} [optional]
#' @field binaryDataN2Information data.frame [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ UpdatePetRequest <- R6::R6Class(
public = list(
`jsonData` = NULL,
`binaryDataN2Information` = NULL,
`additional_properties` = NULL,
#' Initialize a new UpdatePetRequest class.
#'
#' @description
@ -24,10 +26,11 @@ UpdatePetRequest <- R6::R6Class(
#'
#' @param jsonData jsonData
#' @param binaryDataN2Information binaryDataN2Information
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`jsonData` = NULL, `binaryDataN2Information` = NULL, ...
`jsonData` = NULL, `binaryDataN2Information` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`jsonData`)) {
stopifnot(R6::is.R6(`jsonData`))
@ -36,6 +39,11 @@ UpdatePetRequest <- R6::R6Class(
if (!is.null(`binaryDataN2Information`)) {
self$`binaryDataN2Information` <- `binaryDataN2Information`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -54,6 +62,9 @@ UpdatePetRequest <- R6::R6Class(
UpdatePetRequestObject[["binaryDataN2Information"]] <-
self$`binaryDataN2Information`
}
for (key in names(self$additional_properties)) {
UpdatePetRequestObject[[key]] <- self$additional_properties[[key]]
}
UpdatePetRequestObject
},
@ -104,7 +115,12 @@ UpdatePetRequest <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of UpdatePetRequest
#'

View File

@ -15,6 +15,7 @@
#' @field password character [optional]
#' @field phone character [optional]
#' @field userStatus integer [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -29,6 +30,7 @@ User <- R6::R6Class(
`password` = NULL,
`phone` = NULL,
`userStatus` = NULL,
`additional_properties` = NULL,
#' Initialize a new User class.
#'
#' @description
@ -42,10 +44,11 @@ User <- R6::R6Class(
#' @param password password
#' @param phone phone
#' @param userStatus User Status
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `username` = NULL, `firstName` = NULL, `lastName` = NULL, `email` = NULL, `password` = NULL, `phone` = NULL, `userStatus` = NULL, ...
`id` = NULL, `username` = NULL, `firstName` = NULL, `lastName` = NULL, `email` = NULL, `password` = NULL, `phone` = NULL, `userStatus` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -79,6 +82,11 @@ User <- R6::R6Class(
stopifnot(is.numeric(`userStatus`), length(`userStatus`) == 1)
self$`userStatus` <- `userStatus`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -121,6 +129,9 @@ User <- R6::R6Class(
UserObject[["userStatus"]] <-
self$`userStatus`
}
for (key in names(self$additional_properties)) {
UserObject[[key]] <- self$additional_properties[[key]]
}
UserObject
},
@ -235,7 +246,12 @@ User <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of User
#'

View File

@ -10,6 +10,7 @@
#' @field hasBaleen character [optional]
#' @field hasTeeth character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -19,6 +20,7 @@ Whale <- R6::R6Class(
`hasBaleen` = NULL,
`hasTeeth` = NULL,
`className` = NULL,
`additional_properties` = NULL,
#' Initialize a new Whale class.
#'
#' @description
@ -27,10 +29,11 @@ Whale <- R6::R6Class(
#' @param className className
#' @param hasBaleen hasBaleen
#' @param hasTeeth hasTeeth
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, ...
`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -44,6 +47,11 @@ Whale <- R6::R6Class(
stopifnot(is.logical(`hasTeeth`), length(`hasTeeth`) == 1)
self$`hasTeeth` <- `hasTeeth`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -66,6 +74,9 @@ Whale <- R6::R6Class(
WhaleObject[["className"]] <-
self$`className`
}
for (key in names(self$additional_properties)) {
WhaleObject[[key]] <- self$additional_properties[[key]]
}
WhaleObject
},
@ -125,7 +136,12 @@ Whale <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Whale
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field type character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Zebra <- R6::R6Class(
public = list(
`type` = NULL,
`className` = NULL,
`additional_properties` = NULL,
#' Initialize a new Zebra class.
#'
#' @description
@ -24,10 +26,11 @@ Zebra <- R6::R6Class(
#'
#' @param className className
#' @param type type
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `type` = NULL, ...
`className`, `type` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ Zebra <- R6::R6Class(
stopifnot(is.character(`type`), length(`type`) == 1)
self$`type` <- `type`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Zebra <- R6::R6Class(
ZebraObject[["className"]] <-
self$`className`
}
for (key in names(self$additional_properties)) {
ZebraObject[[key]] <- self$additional_properties[[key]]
}
ZebraObject
},
@ -103,7 +114,12 @@ Zebra <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Zebra
#'

View File

@ -3,6 +3,17 @@ install.packages("petstore_1.0.0.tar.gz",repos=NULL, type="source")
library(petstore)
library(jsonlite)
t <- Tag$new()
t$id <- 123
t$additional_properties <- c("abc" = 849, "array" = list('a', 'b', 'c'))
t$additional_properties
t$additional_properties["abc"]
t$additional_properties["array"]
print(t$toJSON())
print(t$toJSONString())
print("done tag")
whale_json <- '{"className": "whale", "hasBaleen": true, "hasTeeth": true}'
zebra_json <- '{"className": "zebra", "type": "plains"}'

View File

@ -21,6 +21,17 @@ pet_api$api_client$username <- "username123"
pet_api$api_client$password <- "password123"
result <- pet_api$add_pet(pet)
test_that("Additional Properties test", {
# test tag
t <- Tag$new(id = 393, name = "something")
t$additional_properties <- c("a1" = 998, "b2" = "bbccdd")
expect_equal(t$toJSONString(), "{\"id\":393,\"name\":\"something\",\"a1\":\"998\",\"b2\":\"bbccdd\"}")
# test tag with additional_properties in `new`
t <- Tag$new(id = 393, name = "something", additional_properties = list("nested_object" = list("inside_item" = 8989)))
expect_equal(t$toJSONString(), "{\"id\":393,\"name\":\"something\",\"nested_object\":{\"inside_item\":8989}}")
})
test_that("Test toJSON toJSONString fromJSON fromJSONString print", {
# test pet
expect_equal(pet_id, 123321)

View File

@ -88,7 +88,6 @@ AllofTagApiResponse <- R6::R6Class(
AllofTagApiResponseObject[["message"]] <-
self$`message`
}
AllofTagApiResponseObject
},
#' Deserialize JSON string into an instance of AllofTagApiResponse
@ -169,7 +168,7 @@ AllofTagApiResponse <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of AllofTagApiResponse
#'

View File

@ -55,7 +55,6 @@ Animal <- R6::R6Class(
AnimalObject[["color"]] <-
self$`color`
}
AnimalObject
},
#' Deserialize JSON string into an instance of Animal
@ -103,7 +102,7 @@ Animal <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Animal
#'

View File

@ -55,7 +55,6 @@ BasquePig <- R6::R6Class(
BasquePigObject[["color"]] <-
self$`color`
}
BasquePigObject
},
#' Deserialize JSON string into an instance of BasquePig
@ -103,7 +102,7 @@ BasquePig <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of BasquePig
#'

View File

@ -67,7 +67,6 @@ Cat <- R6::R6Class(
CatObject[["declawed"]] <-
self$`declawed`
}
CatObject
},
#' Deserialize JSON string into an instance of Cat
@ -126,7 +125,7 @@ Cat <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Cat
#'

View File

@ -44,7 +44,6 @@ CatAllOf <- R6::R6Class(
CatAllOfObject[["declawed"]] <-
self$`declawed`
}
CatAllOfObject
},
#' Deserialize JSON string into an instance of CatAllOf
@ -81,7 +80,7 @@ CatAllOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of CatAllOf
#'

View File

@ -55,7 +55,6 @@ Category <- R6::R6Class(
CategoryObject[["name"]] <-
self$`name`
}
CategoryObject
},
#' Deserialize JSON string into an instance of Category
@ -103,7 +102,7 @@ Category <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Category
#'

View File

@ -55,7 +55,6 @@ DanishPig <- R6::R6Class(
DanishPigObject[["size"]] <-
self$`size`
}
DanishPigObject
},
#' Deserialize JSON string into an instance of DanishPig
@ -103,7 +102,7 @@ DanishPig <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of DanishPig
#'

View File

@ -67,7 +67,6 @@ Dog <- R6::R6Class(
DogObject[["breed"]] <-
self$`breed`
}
DogObject
},
#' Deserialize JSON string into an instance of Dog
@ -126,7 +125,7 @@ Dog <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Dog
#'

View File

@ -44,7 +44,6 @@ DogAllOf <- R6::R6Class(
DogAllOfObject[["breed"]] <-
self$`breed`
}
DogAllOfObject
},
#' Deserialize JSON string into an instance of DogAllOf
@ -81,7 +80,7 @@ DogAllOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of DogAllOf
#'

View File

@ -66,7 +66,6 @@ ModelApiResponse <- R6::R6Class(
ModelApiResponseObject[["message"]] <-
self$`message`
}
ModelApiResponseObject
},
#' Deserialize JSON string into an instance of ModelApiResponse
@ -125,7 +124,7 @@ ModelApiResponse <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of ModelApiResponse
#'

View File

@ -55,7 +55,6 @@ NestedOneOf <- R6::R6Class(
NestedOneOfObject[["nested_pig"]] <-
self$`nested_pig`$toJSON()
}
NestedOneOfObject
},
#' Deserialize JSON string into an instance of NestedOneOf
@ -105,7 +104,7 @@ NestedOneOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of NestedOneOf
#'

View File

@ -99,7 +99,6 @@ Order <- R6::R6Class(
OrderObject[["complete"]] <-
self$`complete`
}
OrderObject
},
#' Deserialize JSON string into an instance of Order
@ -191,7 +190,7 @@ Order <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Order
#'

View File

@ -101,7 +101,6 @@ Pet <- R6::R6Class(
PetObject[["status"]] <-
self$`status`
}
PetObject
},
#' Deserialize JSON string into an instance of Pet
@ -195,7 +194,7 @@ Pet <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Pet
#'

View File

@ -99,7 +99,6 @@ Special <- R6::R6Class(
SpecialObject[["empty_string"]] <-
self$`empty_string`
}
SpecialObject
},
#' Deserialize JSON string into an instance of Special
@ -191,7 +190,7 @@ Special <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Special
#'

View File

@ -55,7 +55,6 @@ Tag <- R6::R6Class(
TagObject[["name"]] <-
self$`name`
}
TagObject
},
#' Deserialize JSON string into an instance of Tag
@ -103,7 +102,7 @@ Tag <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Tag
#'

View File

@ -54,7 +54,6 @@ UpdatePetRequest <- R6::R6Class(
UpdatePetRequestObject[["binaryDataN2Information"]] <-
self$`binaryDataN2Information`
}
UpdatePetRequestObject
},
#' Deserialize JSON string into an instance of UpdatePetRequest
@ -104,7 +103,7 @@ UpdatePetRequest <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of UpdatePetRequest
#'

View File

@ -121,7 +121,6 @@ User <- R6::R6Class(
UserObject[["userStatus"]] <-
self$`userStatus`
}
UserObject
},
#' Deserialize JSON string into an instance of User
@ -235,7 +234,7 @@ User <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of User
#'

View File

@ -66,7 +66,6 @@ Whale <- R6::R6Class(
WhaleObject[["className"]] <-
self$`className`
}
WhaleObject
},
#' Deserialize JSON string into an instance of Whale
@ -125,7 +124,7 @@ Whale <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Whale
#'

View File

@ -55,7 +55,6 @@ Zebra <- R6::R6Class(
ZebraObject[["className"]] <-
self$`className`
}
ZebraObject
},
#' Deserialize JSON string into an instance of Zebra
@ -103,7 +102,7 @@ Zebra <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Zebra
#'

View File

@ -3,6 +3,14 @@ install.packages("petstore_1.0.0.tar.gz",repos=NULL, type="source")
library(petstore)
library(jsonlite)
t <- Tag$new()
t$id <- 123
#t$additional_properties <- c("abc" = 849)
print(t$toJSON())
print(t$toJSONString())
print("done tag")
t <- OneOfPrimitiveTypeTest$new()
#t$fromJSONString("[1,2,3]")

View File

@ -12,6 +12,7 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -23,6 +24,7 @@ AllofTagApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
#' Initialize a new AllofTagApiResponse class.
#'
#' @description
@ -33,10 +35,11 @@ AllofTagApiResponse <- R6::R6Class(
#' @param code code
#' @param type type
#' @param message message
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, ...
`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -58,6 +61,11 @@ AllofTagApiResponse <- R6::R6Class(
stopifnot(is.character(`message`), length(`message`) == 1)
self$`message` <- `message`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -88,6 +96,9 @@ AllofTagApiResponse <- R6::R6Class(
AllofTagApiResponseObject[["message"]] <-
self$`message`
}
for (key in names(self$additional_properties)) {
AllofTagApiResponseObject[[key]] <- self$additional_properties[[key]]
}
AllofTagApiResponseObject
},
@ -169,7 +180,12 @@ AllofTagApiResponse <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of AllofTagApiResponse
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Animal <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
#' Initialize a new Animal class.
#'
#' @description
@ -24,10 +26,11 @@ Animal <- R6::R6Class(
#'
#' @param className className
#' @param color color. Default to "red".
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color` = "red", ...
`className`, `color` = "red", additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ Animal <- R6::R6Class(
stopifnot(is.character(`color`), length(`color`) == 1)
self$`color` <- `color`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Animal <- R6::R6Class(
AnimalObject[["color"]] <-
self$`color`
}
for (key in names(self$additional_properties)) {
AnimalObject[[key]] <- self$additional_properties[[key]]
}
AnimalObject
},
@ -103,7 +114,12 @@ Animal <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Animal
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ BasquePig <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
#' Initialize a new BasquePig class.
#'
#' @description
@ -24,10 +26,11 @@ BasquePig <- R6::R6Class(
#'
#' @param className className
#' @param color color
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color`, ...
`className`, `color`, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ BasquePig <- R6::R6Class(
stopifnot(is.character(`color`), length(`color`) == 1)
self$`color` <- `color`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ BasquePig <- R6::R6Class(
BasquePigObject[["color"]] <-
self$`color`
}
for (key in names(self$additional_properties)) {
BasquePigObject[[key]] <- self$additional_properties[[key]]
}
BasquePigObject
},
@ -103,7 +114,12 @@ BasquePig <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of BasquePig
#'

View File

@ -10,6 +10,7 @@
#' @field className character
#' @field color character [optional]
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,6 +21,7 @@ Cat <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`declawed` = NULL,
`additional_properties` = NULL,
#' Initialize a new Cat class.
#'
#' @description
@ -28,10 +30,11 @@ Cat <- R6::R6Class(
#' @param className className
#' @param color color. Default to "red".
#' @param declawed declawed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color` = "red", `declawed` = NULL, ...
`className`, `color` = "red", `declawed` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -45,6 +48,11 @@ Cat <- R6::R6Class(
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
self$`declawed` <- `declawed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -67,6 +75,9 @@ Cat <- R6::R6Class(
CatObject[["declawed"]] <-
self$`declawed`
}
for (key in names(self$additional_properties)) {
CatObject[[key]] <- self$additional_properties[[key]]
}
CatObject
},
@ -126,7 +137,12 @@ Cat <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Cat
#'

View File

@ -8,6 +8,7 @@
#' @description CatAllOf Class
#' @format An \code{R6Class} generator object
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -15,21 +16,28 @@ CatAllOf <- R6::R6Class(
"CatAllOf",
public = list(
`declawed` = NULL,
`additional_properties` = NULL,
#' Initialize a new CatAllOf class.
#'
#' @description
#' Initialize a new CatAllOf class.
#'
#' @param declawed declawed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`declawed` = NULL, ...
`declawed` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`declawed`)) {
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
self$`declawed` <- `declawed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -44,6 +52,9 @@ CatAllOf <- R6::R6Class(
CatAllOfObject[["declawed"]] <-
self$`declawed`
}
for (key in names(self$additional_properties)) {
CatAllOfObject[[key]] <- self$additional_properties[[key]]
}
CatAllOfObject
},
@ -81,7 +92,12 @@ CatAllOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of CatAllOf
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Category <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
#' Initialize a new Category class.
#'
#' @description
@ -24,10 +26,11 @@ Category <- R6::R6Class(
#'
#' @param id id
#' @param name name
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `name` = NULL, ...
`id` = NULL, `name` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -37,6 +40,11 @@ Category <- R6::R6Class(
stopifnot(is.character(`name`), length(`name`) == 1)
self$`name` <- `name`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Category <- R6::R6Class(
CategoryObject[["name"]] <-
self$`name`
}
for (key in names(self$additional_properties)) {
CategoryObject[[key]] <- self$additional_properties[[key]]
}
CategoryObject
},
@ -103,7 +114,12 @@ Category <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Category
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field size integer
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ DanishPig <- R6::R6Class(
public = list(
`className` = NULL,
`size` = NULL,
`additional_properties` = NULL,
#' Initialize a new DanishPig class.
#'
#' @description
@ -24,10 +26,11 @@ DanishPig <- R6::R6Class(
#'
#' @param className className
#' @param size size
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `size`, ...
`className`, `size`, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ DanishPig <- R6::R6Class(
stopifnot(is.numeric(`size`), length(`size`) == 1)
self$`size` <- `size`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ DanishPig <- R6::R6Class(
DanishPigObject[["size"]] <-
self$`size`
}
for (key in names(self$additional_properties)) {
DanishPigObject[[key]] <- self$additional_properties[[key]]
}
DanishPigObject
},
@ -103,7 +114,12 @@ DanishPig <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of DanishPig
#'

View File

@ -10,6 +10,7 @@
#' @field className character
#' @field color character [optional]
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,6 +21,7 @@ Dog <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`breed` = NULL,
`additional_properties` = NULL,
#' Initialize a new Dog class.
#'
#' @description
@ -28,10 +30,11 @@ Dog <- R6::R6Class(
#' @param className className
#' @param color color. Default to "red".
#' @param breed breed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `color` = "red", `breed` = NULL, ...
`className`, `color` = "red", `breed` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -45,6 +48,11 @@ Dog <- R6::R6Class(
stopifnot(is.character(`breed`), length(`breed`) == 1)
self$`breed` <- `breed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -67,6 +75,9 @@ Dog <- R6::R6Class(
DogObject[["breed"]] <-
self$`breed`
}
for (key in names(self$additional_properties)) {
DogObject[[key]] <- self$additional_properties[[key]]
}
DogObject
},
@ -126,7 +137,12 @@ Dog <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Dog
#'

View File

@ -8,6 +8,7 @@
#' @description DogAllOf Class
#' @format An \code{R6Class} generator object
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -15,21 +16,28 @@ DogAllOf <- R6::R6Class(
"DogAllOf",
public = list(
`breed` = NULL,
`additional_properties` = NULL,
#' Initialize a new DogAllOf class.
#'
#' @description
#' Initialize a new DogAllOf class.
#'
#' @param breed breed
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`breed` = NULL, ...
`breed` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`breed`)) {
stopifnot(is.character(`breed`), length(`breed`) == 1)
self$`breed` <- `breed`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -44,6 +52,9 @@ DogAllOf <- R6::R6Class(
DogAllOfObject[["breed"]] <-
self$`breed`
}
for (key in names(self$additional_properties)) {
DogAllOfObject[[key]] <- self$additional_properties[[key]]
}
DogAllOfObject
},
@ -81,7 +92,12 @@ DogAllOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of DogAllOf
#'

View File

@ -10,6 +10,7 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -19,6 +20,7 @@ ModelApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
#' Initialize a new ModelApiResponse class.
#'
#' @description
@ -27,10 +29,11 @@ ModelApiResponse <- R6::R6Class(
#' @param code code
#' @param type type
#' @param message message
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`code` = NULL, `type` = NULL, `message` = NULL, ...
`code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`code`)) {
stopifnot(is.numeric(`code`), length(`code`) == 1)
@ -44,6 +47,11 @@ ModelApiResponse <- R6::R6Class(
stopifnot(is.character(`message`), length(`message`) == 1)
self$`message` <- `message`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -66,6 +74,9 @@ ModelApiResponse <- R6::R6Class(
ModelApiResponseObject[["message"]] <-
self$`message`
}
for (key in names(self$additional_properties)) {
ModelApiResponseObject[[key]] <- self$additional_properties[[key]]
}
ModelApiResponseObject
},
@ -125,7 +136,12 @@ ModelApiResponse <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of ModelApiResponse
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field size integer [optional]
#' @field nested_pig \link{Pig} [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ NestedOneOf <- R6::R6Class(
public = list(
`size` = NULL,
`nested_pig` = NULL,
`additional_properties` = NULL,
#' Initialize a new NestedOneOf class.
#'
#' @description
@ -24,10 +26,11 @@ NestedOneOf <- R6::R6Class(
#'
#' @param size size
#' @param nested_pig nested_pig
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`size` = NULL, `nested_pig` = NULL, ...
`size` = NULL, `nested_pig` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`size`)) {
stopifnot(is.numeric(`size`), length(`size`) == 1)
@ -37,6 +40,11 @@ NestedOneOf <- R6::R6Class(
stopifnot(R6::is.R6(`nested_pig`))
self$`nested_pig` <- `nested_pig`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ NestedOneOf <- R6::R6Class(
NestedOneOfObject[["nested_pig"]] <-
self$`nested_pig`$toJSON()
}
for (key in names(self$additional_properties)) {
NestedOneOfObject[[key]] <- self$additional_properties[[key]]
}
NestedOneOfObject
},
@ -105,7 +116,12 @@ NestedOneOf <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of NestedOneOf
#'

View File

@ -13,6 +13,7 @@
#' @field shipDate character [optional]
#' @field status character [optional]
#' @field complete character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -25,6 +26,7 @@ Order <- R6::R6Class(
`shipDate` = NULL,
`status` = NULL,
`complete` = NULL,
`additional_properties` = NULL,
#' Initialize a new Order class.
#'
#' @description
@ -36,10 +38,11 @@ Order <- R6::R6Class(
#' @param shipDate shipDate
#' @param status Order Status
#' @param complete complete. Default to FALSE.
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `petId` = NULL, `quantity` = NULL, `shipDate` = NULL, `status` = NULL, `complete` = FALSE, ...
`id` = NULL, `petId` = NULL, `quantity` = NULL, `shipDate` = NULL, `status` = NULL, `complete` = FALSE, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -65,6 +68,11 @@ Order <- R6::R6Class(
stopifnot(is.logical(`complete`), length(`complete`) == 1)
self$`complete` <- `complete`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -99,6 +107,9 @@ Order <- R6::R6Class(
OrderObject[["complete"]] <-
self$`complete`
}
for (key in names(self$additional_properties)) {
OrderObject[[key]] <- self$additional_properties[[key]]
}
OrderObject
},
@ -191,7 +202,12 @@ Order <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Order
#'

View File

@ -13,6 +13,7 @@
#' @field photoUrls list(character)
#' @field tags list(\link{Tag}) [optional]
#' @field status character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -25,6 +26,7 @@ Pet <- R6::R6Class(
`photoUrls` = NULL,
`tags` = NULL,
`status` = NULL,
`additional_properties` = NULL,
#' Initialize a new Pet class.
#'
#' @description
@ -36,10 +38,11 @@ Pet <- R6::R6Class(
#' @param category category
#' @param tags tags
#' @param status pet status in the store
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, ...
`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, additional_properties = NULL, ...
) {
if (!missing(`name`)) {
stopifnot(is.character(`name`), length(`name`) == 1)
@ -67,6 +70,11 @@ Pet <- R6::R6Class(
stopifnot(is.character(`status`), length(`status`) == 1)
self$`status` <- `status`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -101,6 +109,9 @@ Pet <- R6::R6Class(
PetObject[["status"]] <-
self$`status`
}
for (key in names(self$additional_properties)) {
PetObject[[key]] <- self$additional_properties[[key]]
}
PetObject
},
@ -195,7 +206,12 @@ Pet <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Pet
#'

View File

@ -13,6 +13,7 @@
#' @field 123_number character [optional]
#' @field array[test] character [optional]
#' @field empty_string character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -25,6 +26,7 @@ Special <- R6::R6Class(
`123_number` = NULL,
`array[test]` = NULL,
`empty_string` = NULL,
`additional_properties` = NULL,
#' Initialize a new Special class.
#'
#' @description
@ -36,10 +38,11 @@ Special <- R6::R6Class(
#' @param 123_number 123_number
#' @param array[test] array[test]
#' @param empty_string empty_string
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`item_self` = NULL, `item_private` = NULL, `item_super` = NULL, `123_number` = NULL, `array[test]` = NULL, `empty_string` = NULL, ...
`item_self` = NULL, `item_private` = NULL, `item_super` = NULL, `123_number` = NULL, `array[test]` = NULL, `empty_string` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`item_self`)) {
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
@ -65,6 +68,11 @@ Special <- R6::R6Class(
stopifnot(is.character(`empty_string`), length(`empty_string`) == 1)
self$`empty_string` <- `empty_string`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -99,6 +107,9 @@ Special <- R6::R6Class(
SpecialObject[["empty_string"]] <-
self$`empty_string`
}
for (key in names(self$additional_properties)) {
SpecialObject[[key]] <- self$additional_properties[[key]]
}
SpecialObject
},
@ -191,7 +202,12 @@ Special <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Special
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Tag <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
#' Initialize a new Tag class.
#'
#' @description
@ -24,10 +26,11 @@ Tag <- R6::R6Class(
#'
#' @param id id
#' @param name name
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `name` = NULL, ...
`id` = NULL, `name` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -37,6 +40,11 @@ Tag <- R6::R6Class(
stopifnot(is.character(`name`), length(`name`) == 1)
self$`name` <- `name`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Tag <- R6::R6Class(
TagObject[["name"]] <-
self$`name`
}
for (key in names(self$additional_properties)) {
TagObject[[key]] <- self$additional_properties[[key]]
}
TagObject
},
@ -103,7 +114,12 @@ Tag <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Tag
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field jsonData \link{Pet} [optional]
#' @field binaryDataN2Information data.frame [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ UpdatePetRequest <- R6::R6Class(
public = list(
`jsonData` = NULL,
`binaryDataN2Information` = NULL,
`additional_properties` = NULL,
#' Initialize a new UpdatePetRequest class.
#'
#' @description
@ -24,10 +26,11 @@ UpdatePetRequest <- R6::R6Class(
#'
#' @param jsonData jsonData
#' @param binaryDataN2Information binaryDataN2Information
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`jsonData` = NULL, `binaryDataN2Information` = NULL, ...
`jsonData` = NULL, `binaryDataN2Information` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`jsonData`)) {
stopifnot(R6::is.R6(`jsonData`))
@ -36,6 +39,11 @@ UpdatePetRequest <- R6::R6Class(
if (!is.null(`binaryDataN2Information`)) {
self$`binaryDataN2Information` <- `binaryDataN2Information`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -54,6 +62,9 @@ UpdatePetRequest <- R6::R6Class(
UpdatePetRequestObject[["binaryDataN2Information"]] <-
self$`binaryDataN2Information`
}
for (key in names(self$additional_properties)) {
UpdatePetRequestObject[[key]] <- self$additional_properties[[key]]
}
UpdatePetRequestObject
},
@ -104,7 +115,12 @@ UpdatePetRequest <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of UpdatePetRequest
#'

View File

@ -15,6 +15,7 @@
#' @field password character [optional]
#' @field phone character [optional]
#' @field userStatus integer [optional]
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -29,6 +30,7 @@ User <- R6::R6Class(
`password` = NULL,
`phone` = NULL,
`userStatus` = NULL,
`additional_properties` = NULL,
#' Initialize a new User class.
#'
#' @description
@ -42,10 +44,11 @@ User <- R6::R6Class(
#' @param password password
#' @param phone phone
#' @param userStatus User Status
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`id` = NULL, `username` = NULL, `firstName` = NULL, `lastName` = NULL, `email` = NULL, `password` = NULL, `phone` = NULL, `userStatus` = NULL, ...
`id` = NULL, `username` = NULL, `firstName` = NULL, `lastName` = NULL, `email` = NULL, `password` = NULL, `phone` = NULL, `userStatus` = NULL, additional_properties = NULL, ...
) {
if (!is.null(`id`)) {
stopifnot(is.numeric(`id`), length(`id`) == 1)
@ -79,6 +82,11 @@ User <- R6::R6Class(
stopifnot(is.numeric(`userStatus`), length(`userStatus`) == 1)
self$`userStatus` <- `userStatus`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -121,6 +129,9 @@ User <- R6::R6Class(
UserObject[["userStatus"]] <-
self$`userStatus`
}
for (key in names(self$additional_properties)) {
UserObject[[key]] <- self$additional_properties[[key]]
}
UserObject
},
@ -235,7 +246,12 @@ User <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of User
#'

View File

@ -10,6 +10,7 @@
#' @field hasBaleen character [optional]
#' @field hasTeeth character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -19,6 +20,7 @@ Whale <- R6::R6Class(
`hasBaleen` = NULL,
`hasTeeth` = NULL,
`className` = NULL,
`additional_properties` = NULL,
#' Initialize a new Whale class.
#'
#' @description
@ -27,10 +29,11 @@ Whale <- R6::R6Class(
#' @param className className
#' @param hasBaleen hasBaleen
#' @param hasTeeth hasTeeth
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, ...
`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -44,6 +47,11 @@ Whale <- R6::R6Class(
stopifnot(is.logical(`hasTeeth`), length(`hasTeeth`) == 1)
self$`hasTeeth` <- `hasTeeth`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -66,6 +74,9 @@ Whale <- R6::R6Class(
WhaleObject[["className"]] <-
self$`className`
}
for (key in names(self$additional_properties)) {
WhaleObject[[key]] <- self$additional_properties[[key]]
}
WhaleObject
},
@ -125,7 +136,12 @@ Whale <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Whale
#'

View File

@ -9,6 +9,7 @@
#' @format An \code{R6Class} generator object
#' @field type character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -17,6 +18,7 @@ Zebra <- R6::R6Class(
public = list(
`type` = NULL,
`className` = NULL,
`additional_properties` = NULL,
#' Initialize a new Zebra class.
#'
#' @description
@ -24,10 +26,11 @@ Zebra <- R6::R6Class(
#'
#' @param className className
#' @param type type
#' @param additional_properties additonal properties (optional)
#' @param ... Other optional arguments.
#' @export
initialize = function(
`className`, `type` = NULL, ...
`className`, `type` = NULL, additional_properties = NULL, ...
) {
if (!missing(`className`)) {
stopifnot(is.character(`className`), length(`className`) == 1)
@ -37,6 +40,11 @@ Zebra <- R6::R6Class(
stopifnot(is.character(`type`), length(`type`) == 1)
self$`type` <- `type`
}
if (!is.null(additional_properties)) {
for (key in names(additional_properties)) {
self$additional_properties[[key]] <- additional_properties[[key]]
}
}
},
#' To JSON string
#'
@ -55,6 +63,9 @@ Zebra <- R6::R6Class(
ZebraObject[["className"]] <-
self$`className`
}
for (key in names(self$additional_properties)) {
ZebraObject[[key]] <- self$additional_properties[[key]]
}
ZebraObject
},
@ -103,7 +114,12 @@ Zebra <- R6::R6Class(
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
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)))
},
#' Deserialize JSON string into an instance of Zebra
#'