[R] Update fromJSON to handle additional properties (#13331)

* update fromJSON to handle additional properties

* update RoxygenNote to newer version
This commit is contained in:
William Cheng 2022-09-02 09:46:56 +08:00 committed by GitHub
parent fea42b547e
commit b6576d1173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 729 additions and 92 deletions

View File

@ -12,4 +12,4 @@ License: {{#lambdaLicense}}{{licenseInfo}}{{/lambdaLicense}}{{^licenseInfo}}Unli
LazyData: true
Suggests: testthat
Imports: jsonlite, httr{{#isHttr2}}2{{/isHttr2}}, R6, base64enc, stringr
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1

View File

@ -8,10 +8,11 @@
#' @description {{classname}} Class
#' @format An \code{R6Class} generator object
{{#vars}}
#' @field {{name}} {{title}} {{{vendorExtensions.x-r-doc-type}}}{{^required}} [optional]{{/required}}
#' @field {{name}} {{{description}}} {{{vendorExtensions.x-r-doc-type}}}{{^required}} [optional]{{/required}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
{{/isAdditionalPropertiesTrue}}
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
@ -26,7 +27,8 @@
`{{{name}}}` = NULL,
{{/vars}}
{{#isAdditionalPropertiesTrue}}
`additional_properties` = NULL,
`_field_list` = c({{#vars}}"{{{name}}}"{{^-last}}, {{/-last}}{{/vars}}),
`additional_properties` = list(),
{{/isAdditionalPropertiesTrue}}
#' Initialize a new {{{classname}}} class.
#'
@ -218,6 +220,15 @@
{{/isContainer}}
}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
{{/isAdditionalPropertiesTrue}}
self
},
#' To JSON string
@ -320,6 +331,15 @@
{{/isPrimitiveType}}
{{/isContainer}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
{{/isAdditionalPropertiesTrue}}
self
},
#' Validate JSON input with respect to {{classname}}

View File

@ -12,4 +12,4 @@ License: Apache License 2.0
LazyData: true
Suggests: testthat
Imports: jsonlite, httr2, R6, base64enc, stringr
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1

View File

@ -12,7 +12,8 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -24,7 +25,8 @@ AllofTagApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "name", "code", "type", "message"),
`additional_properties` = list(),
#' Initialize a new AllofTagApiResponse class.
#'
#' @description
@ -127,6 +129,13 @@ AllofTagApiResponse <- R6::R6Class(
if (!is.null(this_object$`message`)) {
self$`message` <- this_object$`message`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -202,6 +211,13 @@ AllofTagApiResponse <- R6::R6Class(
self$`code` <- this_object$`code`
self$`type` <- this_object$`type`
self$`message` <- this_object$`message`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to AllofTagApiResponse

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Animal <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color"),
`additional_properties` = list(),
#' Initialize a new Animal class.
#'
#' @description
@ -85,6 +87,13 @@ Animal <- R6::R6Class(
if (!is.null(this_object$`color`)) {
self$`color` <- this_object$`color`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Animal <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Animal

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ BasquePig <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color"),
`additional_properties` = list(),
#' Initialize a new BasquePig class.
#'
#' @description
@ -85,6 +87,13 @@ BasquePig <- R6::R6Class(
if (!is.null(this_object$`color`)) {
self$`color` <- this_object$`color`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ BasquePig <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to BasquePig

View File

@ -10,7 +10,8 @@
#' @field className character
#' @field color character [optional]
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -21,7 +22,8 @@ Cat <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`declawed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color", "declawed"),
`additional_properties` = list(),
#' Initialize a new Cat class.
#'
#' @description
@ -100,6 +102,13 @@ Cat <- R6::R6Class(
if (!is.null(this_object$`declawed`)) {
self$`declawed` <- this_object$`declawed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -157,6 +166,13 @@ Cat <- R6::R6Class(
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
self$`declawed` <- this_object$`declawed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Cat

View File

@ -8,7 +8,8 @@
#' @description CatAllOf Class
#' @format An \code{R6Class} generator object
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -16,7 +17,8 @@ CatAllOf <- R6::R6Class(
"CatAllOf",
public = list(
`declawed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("declawed"),
`additional_properties` = list(),
#' Initialize a new CatAllOf class.
#'
#' @description
@ -71,6 +73,13 @@ CatAllOf <- R6::R6Class(
if (!is.null(this_object$`declawed`)) {
self$`declawed` <- this_object$`declawed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -110,6 +119,13 @@ CatAllOf <- R6::R6Class(
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`declawed` <- this_object$`declawed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to CatAllOf

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Category <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "name"),
`additional_properties` = list(),
#' Initialize a new Category class.
#'
#' @description
@ -85,6 +87,13 @@ Category <- R6::R6Class(
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Category <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Category

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field size integer
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ DanishPig <- R6::R6Class(
public = list(
`className` = NULL,
`size` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "size"),
`additional_properties` = list(),
#' Initialize a new DanishPig class.
#'
#' @description
@ -85,6 +87,13 @@ DanishPig <- R6::R6Class(
if (!is.null(this_object$`size`)) {
self$`size` <- this_object$`size`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ DanishPig <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`className` <- this_object$`className`
self$`size` <- this_object$`size`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to DanishPig

View File

@ -10,7 +10,8 @@
#' @field className character
#' @field color character [optional]
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -21,7 +22,8 @@ Dog <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`breed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color", "breed"),
`additional_properties` = list(),
#' Initialize a new Dog class.
#'
#' @description
@ -100,6 +102,13 @@ Dog <- R6::R6Class(
if (!is.null(this_object$`breed`)) {
self$`breed` <- this_object$`breed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -157,6 +166,13 @@ Dog <- R6::R6Class(
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
self$`breed` <- this_object$`breed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Dog

View File

@ -8,7 +8,8 @@
#' @description DogAllOf Class
#' @format An \code{R6Class} generator object
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -16,7 +17,8 @@ DogAllOf <- R6::R6Class(
"DogAllOf",
public = list(
`breed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("breed"),
`additional_properties` = list(),
#' Initialize a new DogAllOf class.
#'
#' @description
@ -71,6 +73,13 @@ DogAllOf <- R6::R6Class(
if (!is.null(this_object$`breed`)) {
self$`breed` <- this_object$`breed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -110,6 +119,13 @@ DogAllOf <- R6::R6Class(
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`breed` <- this_object$`breed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to DogAllOf

View File

@ -10,7 +10,8 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,7 +21,8 @@ ModelApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
`_field_list` = c("code", "type", "message"),
`additional_properties` = list(),
#' Initialize a new ModelApiResponse class.
#'
#' @description
@ -99,6 +101,13 @@ ModelApiResponse <- R6::R6Class(
if (!is.null(this_object$`message`)) {
self$`message` <- this_object$`message`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -156,6 +165,13 @@ ModelApiResponse <- R6::R6Class(
self$`code` <- this_object$`code`
self$`type` <- this_object$`type`
self$`message` <- this_object$`message`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to ModelApiResponse

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field size integer [optional]
#' @field nested_pig \link{Pig} [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ NestedOneOf <- R6::R6Class(
public = list(
`size` = NULL,
`nested_pig` = NULL,
`additional_properties` = NULL,
`_field_list` = c("size", "nested_pig"),
`additional_properties` = list(),
#' Initialize a new NestedOneOf class.
#'
#' @description
@ -87,6 +89,13 @@ NestedOneOf <- R6::R6Class(
nested_pig_object$fromJSON(jsonlite::toJSON(this_object$nested_pig, auto_unbox = TRUE, digits = NA))
self$`nested_pig` <- nested_pig_object
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -135,6 +144,13 @@ NestedOneOf <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`size` <- this_object$`size`
self$`nested_pig` <- Pig$new()$fromJSON(jsonlite::toJSON(this_object$nested_pig, auto_unbox = TRUE, digits = NA))
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to NestedOneOf

View File

@ -11,9 +11,10 @@
#' @field petId integer [optional]
#' @field quantity integer [optional]
#' @field shipDate character [optional]
#' @field status character [optional]
#' @field status Order Status character [optional]
#' @field complete character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -26,7 +27,8 @@ Order <- R6::R6Class(
`shipDate` = NULL,
`status` = NULL,
`complete` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "petId", "quantity", "shipDate", "status", "complete"),
`additional_properties` = list(),
#' Initialize a new Order class.
#'
#' @description
@ -141,6 +143,13 @@ Order <- R6::R6Class(
if (!is.null(this_object$`complete`)) {
self$`complete` <- this_object$`complete`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -225,6 +234,13 @@ Order <- R6::R6Class(
self$`shipDate` <- this_object$`shipDate`
self$`status` <- this_object$`status`
self$`complete` <- this_object$`complete`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Order

View File

@ -12,8 +12,9 @@
#' @field name character
#' @field photoUrls list(character)
#' @field tags list(\link{Tag}) [optional]
#' @field status character [optional]
#' @field additional_properties named list(character) [optional]
#' @field status pet status in the store character [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -26,7 +27,8 @@ Pet <- R6::R6Class(
`photoUrls` = NULL,
`tags` = NULL,
`status` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "category", "name", "photoUrls", "tags", "status"),
`additional_properties` = list(),
#' Initialize a new Pet class.
#'
#' @description
@ -145,6 +147,13 @@ Pet <- R6::R6Class(
if (!is.null(this_object$`status`)) {
self$`status` <- this_object$`status`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -229,6 +238,13 @@ Pet <- R6::R6Class(
self$`photoUrls` <- ApiClient$new()$deserializeObj(this_object$`photoUrls`, "array[character]", loadNamespace("petstore"))
self$`tags` <- ApiClient$new()$deserializeObj(this_object$`tags`, "array[Tag]", loadNamespace("petstore"))
self$`status` <- this_object$`status`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Pet

View File

@ -13,7 +13,8 @@
#' @field 123_number character [optional]
#' @field array[test] character [optional]
#' @field empty_string character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -26,7 +27,8 @@ Special <- R6::R6Class(
`123_number` = NULL,
`array[test]` = NULL,
`empty_string` = NULL,
`additional_properties` = NULL,
`_field_list` = c("item_self", "item_private", "item_super", "123_number", "array[test]", "empty_string"),
`additional_properties` = list(),
#' Initialize a new Special class.
#'
#' @description
@ -141,6 +143,13 @@ Special <- R6::R6Class(
if (!is.null(this_object$`empty_string`)) {
self$`empty_string` <- this_object$`empty_string`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -225,6 +234,13 @@ Special <- R6::R6Class(
self$`123_number` <- this_object$`123_number`
self$`array[test]` <- this_object$`array[test]`
self$`empty_string` <- this_object$`empty_string`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Special

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Tag <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "name"),
`additional_properties` = list(),
#' Initialize a new Tag class.
#'
#' @description
@ -85,6 +87,13 @@ Tag <- R6::R6Class(
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Tag <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Tag

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field jsonData \link{Pet} [optional]
#' @field binaryDataN2Information data.frame [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ UpdatePetRequest <- R6::R6Class(
public = list(
`jsonData` = NULL,
`binaryDataN2Information` = NULL,
`additional_properties` = NULL,
`_field_list` = c("jsonData", "binaryDataN2Information"),
`additional_properties` = list(),
#' Initialize a new UpdatePetRequest class.
#'
#' @description
@ -86,6 +88,13 @@ UpdatePetRequest <- R6::R6Class(
if (!is.null(this_object$`binaryDataN2Information`)) {
self$`binaryDataN2Information` <- this_object$`binaryDataN2Information`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -134,6 +143,13 @@ UpdatePetRequest <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`jsonData` <- Pet$new()$fromJSON(jsonlite::toJSON(this_object$jsonData, auto_unbox = TRUE, digits = NA))
self$`binaryDataN2Information` <- this_object$`binaryDataN2Information`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to UpdatePetRequest

View File

@ -14,8 +14,9 @@
#' @field email character [optional]
#' @field password character [optional]
#' @field phone character [optional]
#' @field userStatus integer [optional]
#' @field additional_properties named list(character) [optional]
#' @field userStatus User Status integer [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -30,7 +31,8 @@ User <- R6::R6Class(
`password` = NULL,
`phone` = NULL,
`userStatus` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"),
`additional_properties` = list(),
#' Initialize a new User class.
#'
#' @description
@ -169,6 +171,13 @@ User <- R6::R6Class(
if (!is.null(this_object$`userStatus`)) {
self$`userStatus` <- this_object$`userStatus`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -271,6 +280,13 @@ User <- R6::R6Class(
self$`password` <- this_object$`password`
self$`phone` <- this_object$`phone`
self$`userStatus` <- this_object$`userStatus`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to User

View File

@ -10,7 +10,8 @@
#' @field hasBaleen character [optional]
#' @field hasTeeth character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,7 +21,8 @@ Whale <- R6::R6Class(
`hasBaleen` = NULL,
`hasTeeth` = NULL,
`className` = NULL,
`additional_properties` = NULL,
`_field_list` = c("hasBaleen", "hasTeeth", "className"),
`additional_properties` = list(),
#' Initialize a new Whale class.
#'
#' @description
@ -99,6 +101,13 @@ Whale <- R6::R6Class(
if (!is.null(this_object$`className`)) {
self$`className` <- this_object$`className`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -156,6 +165,13 @@ Whale <- R6::R6Class(
self$`hasBaleen` <- this_object$`hasBaleen`
self$`hasTeeth` <- this_object$`hasTeeth`
self$`className` <- this_object$`className`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Whale

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field type character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Zebra <- R6::R6Class(
public = list(
`type` = NULL,
`className` = NULL,
`additional_properties` = NULL,
`_field_list` = c("type", "className"),
`additional_properties` = list(),
#' Initialize a new Zebra class.
#'
#' @description
@ -85,6 +87,13 @@ Zebra <- R6::R6Class(
if (!is.null(this_object$`className`)) {
self$`className` <- this_object$`className`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Zebra <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`type` <- this_object$`type`
self$`className` <- this_object$`className`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Zebra

View File

@ -30,6 +30,15 @@ test_that("Additional Properties test", {
# 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 fromJSONString
json <- "{\"id\":393,\"name\":\"something\",\"a1\":\"998\",\"b2\":\"bbccdd\"}"
t2 <- Tag$new()
t2$fromJSONString(json)
expect_equal(t2$id, 393)
expect_equal(t2$name, "something")
expect_equal(t2$additional_properties[["a1"]], "998")
expect_equal(t2$additional_properties[["b2"]], "bbccdd")
})
test_that("Test toJSON toJSONString fromJSON fromJSONString print", {

View File

@ -12,4 +12,4 @@ License: Apache License 2.0
LazyData: true
Suggests: testthat
Imports: jsonlite, httr2, R6, base64enc, stringr
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1

View File

@ -11,7 +11,7 @@
#' @field petId integer [optional]
#' @field quantity integer [optional]
#' @field shipDate character [optional]
#' @field status character [optional]
#' @field status Order Status character [optional]
#' @field complete character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON

View File

@ -12,7 +12,7 @@
#' @field name character
#' @field photoUrls list(character)
#' @field tags list(\link{Tag}) [optional]
#' @field status character [optional]
#' @field status pet status in the store character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export

View File

@ -14,7 +14,7 @@
#' @field email character [optional]
#' @field password character [optional]
#' @field phone character [optional]
#' @field userStatus integer [optional]
#' @field userStatus User Status integer [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export

View File

@ -12,4 +12,4 @@ License: Apache License 2.0
LazyData: true
Suggests: testthat
Imports: jsonlite, httr, R6, base64enc, stringr
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1

View File

@ -12,7 +12,8 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -24,7 +25,8 @@ AllofTagApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "name", "code", "type", "message"),
`additional_properties` = list(),
#' Initialize a new AllofTagApiResponse class.
#'
#' @description
@ -127,6 +129,13 @@ AllofTagApiResponse <- R6::R6Class(
if (!is.null(this_object$`message`)) {
self$`message` <- this_object$`message`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -202,6 +211,13 @@ AllofTagApiResponse <- R6::R6Class(
self$`code` <- this_object$`code`
self$`type` <- this_object$`type`
self$`message` <- this_object$`message`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to AllofTagApiResponse

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Animal <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color"),
`additional_properties` = list(),
#' Initialize a new Animal class.
#'
#' @description
@ -85,6 +87,13 @@ Animal <- R6::R6Class(
if (!is.null(this_object$`color`)) {
self$`color` <- this_object$`color`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Animal <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Animal

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field color character
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ BasquePig <- R6::R6Class(
public = list(
`className` = NULL,
`color` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color"),
`additional_properties` = list(),
#' Initialize a new BasquePig class.
#'
#' @description
@ -85,6 +87,13 @@ BasquePig <- R6::R6Class(
if (!is.null(this_object$`color`)) {
self$`color` <- this_object$`color`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ BasquePig <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to BasquePig

View File

@ -10,7 +10,8 @@
#' @field className character
#' @field color character [optional]
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -21,7 +22,8 @@ Cat <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`declawed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color", "declawed"),
`additional_properties` = list(),
#' Initialize a new Cat class.
#'
#' @description
@ -100,6 +102,13 @@ Cat <- R6::R6Class(
if (!is.null(this_object$`declawed`)) {
self$`declawed` <- this_object$`declawed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -157,6 +166,13 @@ Cat <- R6::R6Class(
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
self$`declawed` <- this_object$`declawed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Cat

View File

@ -8,7 +8,8 @@
#' @description CatAllOf Class
#' @format An \code{R6Class} generator object
#' @field declawed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -16,7 +17,8 @@ CatAllOf <- R6::R6Class(
"CatAllOf",
public = list(
`declawed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("declawed"),
`additional_properties` = list(),
#' Initialize a new CatAllOf class.
#'
#' @description
@ -71,6 +73,13 @@ CatAllOf <- R6::R6Class(
if (!is.null(this_object$`declawed`)) {
self$`declawed` <- this_object$`declawed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -110,6 +119,13 @@ CatAllOf <- R6::R6Class(
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`declawed` <- this_object$`declawed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to CatAllOf

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Category <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "name"),
`additional_properties` = list(),
#' Initialize a new Category class.
#'
#' @description
@ -85,6 +87,13 @@ Category <- R6::R6Class(
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Category <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Category

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field className character
#' @field size integer
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ DanishPig <- R6::R6Class(
public = list(
`className` = NULL,
`size` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "size"),
`additional_properties` = list(),
#' Initialize a new DanishPig class.
#'
#' @description
@ -85,6 +87,13 @@ DanishPig <- R6::R6Class(
if (!is.null(this_object$`size`)) {
self$`size` <- this_object$`size`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ DanishPig <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`className` <- this_object$`className`
self$`size` <- this_object$`size`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to DanishPig

View File

@ -10,7 +10,8 @@
#' @field className character
#' @field color character [optional]
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -21,7 +22,8 @@ Dog <- R6::R6Class(
`className` = NULL,
`color` = NULL,
`breed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("className", "color", "breed"),
`additional_properties` = list(),
#' Initialize a new Dog class.
#'
#' @description
@ -100,6 +102,13 @@ Dog <- R6::R6Class(
if (!is.null(this_object$`breed`)) {
self$`breed` <- this_object$`breed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -157,6 +166,13 @@ Dog <- R6::R6Class(
self$`className` <- this_object$`className`
self$`color` <- this_object$`color`
self$`breed` <- this_object$`breed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Dog

View File

@ -8,7 +8,8 @@
#' @description DogAllOf Class
#' @format An \code{R6Class} generator object
#' @field breed character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -16,7 +17,8 @@ DogAllOf <- R6::R6Class(
"DogAllOf",
public = list(
`breed` = NULL,
`additional_properties` = NULL,
`_field_list` = c("breed"),
`additional_properties` = list(),
#' Initialize a new DogAllOf class.
#'
#' @description
@ -71,6 +73,13 @@ DogAllOf <- R6::R6Class(
if (!is.null(this_object$`breed`)) {
self$`breed` <- this_object$`breed`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -110,6 +119,13 @@ DogAllOf <- R6::R6Class(
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`breed` <- this_object$`breed`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to DogAllOf

View File

@ -10,7 +10,8 @@
#' @field code integer [optional]
#' @field type character [optional]
#' @field message character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,7 +21,8 @@ ModelApiResponse <- R6::R6Class(
`code` = NULL,
`type` = NULL,
`message` = NULL,
`additional_properties` = NULL,
`_field_list` = c("code", "type", "message"),
`additional_properties` = list(),
#' Initialize a new ModelApiResponse class.
#'
#' @description
@ -99,6 +101,13 @@ ModelApiResponse <- R6::R6Class(
if (!is.null(this_object$`message`)) {
self$`message` <- this_object$`message`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -156,6 +165,13 @@ ModelApiResponse <- R6::R6Class(
self$`code` <- this_object$`code`
self$`type` <- this_object$`type`
self$`message` <- this_object$`message`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to ModelApiResponse

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field size integer [optional]
#' @field nested_pig \link{Pig} [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ NestedOneOf <- R6::R6Class(
public = list(
`size` = NULL,
`nested_pig` = NULL,
`additional_properties` = NULL,
`_field_list` = c("size", "nested_pig"),
`additional_properties` = list(),
#' Initialize a new NestedOneOf class.
#'
#' @description
@ -87,6 +89,13 @@ NestedOneOf <- R6::R6Class(
nested_pig_object$fromJSON(jsonlite::toJSON(this_object$nested_pig, auto_unbox = TRUE, digits = NA))
self$`nested_pig` <- nested_pig_object
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -135,6 +144,13 @@ NestedOneOf <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`size` <- this_object$`size`
self$`nested_pig` <- Pig$new()$fromJSON(jsonlite::toJSON(this_object$nested_pig, auto_unbox = TRUE, digits = NA))
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to NestedOneOf

View File

@ -11,9 +11,10 @@
#' @field petId integer [optional]
#' @field quantity integer [optional]
#' @field shipDate character [optional]
#' @field status character [optional]
#' @field status Order Status character [optional]
#' @field complete character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -26,7 +27,8 @@ Order <- R6::R6Class(
`shipDate` = NULL,
`status` = NULL,
`complete` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "petId", "quantity", "shipDate", "status", "complete"),
`additional_properties` = list(),
#' Initialize a new Order class.
#'
#' @description
@ -141,6 +143,13 @@ Order <- R6::R6Class(
if (!is.null(this_object$`complete`)) {
self$`complete` <- this_object$`complete`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -225,6 +234,13 @@ Order <- R6::R6Class(
self$`shipDate` <- this_object$`shipDate`
self$`status` <- this_object$`status`
self$`complete` <- this_object$`complete`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Order

View File

@ -12,8 +12,9 @@
#' @field name character
#' @field photoUrls list(character)
#' @field tags list(\link{Tag}) [optional]
#' @field status character [optional]
#' @field additional_properties named list(character) [optional]
#' @field status pet status in the store character [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -26,7 +27,8 @@ Pet <- R6::R6Class(
`photoUrls` = NULL,
`tags` = NULL,
`status` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "category", "name", "photoUrls", "tags", "status"),
`additional_properties` = list(),
#' Initialize a new Pet class.
#'
#' @description
@ -145,6 +147,13 @@ Pet <- R6::R6Class(
if (!is.null(this_object$`status`)) {
self$`status` <- this_object$`status`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -229,6 +238,13 @@ Pet <- R6::R6Class(
self$`photoUrls` <- ApiClient$new()$deserializeObj(this_object$`photoUrls`, "array[character]", loadNamespace("petstore"))
self$`tags` <- ApiClient$new()$deserializeObj(this_object$`tags`, "array[Tag]", loadNamespace("petstore"))
self$`status` <- this_object$`status`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Pet

View File

@ -13,7 +13,8 @@
#' @field 123_number character [optional]
#' @field array[test] character [optional]
#' @field empty_string character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -26,7 +27,8 @@ Special <- R6::R6Class(
`123_number` = NULL,
`array[test]` = NULL,
`empty_string` = NULL,
`additional_properties` = NULL,
`_field_list` = c("item_self", "item_private", "item_super", "123_number", "array[test]", "empty_string"),
`additional_properties` = list(),
#' Initialize a new Special class.
#'
#' @description
@ -141,6 +143,13 @@ Special <- R6::R6Class(
if (!is.null(this_object$`empty_string`)) {
self$`empty_string` <- this_object$`empty_string`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -225,6 +234,13 @@ Special <- R6::R6Class(
self$`123_number` <- this_object$`123_number`
self$`array[test]` <- this_object$`array[test]`
self$`empty_string` <- this_object$`empty_string`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Special

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Tag <- R6::R6Class(
public = list(
`id` = NULL,
`name` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "name"),
`additional_properties` = list(),
#' Initialize a new Tag class.
#'
#' @description
@ -85,6 +87,13 @@ Tag <- R6::R6Class(
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Tag <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Tag

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field jsonData \link{Pet} [optional]
#' @field binaryDataN2Information data.frame [optional]
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ UpdatePetRequest <- R6::R6Class(
public = list(
`jsonData` = NULL,
`binaryDataN2Information` = NULL,
`additional_properties` = NULL,
`_field_list` = c("jsonData", "binaryDataN2Information"),
`additional_properties` = list(),
#' Initialize a new UpdatePetRequest class.
#'
#' @description
@ -86,6 +88,13 @@ UpdatePetRequest <- R6::R6Class(
if (!is.null(this_object$`binaryDataN2Information`)) {
self$`binaryDataN2Information` <- this_object$`binaryDataN2Information`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -134,6 +143,13 @@ UpdatePetRequest <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`jsonData` <- Pet$new()$fromJSON(jsonlite::toJSON(this_object$jsonData, auto_unbox = TRUE, digits = NA))
self$`binaryDataN2Information` <- this_object$`binaryDataN2Information`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to UpdatePetRequest

View File

@ -14,8 +14,9 @@
#' @field email character [optional]
#' @field password character [optional]
#' @field phone character [optional]
#' @field userStatus integer [optional]
#' @field additional_properties named list(character) [optional]
#' @field userStatus User Status integer [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -30,7 +31,8 @@ User <- R6::R6Class(
`password` = NULL,
`phone` = NULL,
`userStatus` = NULL,
`additional_properties` = NULL,
`_field_list` = c("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"),
`additional_properties` = list(),
#' Initialize a new User class.
#'
#' @description
@ -169,6 +171,13 @@ User <- R6::R6Class(
if (!is.null(this_object$`userStatus`)) {
self$`userStatus` <- this_object$`userStatus`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -271,6 +280,13 @@ User <- R6::R6Class(
self$`password` <- this_object$`password`
self$`phone` <- this_object$`phone`
self$`userStatus` <- this_object$`userStatus`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to User

View File

@ -10,7 +10,8 @@
#' @field hasBaleen character [optional]
#' @field hasTeeth character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -20,7 +21,8 @@ Whale <- R6::R6Class(
`hasBaleen` = NULL,
`hasTeeth` = NULL,
`className` = NULL,
`additional_properties` = NULL,
`_field_list` = c("hasBaleen", "hasTeeth", "className"),
`additional_properties` = list(),
#' Initialize a new Whale class.
#'
#' @description
@ -99,6 +101,13 @@ Whale <- R6::R6Class(
if (!is.null(this_object$`className`)) {
self$`className` <- this_object$`className`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -156,6 +165,13 @@ Whale <- R6::R6Class(
self$`hasBaleen` <- this_object$`hasBaleen`
self$`hasTeeth` <- this_object$`hasTeeth`
self$`className` <- this_object$`className`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Whale

View File

@ -9,7 +9,8 @@
#' @format An \code{R6Class} generator object
#' @field type character [optional]
#' @field className character
#' @field additional_properties named list(character) [optional]
#' @field _field_list a list of fields list(character)
#' @field additional_properties additional properties list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
@ -18,7 +19,8 @@ Zebra <- R6::R6Class(
public = list(
`type` = NULL,
`className` = NULL,
`additional_properties` = NULL,
`_field_list` = c("type", "className"),
`additional_properties` = list(),
#' Initialize a new Zebra class.
#'
#' @description
@ -85,6 +87,13 @@ Zebra <- R6::R6Class(
if (!is.null(this_object$`className`)) {
self$`className` <- this_object$`className`
}
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' To JSON string
@ -133,6 +142,13 @@ Zebra <- R6::R6Class(
this_object <- jsonlite::fromJSON(input_json)
self$`type` <- this_object$`type`
self$`className` <- this_object$`className`
# process additional properties/fields in the payload
for (key in names(this_object)) {
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
self$additional_properties[[key]] <- this_object[[key]]
}
}
self
},
#' Validate JSON input with respect to Zebra