forked from loafle/openapi-generator-original
better error handling in the r client (#13800)
This commit is contained in:
parent
6650ba6406
commit
d74c49b93d
@ -60,37 +60,49 @@
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{#isInteger}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be an integer:", `{{name}}`))
|
||||
}
|
||||
{{/isInteger}}
|
||||
{{#isLong}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be an integer:", `{{name}}`))
|
||||
}
|
||||
{{/isLong}}
|
||||
{{#isFloat}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a number:", `{{name}}`))
|
||||
}
|
||||
{{/isFloat}}
|
||||
{{#isDouble}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a number:", `{{name}}`))
|
||||
}
|
||||
{{/isDouble}}
|
||||
{{#isString}}
|
||||
stopifnot(is.character(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.character(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", `{{name}}`))
|
||||
}
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
stopifnot(is.logical(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.logical(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a boolean:", `{{name}}`))
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{#isDate}}
|
||||
if (!is.character(`{{name}}`)) {
|
||||
stop(paste("Error! Invalid Date. Must be a string:", `{{name}}`))
|
||||
if (!(is.character(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", `{{name}}`))
|
||||
}
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
if (!is.character(`{{name}}`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `{{name}}`))
|
||||
if (!(is.character(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", `{{name}}`))
|
||||
}
|
||||
{{/isDateTime}}
|
||||
{{#isUri}}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(`{{name}}`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", `{{name}}`))
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a URL:", `{{name}}`))
|
||||
}
|
||||
{{/isUri}}
|
||||
{{^isPrimitiveType}}
|
||||
@ -120,37 +132,49 @@
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{#isInteger}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be an integer:", `{{name}}`))
|
||||
}
|
||||
{{/isInteger}}
|
||||
{{#isLong}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be an integer:", `{{name}}`))
|
||||
}
|
||||
{{/isLong}}
|
||||
{{#isFloat}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a number:", `{{name}}`))
|
||||
}
|
||||
{{/isFloat}}
|
||||
{{#isDouble}}
|
||||
stopifnot(is.numeric(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.numeric(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a number:", `{{name}}`))
|
||||
}
|
||||
{{/isDouble}}
|
||||
{{#isString}}
|
||||
stopifnot(is.character(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.character(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", `{{name}}`))
|
||||
}
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
stopifnot(is.logical(`{{name}}`), length(`{{name}}`) == 1)
|
||||
if (!(is.logical(`{{name}}`) && length(`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a boolean:", `{{name}}`))
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{#isDate}}
|
||||
if (!is.character(`{{name}}`)) {
|
||||
stop(paste("Error! Invalid Date. Must be a string:", `{{name}}`))
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", `{{name}}`))
|
||||
}
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
if (!is.character(`{{name}}`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `{{name}}`))
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", `{{name}}`))
|
||||
}
|
||||
{{/isDateTime}}
|
||||
{{#isUri}}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(`{{name}}`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", `{{name}}`))
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a URL:", `{{name}}`))
|
||||
}
|
||||
{{/isUri}}
|
||||
{{^isPrimitiveType}}
|
||||
@ -259,7 +283,7 @@
|
||||
{{#isUri}}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`{{baseName}}`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`{{baseName}}`))
|
||||
stop(paste("Error! Invalid data for `{{baseName}}`. Must be a URL:", this_object$`{{baseName}}`))
|
||||
}
|
||||
{{/isUri}}
|
||||
self$`{{name}}` <- this_object$`{{baseName}}`
|
||||
@ -391,7 +415,7 @@
|
||||
{{#isUri}}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`{{name}}`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`{{name}}`))
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a URL:", this_object$`{{name}}`))
|
||||
}
|
||||
{{/isUri}}
|
||||
self$`{{name}}` <- this_object$`{{name}}`
|
||||
@ -426,33 +450,49 @@
|
||||
if (!is.null(input_json$`{{name}}`)) {
|
||||
{{^isContainer}}
|
||||
{{#isInteger}}
|
||||
stopifnot(is.numeric(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.numeric(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be an integer:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isInteger}}
|
||||
{{#isLong}}
|
||||
stopifnot(is.numeric(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.numeric(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be an integer:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isLong}}
|
||||
{{#isFloat}}
|
||||
stopifnot(is.numeric(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.numeric(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a number:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isFloat}}
|
||||
{{#isDouble}}
|
||||
stopifnot(is.numeric(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.numeric(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a number:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isDouble}}
|
||||
{{#isString}}
|
||||
stopifnot(is.character(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.character(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
stopifnot(is.logical(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.logical(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a boolean:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{#isDate}}
|
||||
stopifnot(is.character(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.character(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
stopifnot(is.character(input_json$`{{name}}`), length(input_json$`{{name}}`) == 1)
|
||||
if (!(is.character(input_json$`{{name}}`) && length(input_json$`{{name}}`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a string:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isDateTime}}
|
||||
{{#isUri}}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(input_json$`{{name}}`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", input_json$`{{name}}`))
|
||||
stop(paste("Error! Invalid data for `{{name}}`. Must be a URL:", input_json$`{{name}}`))
|
||||
}
|
||||
{{/isUri}}
|
||||
{{^isPrimitiveType}}
|
||||
|
@ -42,23 +42,33 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(`code`)) {
|
||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||
if (!(is.numeric(`code`) && length(`code`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `code`. Must be an integer:", `code`))
|
||||
}
|
||||
self$`code` <- `code`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(`message`)) {
|
||||
stopifnot(is.character(`message`), length(`message`) == 1)
|
||||
if (!(is.character(`message`) && length(`message`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `message`. Must be a string:", `message`))
|
||||
}
|
||||
self$`message` <- `message`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -35,11 +35,15 @@ Animal <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -162,7 +166,9 @@ Animal <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Animal: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -33,11 +33,15 @@ BasquePig <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color`, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -160,13 +164,17 @@ BasquePig <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for BasquePig: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `color`
|
||||
if (!is.null(input_json$`color`)) {
|
||||
stopifnot(is.character(input_json$`color`), length(input_json$`color`) == 1)
|
||||
if (!(is.character(input_json$`color`) && length(input_json$`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", input_json$`color`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for BasquePig: the required field `color` is missing."))
|
||||
}
|
||||
|
@ -37,15 +37,21 @@ Cat <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", `declawed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(`declawed`)) {
|
||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||
if (!(is.logical(`declawed`) && length(`declawed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `declawed`. Must be a boolean:", `declawed`))
|
||||
}
|
||||
self$`declawed` <- `declawed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -184,7 +190,9 @@ Cat <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Cat: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ CatAllOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`declawed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`declawed`)) {
|
||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||
if (!(is.logical(`declawed`) && length(`declawed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `declawed`. Must be a boolean:", `declawed`))
|
||||
}
|
||||
self$`declawed` <- `declawed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,11 +33,15 @@ Category <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,11 +33,15 @@ DanishPig <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `size`, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`size`)) {
|
||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||
if (!(is.numeric(`size`) && length(`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", `size`))
|
||||
}
|
||||
self$`size` <- `size`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -160,13 +164,17 @@ DanishPig <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for DanishPig: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `size`
|
||||
if (!is.null(input_json$`size`)) {
|
||||
stopifnot(is.numeric(input_json$`size`), length(input_json$`size`) == 1)
|
||||
if (!(is.numeric(input_json$`size`) && length(input_json$`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", input_json$`size`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for DanishPig: the required field `size` is missing."))
|
||||
}
|
||||
|
@ -36,19 +36,25 @@ Date <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `url_property`, `percent_description` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`url_property`)) {
|
||||
stopifnot(is.character(`url_property`), length(`url_property`) == 1)
|
||||
if (!(is.character(`url_property`) && length(`url_property`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a string:", `url_property`))
|
||||
}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", `url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", `url_property`))
|
||||
}
|
||||
self$`url_property` <- `url_property`
|
||||
}
|
||||
if (!is.null(`percent_description`)) {
|
||||
stopifnot(is.character(`percent_description`), length(`percent_description`) == 1)
|
||||
if (!(is.character(`percent_description`) && length(`percent_description`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `percent_description`. Must be a string:", `percent_description`))
|
||||
}
|
||||
self$`percent_description` <- `percent_description`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -103,7 +109,7 @@ Date <- R6::R6Class(
|
||||
if (!is.null(this_object$`url_property`)) {
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", this_object$`url_property`))
|
||||
}
|
||||
self$`url_property` <- this_object$`url_property`
|
||||
}
|
||||
@ -172,7 +178,7 @@ Date <- R6::R6Class(
|
||||
self$`percent_description` <- this_object$`percent_description`
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", this_object$`url_property`))
|
||||
}
|
||||
self$`url_property` <- this_object$`url_property`
|
||||
# process additional properties/fields in the payload
|
||||
@ -195,16 +201,20 @@ Date <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Date: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `url_property`
|
||||
if (!is.null(input_json$`url_property`)) {
|
||||
stopifnot(is.character(input_json$`url_property`), length(input_json$`url_property`) == 1)
|
||||
if (!(is.character(input_json$`url_property`) && length(input_json$`url_property`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a string:", input_json$`url_property`))
|
||||
}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(input_json$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", input_json$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", input_json$`url_property`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Date: the required field `url_property` is missing."))
|
||||
|
@ -37,15 +37,21 @@ Dog <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", `breed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(`breed`)) {
|
||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||
if (!(is.character(`breed`) && length(`breed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `breed`. Must be a string:", `breed`))
|
||||
}
|
||||
self$`breed` <- `breed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -184,7 +190,9 @@ Dog <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Dog: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ DogAllOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`breed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`breed`)) {
|
||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||
if (!(is.character(`breed`) && length(`breed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `breed`. Must be a string:", `breed`))
|
||||
}
|
||||
self$`breed` <- `breed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -78,37 +78,51 @@ FormatTest <- R6::R6Class(
|
||||
self$`byte` <- `byte`
|
||||
}
|
||||
if (!missing(`date`)) {
|
||||
if (!is.character(`date`)) {
|
||||
stop(paste("Error! Invalid Date. Must be a string:", `date`))
|
||||
if (!(is.character(`date`) && length(`date`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `date`. Must be a string:", `date`))
|
||||
}
|
||||
self$`date` <- `date`
|
||||
}
|
||||
if (!missing(`password`)) {
|
||||
stopifnot(is.character(`password`), length(`password`) == 1)
|
||||
if (!(is.character(`password`) && length(`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", `password`))
|
||||
}
|
||||
self$`password` <- `password`
|
||||
}
|
||||
if (!is.null(`integer`)) {
|
||||
stopifnot(is.numeric(`integer`), length(`integer`) == 1)
|
||||
if (!(is.numeric(`integer`) && length(`integer`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `integer`. Must be an integer:", `integer`))
|
||||
}
|
||||
self$`integer` <- `integer`
|
||||
}
|
||||
if (!is.null(`int32`)) {
|
||||
stopifnot(is.numeric(`int32`), length(`int32`) == 1)
|
||||
if (!(is.numeric(`int32`) && length(`int32`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `int32`. Must be an integer:", `int32`))
|
||||
}
|
||||
self$`int32` <- `int32`
|
||||
}
|
||||
if (!is.null(`int64`)) {
|
||||
stopifnot(is.numeric(`int64`), length(`int64`) == 1)
|
||||
if (!(is.numeric(`int64`) && length(`int64`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `int64`. Must be an integer:", `int64`))
|
||||
}
|
||||
self$`int64` <- `int64`
|
||||
}
|
||||
if (!is.null(`float`)) {
|
||||
stopifnot(is.numeric(`float`), length(`float`) == 1)
|
||||
if (!(is.numeric(`float`) && length(`float`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `float`. Must be a number:", `float`))
|
||||
}
|
||||
self$`float` <- `float`
|
||||
}
|
||||
if (!is.null(`double`)) {
|
||||
stopifnot(is.numeric(`double`), length(`double`) == 1)
|
||||
if (!(is.numeric(`double`) && length(`double`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `double`. Must be a number:", `double`))
|
||||
}
|
||||
self$`double` <- `double`
|
||||
}
|
||||
if (!is.null(`string`)) {
|
||||
stopifnot(is.character(`string`), length(`string`) == 1)
|
||||
if (!(is.character(`string`) && length(`string`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `string`. Must be a string:", `string`))
|
||||
}
|
||||
self$`string` <- `string`
|
||||
}
|
||||
if (!is.null(`binary`)) {
|
||||
@ -116,20 +130,26 @@ FormatTest <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(`dateTime`)) {
|
||||
if (!is.character(`dateTime`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `dateTime`))
|
||||
stop(paste("Error! Invalid data for `dateTime`. Must be a string:", `dateTime`))
|
||||
}
|
||||
self$`dateTime` <- `dateTime`
|
||||
}
|
||||
if (!is.null(`uuid`)) {
|
||||
stopifnot(is.character(`uuid`), length(`uuid`) == 1)
|
||||
if (!(is.character(`uuid`) && length(`uuid`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `uuid`. Must be a string:", `uuid`))
|
||||
}
|
||||
self$`uuid` <- `uuid`
|
||||
}
|
||||
if (!is.null(`pattern_with_digits`)) {
|
||||
stopifnot(is.character(`pattern_with_digits`), length(`pattern_with_digits`) == 1)
|
||||
if (!(is.character(`pattern_with_digits`) && length(`pattern_with_digits`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `pattern_with_digits`. Must be a string:", `pattern_with_digits`))
|
||||
}
|
||||
self$`pattern_with_digits` <- `pattern_with_digits`
|
||||
}
|
||||
if (!is.null(`pattern_with_digits_and_delimiter`)) {
|
||||
stopifnot(is.character(`pattern_with_digits_and_delimiter`), length(`pattern_with_digits_and_delimiter`) == 1)
|
||||
if (!(is.character(`pattern_with_digits_and_delimiter`) && length(`pattern_with_digits_and_delimiter`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `pattern_with_digits_and_delimiter`. Must be a string:", `pattern_with_digits_and_delimiter`))
|
||||
}
|
||||
self$`pattern_with_digits_and_delimiter` <- `pattern_with_digits_and_delimiter`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -470,13 +490,17 @@ FormatTest <- R6::R6Class(
|
||||
}
|
||||
# check the required field `date`
|
||||
if (!is.null(input_json$`date`)) {
|
||||
stopifnot(is.character(input_json$`date`), length(input_json$`date`) == 1)
|
||||
if (!(is.character(input_json$`date`) && length(input_json$`date`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `date`. Must be a string:", input_json$`date`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for FormatTest: the required field `date` is missing."))
|
||||
}
|
||||
# check the required field `password`
|
||||
if (!is.null(input_json$`password`)) {
|
||||
stopifnot(is.character(input_json$`password`), length(input_json$`password`) == 1)
|
||||
if (!(is.character(input_json$`password`) && length(input_json$`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", input_json$`password`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for FormatTest: the required field `password` is missing."))
|
||||
}
|
||||
|
@ -36,15 +36,21 @@ ModelApiResponse <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`code`)) {
|
||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||
if (!(is.numeric(`code`) && length(`code`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `code`. Must be an integer:", `code`))
|
||||
}
|
||||
self$`code` <- `code`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(`message`)) {
|
||||
stopifnot(is.character(`message`), length(`message`) == 1)
|
||||
if (!(is.character(`message`) && length(`message`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `message`. Must be a string:", `message`))
|
||||
}
|
||||
self$`message` <- `message`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,7 +33,9 @@ NestedOneOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`size` = NULL, `nested_pig` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`size`)) {
|
||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||
if (!(is.numeric(`size`) && length(`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", `size`))
|
||||
}
|
||||
self$`size` <- `size`
|
||||
}
|
||||
if (!is.null(`nested_pig`)) {
|
||||
|
@ -45,20 +45,26 @@ Order <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`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)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`petId`)) {
|
||||
stopifnot(is.numeric(`petId`), length(`petId`) == 1)
|
||||
if (!(is.numeric(`petId`) && length(`petId`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `petId`. Must be an integer:", `petId`))
|
||||
}
|
||||
self$`petId` <- `petId`
|
||||
}
|
||||
if (!is.null(`quantity`)) {
|
||||
stopifnot(is.numeric(`quantity`), length(`quantity`) == 1)
|
||||
if (!(is.numeric(`quantity`) && length(`quantity`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `quantity`. Must be an integer:", `quantity`))
|
||||
}
|
||||
self$`quantity` <- `quantity`
|
||||
}
|
||||
if (!is.null(`shipDate`)) {
|
||||
if (!is.character(`shipDate`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `shipDate`))
|
||||
stop(paste("Error! Invalid data for `shipDate`. Must be a string:", `shipDate`))
|
||||
}
|
||||
self$`shipDate` <- `shipDate`
|
||||
}
|
||||
@ -66,11 +72,15 @@ Order <- R6::R6Class(
|
||||
if (!(`status` %in% c("placed", "approved", "delivered"))) {
|
||||
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"placed\", \"approved\", \"delivered\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`status`), length(`status`) == 1)
|
||||
if (!(is.character(`status`) && length(`status`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
|
||||
}
|
||||
self$`status` <- `status`
|
||||
}
|
||||
if (!is.null(`complete`)) {
|
||||
stopifnot(is.logical(`complete`), length(`complete`) == 1)
|
||||
if (!(is.logical(`complete`) && length(`complete`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `complete`. Must be a boolean:", `complete`))
|
||||
}
|
||||
self$`complete` <- `complete`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -45,7 +45,9 @@ Pet <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!missing(`photoUrls`)) {
|
||||
@ -54,7 +56,9 @@ Pet <- R6::R6Class(
|
||||
self$`photoUrls` <- `photoUrls`
|
||||
}
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`category`)) {
|
||||
@ -70,7 +74,9 @@ Pet <- R6::R6Class(
|
||||
if (!(`status` %in% c("available", "pending", "sold"))) {
|
||||
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`status`), length(`status`) == 1)
|
||||
if (!(is.character(`status`) && length(`status`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
|
||||
}
|
||||
self$`status` <- `status`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -265,7 +271,9 @@ Pet <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `name`
|
||||
if (!is.null(input_json$`name`)) {
|
||||
stopifnot(is.character(input_json$`name`), length(input_json$`name`) == 1)
|
||||
if (!(is.character(input_json$`name`) && length(input_json$`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", input_json$`name`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `name` is missing."))
|
||||
}
|
||||
|
@ -56,27 +56,39 @@ Special <- R6::R6Class(
|
||||
self$`set_test` <- `set_test`
|
||||
}
|
||||
if (!is.null(`item_self`)) {
|
||||
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
|
||||
if (!(is.numeric(`item_self`) && length(`item_self`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_self`. Must be an integer:", `item_self`))
|
||||
}
|
||||
self$`item_self` <- `item_self`
|
||||
}
|
||||
if (!is.null(`item_private`)) {
|
||||
stopifnot(is.character(`item_private`), length(`item_private`) == 1)
|
||||
if (!(is.character(`item_private`) && length(`item_private`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_private`. Must be a string:", `item_private`))
|
||||
}
|
||||
self$`item_private` <- `item_private`
|
||||
}
|
||||
if (!is.null(`item_super`)) {
|
||||
stopifnot(is.character(`item_super`), length(`item_super`) == 1)
|
||||
if (!(is.character(`item_super`) && length(`item_super`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_super`. Must be a string:", `item_super`))
|
||||
}
|
||||
self$`item_super` <- `item_super`
|
||||
}
|
||||
if (!is.null(`123_number`)) {
|
||||
stopifnot(is.character(`123_number`), length(`123_number`) == 1)
|
||||
if (!(is.character(`123_number`) && length(`123_number`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `123_number`. Must be a string:", `123_number`))
|
||||
}
|
||||
self$`123_number` <- `123_number`
|
||||
}
|
||||
if (!is.null(`array[test]`)) {
|
||||
stopifnot(is.character(`array[test]`), length(`array[test]`) == 1)
|
||||
if (!(is.character(`array[test]`) && length(`array[test]`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `array[test]`. Must be a string:", `array[test]`))
|
||||
}
|
||||
self$`array[test]` <- `array[test]`
|
||||
}
|
||||
if (!is.null(`empty_string`)) {
|
||||
stopifnot(is.character(`empty_string`), length(`empty_string`) == 1)
|
||||
if (!(is.character(`empty_string`) && length(`empty_string`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `empty_string`. Must be a string:", `empty_string`))
|
||||
}
|
||||
self$`empty_string` <- `empty_string`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,11 +33,15 @@ Tag <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -51,35 +51,51 @@ User <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`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)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`username`)) {
|
||||
stopifnot(is.character(`username`), length(`username`) == 1)
|
||||
if (!(is.character(`username`) && length(`username`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `username`. Must be a string:", `username`))
|
||||
}
|
||||
self$`username` <- `username`
|
||||
}
|
||||
if (!is.null(`firstName`)) {
|
||||
stopifnot(is.character(`firstName`), length(`firstName`) == 1)
|
||||
if (!(is.character(`firstName`) && length(`firstName`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `firstName`. Must be a string:", `firstName`))
|
||||
}
|
||||
self$`firstName` <- `firstName`
|
||||
}
|
||||
if (!is.null(`lastName`)) {
|
||||
stopifnot(is.character(`lastName`), length(`lastName`) == 1)
|
||||
if (!(is.character(`lastName`) && length(`lastName`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `lastName`. Must be a string:", `lastName`))
|
||||
}
|
||||
self$`lastName` <- `lastName`
|
||||
}
|
||||
if (!is.null(`email`)) {
|
||||
stopifnot(is.character(`email`), length(`email`) == 1)
|
||||
if (!(is.character(`email`) && length(`email`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `email`. Must be a string:", `email`))
|
||||
}
|
||||
self$`email` <- `email`
|
||||
}
|
||||
if (!is.null(`password`)) {
|
||||
stopifnot(is.character(`password`), length(`password`) == 1)
|
||||
if (!(is.character(`password`) && length(`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", `password`))
|
||||
}
|
||||
self$`password` <- `password`
|
||||
}
|
||||
if (!is.null(`phone`)) {
|
||||
stopifnot(is.character(`phone`), length(`phone`) == 1)
|
||||
if (!(is.character(`phone`) && length(`phone`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `phone`. Must be a string:", `phone`))
|
||||
}
|
||||
self$`phone` <- `phone`
|
||||
}
|
||||
if (!is.null(`userStatus`)) {
|
||||
stopifnot(is.numeric(`userStatus`), length(`userStatus`) == 1)
|
||||
if (!(is.numeric(`userStatus`) && length(`userStatus`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `userStatus`. Must be an integer:", `userStatus`))
|
||||
}
|
||||
self$`userStatus` <- `userStatus`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -36,15 +36,21 @@ Whale <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`hasBaleen`)) {
|
||||
stopifnot(is.logical(`hasBaleen`), length(`hasBaleen`) == 1)
|
||||
if (!(is.logical(`hasBaleen`) && length(`hasBaleen`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `hasBaleen`. Must be a boolean:", `hasBaleen`))
|
||||
}
|
||||
self$`hasBaleen` <- `hasBaleen`
|
||||
}
|
||||
if (!is.null(`hasTeeth`)) {
|
||||
stopifnot(is.logical(`hasTeeth`), length(`hasTeeth`) == 1)
|
||||
if (!(is.logical(`hasTeeth`) && length(`hasTeeth`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `hasTeeth`. Must be a boolean:", `hasTeeth`))
|
||||
}
|
||||
self$`hasTeeth` <- `hasTeeth`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -183,7 +189,9 @@ Whale <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Whale: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -33,14 +33,18 @@ Zebra <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `type` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
if (!(`type` %in% c("plains", "mountain", "grevys"))) {
|
||||
stop(paste("Error! \"", `type`, "\" cannot be assigned to `type`. Must be \"plains\", \"mountain\", \"grevys\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -169,7 +173,9 @@ Zebra <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Zebra: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ test_that("Tests URL validation", {
|
||||
Date$public_methods$validateJSON(valid_json) # shouldn't throw exception
|
||||
|
||||
invalid_json <- '{"className":"date","percent_description":"abc","url_property":"invalid_url"}'
|
||||
expect_error(Date$public_methods$validateJSON(invalid_json), 'Error! Invalid URL: invalid_url') # should throw exception
|
||||
expect_error(Date$public_methods$validateJSON(invalid_json), 'Error! Invalid data for `url_property`. Must be a URL: invalid_url') # should throw exception
|
||||
|
||||
# test fromJSONString with valid data
|
||||
d <- Date$new()
|
||||
@ -611,7 +611,7 @@ test_that("Tests URL validation", {
|
||||
|
||||
# test fromJSONString with invalid data
|
||||
d <- Date$new()
|
||||
expect_error(d$fromJSONString(invalid_json), 'Error! Invalid URL: invalid_url') # should throw exception
|
||||
expect_error(d$fromJSONString(invalid_json), 'Error! Invalid data for `url_property`. Must be a URL: invalid_url') # should throw exception
|
||||
})
|
||||
|
||||
|
||||
@ -621,5 +621,5 @@ test_that("Order and datetime test", {
|
||||
|
||||
expect_equal(t$toJSONString(), "{\"id\":393,\"petId\":12930,\"quantity\":12,\"shipDate\":\"2019-09-29T19:39:29Z\",\"status\":\"approved\",\"complete\":false}")
|
||||
|
||||
expect_error(Order$new(id = 393, petId = 12930, quantity = 12, shipDate = TRUE, status = "approved"), "Error! Invalid DateTime. Must be a string: TRUE")
|
||||
expect_error(Order$new(id = 393, petId = 12930, quantity = 12, shipDate = TRUE, status = "approved"), "Error! Invalid data for `shipDate`. Must be a string: TRUE")
|
||||
})
|
||||
|
@ -37,23 +37,33 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(`code`)) {
|
||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||
if (!(is.numeric(`code`) && length(`code`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `code`. Must be an integer:", `code`))
|
||||
}
|
||||
self$`code` <- `code`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(`message`)) {
|
||||
stopifnot(is.character(`message`), length(`message`) == 1)
|
||||
if (!(is.character(`message`) && length(`message`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `message`. Must be a string:", `message`))
|
||||
}
|
||||
self$`message` <- `message`
|
||||
}
|
||||
},
|
||||
|
@ -30,11 +30,15 @@ Animal <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
},
|
||||
@ -129,7 +133,9 @@ Animal <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Animal: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -28,11 +28,15 @@ BasquePig <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color`, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
},
|
||||
@ -127,13 +131,17 @@ BasquePig <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for BasquePig: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `color`
|
||||
if (!is.null(input_json$`color`)) {
|
||||
stopifnot(is.character(input_json$`color`), length(input_json$`color`) == 1)
|
||||
if (!(is.character(input_json$`color`) && length(input_json$`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", input_json$`color`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for BasquePig: the required field `color` is missing."))
|
||||
}
|
||||
|
@ -32,15 +32,21 @@ Cat <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", `declawed` = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(`declawed`)) {
|
||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||
if (!(is.logical(`declawed`) && length(`declawed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `declawed`. Must be a boolean:", `declawed`))
|
||||
}
|
||||
self$`declawed` <- `declawed`
|
||||
}
|
||||
},
|
||||
@ -151,7 +157,9 @@ Cat <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Cat: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -25,7 +25,9 @@ CatAllOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`declawed` = NULL, ...) {
|
||||
if (!is.null(`declawed`)) {
|
||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||
if (!(is.logical(`declawed`) && length(`declawed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `declawed`. Must be a boolean:", `declawed`))
|
||||
}
|
||||
self$`declawed` <- `declawed`
|
||||
}
|
||||
},
|
||||
|
@ -28,11 +28,15 @@ Category <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
},
|
||||
|
@ -28,11 +28,15 @@ DanishPig <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `size`, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`size`)) {
|
||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||
if (!(is.numeric(`size`) && length(`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", `size`))
|
||||
}
|
||||
self$`size` <- `size`
|
||||
}
|
||||
},
|
||||
@ -127,13 +131,17 @@ DanishPig <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for DanishPig: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `size`
|
||||
if (!is.null(input_json$`size`)) {
|
||||
stopifnot(is.numeric(input_json$`size`), length(input_json$`size`) == 1)
|
||||
if (!(is.numeric(input_json$`size`) && length(input_json$`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", input_json$`size`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for DanishPig: the required field `size` is missing."))
|
||||
}
|
||||
|
@ -31,19 +31,25 @@ Date <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `url_property`, `percent_description` = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`url_property`)) {
|
||||
stopifnot(is.character(`url_property`), length(`url_property`) == 1)
|
||||
if (!(is.character(`url_property`) && length(`url_property`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a string:", `url_property`))
|
||||
}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", `url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", `url_property`))
|
||||
}
|
||||
self$`url_property` <- `url_property`
|
||||
}
|
||||
if (!is.null(`percent_description`)) {
|
||||
stopifnot(is.character(`percent_description`), length(`percent_description`) == 1)
|
||||
if (!(is.character(`percent_description`) && length(`percent_description`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `percent_description`. Must be a string:", `percent_description`))
|
||||
}
|
||||
self$`percent_description` <- `percent_description`
|
||||
}
|
||||
},
|
||||
@ -89,7 +95,7 @@ Date <- R6::R6Class(
|
||||
if (!is.null(this_object$`url_property`)) {
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", this_object$`url_property`))
|
||||
}
|
||||
self$`url_property` <- this_object$`url_property`
|
||||
}
|
||||
@ -146,7 +152,7 @@ Date <- R6::R6Class(
|
||||
self$`percent_description` <- this_object$`percent_description`
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", this_object$`url_property`))
|
||||
}
|
||||
self$`url_property` <- this_object$`url_property`
|
||||
self
|
||||
@ -162,16 +168,20 @@ Date <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Date: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `url_property`
|
||||
if (!is.null(input_json$`url_property`)) {
|
||||
stopifnot(is.character(input_json$`url_property`), length(input_json$`url_property`) == 1)
|
||||
if (!(is.character(input_json$`url_property`) && length(input_json$`url_property`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a string:", input_json$`url_property`))
|
||||
}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(input_json$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", input_json$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", input_json$`url_property`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Date: the required field `url_property` is missing."))
|
||||
|
@ -32,15 +32,21 @@ Dog <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", `breed` = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(`breed`)) {
|
||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||
if (!(is.character(`breed`) && length(`breed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `breed`. Must be a string:", `breed`))
|
||||
}
|
||||
self$`breed` <- `breed`
|
||||
}
|
||||
},
|
||||
@ -151,7 +157,9 @@ Dog <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Dog: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -25,7 +25,9 @@ DogAllOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`breed` = NULL, ...) {
|
||||
if (!is.null(`breed`)) {
|
||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||
if (!(is.character(`breed`) && length(`breed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `breed`. Must be a string:", `breed`))
|
||||
}
|
||||
self$`breed` <- `breed`
|
||||
}
|
||||
},
|
||||
|
@ -73,37 +73,51 @@ FormatTest <- R6::R6Class(
|
||||
self$`byte` <- `byte`
|
||||
}
|
||||
if (!missing(`date`)) {
|
||||
if (!is.character(`date`)) {
|
||||
stop(paste("Error! Invalid Date. Must be a string:", `date`))
|
||||
if (!(is.character(`date`) && length(`date`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `date`. Must be a string:", `date`))
|
||||
}
|
||||
self$`date` <- `date`
|
||||
}
|
||||
if (!missing(`password`)) {
|
||||
stopifnot(is.character(`password`), length(`password`) == 1)
|
||||
if (!(is.character(`password`) && length(`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", `password`))
|
||||
}
|
||||
self$`password` <- `password`
|
||||
}
|
||||
if (!is.null(`integer`)) {
|
||||
stopifnot(is.numeric(`integer`), length(`integer`) == 1)
|
||||
if (!(is.numeric(`integer`) && length(`integer`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `integer`. Must be an integer:", `integer`))
|
||||
}
|
||||
self$`integer` <- `integer`
|
||||
}
|
||||
if (!is.null(`int32`)) {
|
||||
stopifnot(is.numeric(`int32`), length(`int32`) == 1)
|
||||
if (!(is.numeric(`int32`) && length(`int32`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `int32`. Must be an integer:", `int32`))
|
||||
}
|
||||
self$`int32` <- `int32`
|
||||
}
|
||||
if (!is.null(`int64`)) {
|
||||
stopifnot(is.numeric(`int64`), length(`int64`) == 1)
|
||||
if (!(is.numeric(`int64`) && length(`int64`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `int64`. Must be an integer:", `int64`))
|
||||
}
|
||||
self$`int64` <- `int64`
|
||||
}
|
||||
if (!is.null(`float`)) {
|
||||
stopifnot(is.numeric(`float`), length(`float`) == 1)
|
||||
if (!(is.numeric(`float`) && length(`float`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `float`. Must be a number:", `float`))
|
||||
}
|
||||
self$`float` <- `float`
|
||||
}
|
||||
if (!is.null(`double`)) {
|
||||
stopifnot(is.numeric(`double`), length(`double`) == 1)
|
||||
if (!(is.numeric(`double`) && length(`double`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `double`. Must be a number:", `double`))
|
||||
}
|
||||
self$`double` <- `double`
|
||||
}
|
||||
if (!is.null(`string`)) {
|
||||
stopifnot(is.character(`string`), length(`string`) == 1)
|
||||
if (!(is.character(`string`) && length(`string`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `string`. Must be a string:", `string`))
|
||||
}
|
||||
self$`string` <- `string`
|
||||
}
|
||||
if (!is.null(`binary`)) {
|
||||
@ -111,20 +125,26 @@ FormatTest <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(`dateTime`)) {
|
||||
if (!is.character(`dateTime`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `dateTime`))
|
||||
stop(paste("Error! Invalid data for `dateTime`. Must be a string:", `dateTime`))
|
||||
}
|
||||
self$`dateTime` <- `dateTime`
|
||||
}
|
||||
if (!is.null(`uuid`)) {
|
||||
stopifnot(is.character(`uuid`), length(`uuid`) == 1)
|
||||
if (!(is.character(`uuid`) && length(`uuid`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `uuid`. Must be a string:", `uuid`))
|
||||
}
|
||||
self$`uuid` <- `uuid`
|
||||
}
|
||||
if (!is.null(`pattern_with_digits`)) {
|
||||
stopifnot(is.character(`pattern_with_digits`), length(`pattern_with_digits`) == 1)
|
||||
if (!(is.character(`pattern_with_digits`) && length(`pattern_with_digits`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `pattern_with_digits`. Must be a string:", `pattern_with_digits`))
|
||||
}
|
||||
self$`pattern_with_digits` <- `pattern_with_digits`
|
||||
}
|
||||
if (!is.null(`pattern_with_digits_and_delimiter`)) {
|
||||
stopifnot(is.character(`pattern_with_digits_and_delimiter`), length(`pattern_with_digits_and_delimiter`) == 1)
|
||||
if (!(is.character(`pattern_with_digits_and_delimiter`) && length(`pattern_with_digits_and_delimiter`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `pattern_with_digits_and_delimiter`. Must be a string:", `pattern_with_digits_and_delimiter`))
|
||||
}
|
||||
self$`pattern_with_digits_and_delimiter` <- `pattern_with_digits_and_delimiter`
|
||||
}
|
||||
},
|
||||
@ -437,13 +457,17 @@ FormatTest <- R6::R6Class(
|
||||
}
|
||||
# check the required field `date`
|
||||
if (!is.null(input_json$`date`)) {
|
||||
stopifnot(is.character(input_json$`date`), length(input_json$`date`) == 1)
|
||||
if (!(is.character(input_json$`date`) && length(input_json$`date`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `date`. Must be a string:", input_json$`date`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for FormatTest: the required field `date` is missing."))
|
||||
}
|
||||
# check the required field `password`
|
||||
if (!is.null(input_json$`password`)) {
|
||||
stopifnot(is.character(input_json$`password`), length(input_json$`password`) == 1)
|
||||
if (!(is.character(input_json$`password`) && length(input_json$`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", input_json$`password`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for FormatTest: the required field `password` is missing."))
|
||||
}
|
||||
|
@ -31,15 +31,21 @@ ModelApiResponse <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`code` = NULL, `type` = NULL, `message` = NULL, ...) {
|
||||
if (!is.null(`code`)) {
|
||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||
if (!(is.numeric(`code`) && length(`code`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `code`. Must be an integer:", `code`))
|
||||
}
|
||||
self$`code` <- `code`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(`message`)) {
|
||||
stopifnot(is.character(`message`), length(`message`) == 1)
|
||||
if (!(is.character(`message`) && length(`message`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `message`. Must be a string:", `message`))
|
||||
}
|
||||
self$`message` <- `message`
|
||||
}
|
||||
},
|
||||
|
@ -28,7 +28,9 @@ NestedOneOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`size` = NULL, `nested_pig` = NULL, ...) {
|
||||
if (!is.null(`size`)) {
|
||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||
if (!(is.numeric(`size`) && length(`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", `size`))
|
||||
}
|
||||
self$`size` <- `size`
|
||||
}
|
||||
if (!is.null(`nested_pig`)) {
|
||||
|
@ -40,20 +40,26 @@ Order <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `petId` = NULL, `quantity` = NULL, `shipDate` = NULL, `status` = NULL, `complete` = FALSE, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`petId`)) {
|
||||
stopifnot(is.numeric(`petId`), length(`petId`) == 1)
|
||||
if (!(is.numeric(`petId`) && length(`petId`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `petId`. Must be an integer:", `petId`))
|
||||
}
|
||||
self$`petId` <- `petId`
|
||||
}
|
||||
if (!is.null(`quantity`)) {
|
||||
stopifnot(is.numeric(`quantity`), length(`quantity`) == 1)
|
||||
if (!(is.numeric(`quantity`) && length(`quantity`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `quantity`. Must be an integer:", `quantity`))
|
||||
}
|
||||
self$`quantity` <- `quantity`
|
||||
}
|
||||
if (!is.null(`shipDate`)) {
|
||||
if (!is.character(`shipDate`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `shipDate`))
|
||||
stop(paste("Error! Invalid data for `shipDate`. Must be a string:", `shipDate`))
|
||||
}
|
||||
self$`shipDate` <- `shipDate`
|
||||
}
|
||||
@ -61,11 +67,15 @@ Order <- R6::R6Class(
|
||||
if (!(`status` %in% c("placed", "approved", "delivered"))) {
|
||||
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"placed\", \"approved\", \"delivered\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`status`), length(`status`) == 1)
|
||||
if (!(is.character(`status`) && length(`status`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
|
||||
}
|
||||
self$`status` <- `status`
|
||||
}
|
||||
if (!is.null(`complete`)) {
|
||||
stopifnot(is.logical(`complete`), length(`complete`) == 1)
|
||||
if (!(is.logical(`complete`) && length(`complete`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `complete`. Must be a boolean:", `complete`))
|
||||
}
|
||||
self$`complete` <- `complete`
|
||||
}
|
||||
},
|
||||
|
@ -40,7 +40,9 @@ Pet <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, ...) {
|
||||
if (!missing(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!missing(`photoUrls`)) {
|
||||
@ -49,7 +51,9 @@ Pet <- R6::R6Class(
|
||||
self$`photoUrls` <- `photoUrls`
|
||||
}
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`category`)) {
|
||||
@ -65,7 +69,9 @@ Pet <- R6::R6Class(
|
||||
if (!(`status` %in% c("available", "pending", "sold"))) {
|
||||
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`status`), length(`status`) == 1)
|
||||
if (!(is.character(`status`) && length(`status`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
|
||||
}
|
||||
self$`status` <- `status`
|
||||
}
|
||||
},
|
||||
@ -232,7 +238,9 @@ Pet <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `name`
|
||||
if (!is.null(input_json$`name`)) {
|
||||
stopifnot(is.character(input_json$`name`), length(input_json$`name`) == 1)
|
||||
if (!(is.character(input_json$`name`) && length(input_json$`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", input_json$`name`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `name` is missing."))
|
||||
}
|
||||
|
@ -51,27 +51,39 @@ Special <- R6::R6Class(
|
||||
self$`set_test` <- `set_test`
|
||||
}
|
||||
if (!is.null(`item_self`)) {
|
||||
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
|
||||
if (!(is.numeric(`item_self`) && length(`item_self`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_self`. Must be an integer:", `item_self`))
|
||||
}
|
||||
self$`item_self` <- `item_self`
|
||||
}
|
||||
if (!is.null(`item_private`)) {
|
||||
stopifnot(is.character(`item_private`), length(`item_private`) == 1)
|
||||
if (!(is.character(`item_private`) && length(`item_private`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_private`. Must be a string:", `item_private`))
|
||||
}
|
||||
self$`item_private` <- `item_private`
|
||||
}
|
||||
if (!is.null(`item_super`)) {
|
||||
stopifnot(is.character(`item_super`), length(`item_super`) == 1)
|
||||
if (!(is.character(`item_super`) && length(`item_super`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_super`. Must be a string:", `item_super`))
|
||||
}
|
||||
self$`item_super` <- `item_super`
|
||||
}
|
||||
if (!is.null(`123_number`)) {
|
||||
stopifnot(is.character(`123_number`), length(`123_number`) == 1)
|
||||
if (!(is.character(`123_number`) && length(`123_number`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `123_number`. Must be a string:", `123_number`))
|
||||
}
|
||||
self$`123_number` <- `123_number`
|
||||
}
|
||||
if (!is.null(`array[test]`)) {
|
||||
stopifnot(is.character(`array[test]`), length(`array[test]`) == 1)
|
||||
if (!(is.character(`array[test]`) && length(`array[test]`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `array[test]`. Must be a string:", `array[test]`))
|
||||
}
|
||||
self$`array[test]` <- `array[test]`
|
||||
}
|
||||
if (!is.null(`empty_string`)) {
|
||||
stopifnot(is.character(`empty_string`), length(`empty_string`) == 1)
|
||||
if (!(is.character(`empty_string`) && length(`empty_string`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `empty_string`. Must be a string:", `empty_string`))
|
||||
}
|
||||
self$`empty_string` <- `empty_string`
|
||||
}
|
||||
},
|
||||
|
@ -28,11 +28,15 @@ Tag <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
},
|
||||
|
@ -46,35 +46,51 @@ User <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `username` = NULL, `firstName` = NULL, `lastName` = NULL, `email` = NULL, `password` = NULL, `phone` = NULL, `userStatus` = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`username`)) {
|
||||
stopifnot(is.character(`username`), length(`username`) == 1)
|
||||
if (!(is.character(`username`) && length(`username`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `username`. Must be a string:", `username`))
|
||||
}
|
||||
self$`username` <- `username`
|
||||
}
|
||||
if (!is.null(`firstName`)) {
|
||||
stopifnot(is.character(`firstName`), length(`firstName`) == 1)
|
||||
if (!(is.character(`firstName`) && length(`firstName`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `firstName`. Must be a string:", `firstName`))
|
||||
}
|
||||
self$`firstName` <- `firstName`
|
||||
}
|
||||
if (!is.null(`lastName`)) {
|
||||
stopifnot(is.character(`lastName`), length(`lastName`) == 1)
|
||||
if (!(is.character(`lastName`) && length(`lastName`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `lastName`. Must be a string:", `lastName`))
|
||||
}
|
||||
self$`lastName` <- `lastName`
|
||||
}
|
||||
if (!is.null(`email`)) {
|
||||
stopifnot(is.character(`email`), length(`email`) == 1)
|
||||
if (!(is.character(`email`) && length(`email`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `email`. Must be a string:", `email`))
|
||||
}
|
||||
self$`email` <- `email`
|
||||
}
|
||||
if (!is.null(`password`)) {
|
||||
stopifnot(is.character(`password`), length(`password`) == 1)
|
||||
if (!(is.character(`password`) && length(`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", `password`))
|
||||
}
|
||||
self$`password` <- `password`
|
||||
}
|
||||
if (!is.null(`phone`)) {
|
||||
stopifnot(is.character(`phone`), length(`phone`) == 1)
|
||||
if (!(is.character(`phone`) && length(`phone`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `phone`. Must be a string:", `phone`))
|
||||
}
|
||||
self$`phone` <- `phone`
|
||||
}
|
||||
if (!is.null(`userStatus`)) {
|
||||
stopifnot(is.numeric(`userStatus`), length(`userStatus`) == 1)
|
||||
if (!(is.numeric(`userStatus`) && length(`userStatus`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `userStatus`. Must be an integer:", `userStatus`))
|
||||
}
|
||||
self$`userStatus` <- `userStatus`
|
||||
}
|
||||
},
|
||||
|
@ -31,15 +31,21 @@ Whale <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`hasBaleen`)) {
|
||||
stopifnot(is.logical(`hasBaleen`), length(`hasBaleen`) == 1)
|
||||
if (!(is.logical(`hasBaleen`) && length(`hasBaleen`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `hasBaleen`. Must be a boolean:", `hasBaleen`))
|
||||
}
|
||||
self$`hasBaleen` <- `hasBaleen`
|
||||
}
|
||||
if (!is.null(`hasTeeth`)) {
|
||||
stopifnot(is.logical(`hasTeeth`), length(`hasTeeth`) == 1)
|
||||
if (!(is.logical(`hasTeeth`) && length(`hasTeeth`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `hasTeeth`. Must be a boolean:", `hasTeeth`))
|
||||
}
|
||||
self$`hasTeeth` <- `hasTeeth`
|
||||
}
|
||||
},
|
||||
@ -150,7 +156,9 @@ Whale <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Whale: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -28,14 +28,18 @@ Zebra <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `type` = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
if (!(`type` %in% c("plains", "mountain", "grevys"))) {
|
||||
stop(paste("Error! \"", `type`, "\" cannot be assigned to `type`. Must be \"plains\", \"mountain\", \"grevys\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
},
|
||||
@ -136,7 +140,9 @@ Zebra <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Zebra: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -42,23 +42,33 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(`code`)) {
|
||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||
if (!(is.numeric(`code`) && length(`code`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `code`. Must be an integer:", `code`))
|
||||
}
|
||||
self$`code` <- `code`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(`message`)) {
|
||||
stopifnot(is.character(`message`), length(`message`) == 1)
|
||||
if (!(is.character(`message`) && length(`message`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `message`. Must be a string:", `message`))
|
||||
}
|
||||
self$`message` <- `message`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -35,11 +35,15 @@ Animal <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -162,7 +166,9 @@ Animal <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Animal: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -33,11 +33,15 @@ BasquePig <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color`, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -160,13 +164,17 @@ BasquePig <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for BasquePig: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `color`
|
||||
if (!is.null(input_json$`color`)) {
|
||||
stopifnot(is.character(input_json$`color`), length(input_json$`color`) == 1)
|
||||
if (!(is.character(input_json$`color`) && length(input_json$`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", input_json$`color`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for BasquePig: the required field `color` is missing."))
|
||||
}
|
||||
|
@ -37,15 +37,21 @@ Cat <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", `declawed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(`declawed`)) {
|
||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||
if (!(is.logical(`declawed`) && length(`declawed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `declawed`. Must be a boolean:", `declawed`))
|
||||
}
|
||||
self$`declawed` <- `declawed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -184,7 +190,9 @@ Cat <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Cat: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ CatAllOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`declawed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`declawed`)) {
|
||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||
if (!(is.logical(`declawed`) && length(`declawed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `declawed`. Must be a boolean:", `declawed`))
|
||||
}
|
||||
self$`declawed` <- `declawed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,11 +33,15 @@ Category <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,11 +33,15 @@ DanishPig <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `size`, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`size`)) {
|
||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||
if (!(is.numeric(`size`) && length(`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", `size`))
|
||||
}
|
||||
self$`size` <- `size`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -160,13 +164,17 @@ DanishPig <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for DanishPig: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `size`
|
||||
if (!is.null(input_json$`size`)) {
|
||||
stopifnot(is.numeric(input_json$`size`), length(input_json$`size`) == 1)
|
||||
if (!(is.numeric(input_json$`size`) && length(input_json$`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", input_json$`size`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for DanishPig: the required field `size` is missing."))
|
||||
}
|
||||
|
@ -36,19 +36,25 @@ Date <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `url_property`, `percent_description` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!missing(`url_property`)) {
|
||||
stopifnot(is.character(`url_property`), length(`url_property`) == 1)
|
||||
if (!(is.character(`url_property`) && length(`url_property`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a string:", `url_property`))
|
||||
}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", `url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", `url_property`))
|
||||
}
|
||||
self$`url_property` <- `url_property`
|
||||
}
|
||||
if (!is.null(`percent_description`)) {
|
||||
stopifnot(is.character(`percent_description`), length(`percent_description`) == 1)
|
||||
if (!(is.character(`percent_description`) && length(`percent_description`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `percent_description`. Must be a string:", `percent_description`))
|
||||
}
|
||||
self$`percent_description` <- `percent_description`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -103,7 +109,7 @@ Date <- R6::R6Class(
|
||||
if (!is.null(this_object$`url_property`)) {
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", this_object$`url_property`))
|
||||
}
|
||||
self$`url_property` <- this_object$`url_property`
|
||||
}
|
||||
@ -172,7 +178,7 @@ Date <- R6::R6Class(
|
||||
self$`percent_description` <- this_object$`percent_description`
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(this_object$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", this_object$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", this_object$`url_property`))
|
||||
}
|
||||
self$`url_property` <- this_object$`url_property`
|
||||
# process additional properties/fields in the payload
|
||||
@ -195,16 +201,20 @@ Date <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Date: the required field `className` is missing."))
|
||||
}
|
||||
# check the required field `url_property`
|
||||
if (!is.null(input_json$`url_property`)) {
|
||||
stopifnot(is.character(input_json$`url_property`), length(input_json$`url_property`) == 1)
|
||||
if (!(is.character(input_json$`url_property`) && length(input_json$`url_property`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a string:", input_json$`url_property`))
|
||||
}
|
||||
# to validate URL. ref: https://stackoverflow.com/questions/73952024/url-validation-in-r
|
||||
if (!stringr::str_detect(input_json$`url_property`, "(https?|ftp)://[^ /$.?#].[^\\s]*")) {
|
||||
stop(paste("Error! Invalid URL:", input_json$`url_property`))
|
||||
stop(paste("Error! Invalid data for `url_property`. Must be a URL:", input_json$`url_property`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Date: the required field `url_property` is missing."))
|
||||
|
@ -37,15 +37,21 @@ Dog <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `color` = "red", `breed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`color`)) {
|
||||
stopifnot(is.character(`color`), length(`color`) == 1)
|
||||
if (!(is.character(`color`) && length(`color`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
|
||||
}
|
||||
self$`color` <- `color`
|
||||
}
|
||||
if (!is.null(`breed`)) {
|
||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||
if (!(is.character(`breed`) && length(`breed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `breed`. Must be a string:", `breed`))
|
||||
}
|
||||
self$`breed` <- `breed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -184,7 +190,9 @@ Dog <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Dog: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ DogAllOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`breed` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`breed`)) {
|
||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||
if (!(is.character(`breed`) && length(`breed`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `breed`. Must be a string:", `breed`))
|
||||
}
|
||||
self$`breed` <- `breed`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -78,37 +78,51 @@ FormatTest <- R6::R6Class(
|
||||
self$`byte` <- `byte`
|
||||
}
|
||||
if (!missing(`date`)) {
|
||||
if (!is.character(`date`)) {
|
||||
stop(paste("Error! Invalid Date. Must be a string:", `date`))
|
||||
if (!(is.character(`date`) && length(`date`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `date`. Must be a string:", `date`))
|
||||
}
|
||||
self$`date` <- `date`
|
||||
}
|
||||
if (!missing(`password`)) {
|
||||
stopifnot(is.character(`password`), length(`password`) == 1)
|
||||
if (!(is.character(`password`) && length(`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", `password`))
|
||||
}
|
||||
self$`password` <- `password`
|
||||
}
|
||||
if (!is.null(`integer`)) {
|
||||
stopifnot(is.numeric(`integer`), length(`integer`) == 1)
|
||||
if (!(is.numeric(`integer`) && length(`integer`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `integer`. Must be an integer:", `integer`))
|
||||
}
|
||||
self$`integer` <- `integer`
|
||||
}
|
||||
if (!is.null(`int32`)) {
|
||||
stopifnot(is.numeric(`int32`), length(`int32`) == 1)
|
||||
if (!(is.numeric(`int32`) && length(`int32`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `int32`. Must be an integer:", `int32`))
|
||||
}
|
||||
self$`int32` <- `int32`
|
||||
}
|
||||
if (!is.null(`int64`)) {
|
||||
stopifnot(is.numeric(`int64`), length(`int64`) == 1)
|
||||
if (!(is.numeric(`int64`) && length(`int64`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `int64`. Must be an integer:", `int64`))
|
||||
}
|
||||
self$`int64` <- `int64`
|
||||
}
|
||||
if (!is.null(`float`)) {
|
||||
stopifnot(is.numeric(`float`), length(`float`) == 1)
|
||||
if (!(is.numeric(`float`) && length(`float`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `float`. Must be a number:", `float`))
|
||||
}
|
||||
self$`float` <- `float`
|
||||
}
|
||||
if (!is.null(`double`)) {
|
||||
stopifnot(is.numeric(`double`), length(`double`) == 1)
|
||||
if (!(is.numeric(`double`) && length(`double`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `double`. Must be a number:", `double`))
|
||||
}
|
||||
self$`double` <- `double`
|
||||
}
|
||||
if (!is.null(`string`)) {
|
||||
stopifnot(is.character(`string`), length(`string`) == 1)
|
||||
if (!(is.character(`string`) && length(`string`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `string`. Must be a string:", `string`))
|
||||
}
|
||||
self$`string` <- `string`
|
||||
}
|
||||
if (!is.null(`binary`)) {
|
||||
@ -116,20 +130,26 @@ FormatTest <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(`dateTime`)) {
|
||||
if (!is.character(`dateTime`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `dateTime`))
|
||||
stop(paste("Error! Invalid data for `dateTime`. Must be a string:", `dateTime`))
|
||||
}
|
||||
self$`dateTime` <- `dateTime`
|
||||
}
|
||||
if (!is.null(`uuid`)) {
|
||||
stopifnot(is.character(`uuid`), length(`uuid`) == 1)
|
||||
if (!(is.character(`uuid`) && length(`uuid`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `uuid`. Must be a string:", `uuid`))
|
||||
}
|
||||
self$`uuid` <- `uuid`
|
||||
}
|
||||
if (!is.null(`pattern_with_digits`)) {
|
||||
stopifnot(is.character(`pattern_with_digits`), length(`pattern_with_digits`) == 1)
|
||||
if (!(is.character(`pattern_with_digits`) && length(`pattern_with_digits`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `pattern_with_digits`. Must be a string:", `pattern_with_digits`))
|
||||
}
|
||||
self$`pattern_with_digits` <- `pattern_with_digits`
|
||||
}
|
||||
if (!is.null(`pattern_with_digits_and_delimiter`)) {
|
||||
stopifnot(is.character(`pattern_with_digits_and_delimiter`), length(`pattern_with_digits_and_delimiter`) == 1)
|
||||
if (!(is.character(`pattern_with_digits_and_delimiter`) && length(`pattern_with_digits_and_delimiter`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `pattern_with_digits_and_delimiter`. Must be a string:", `pattern_with_digits_and_delimiter`))
|
||||
}
|
||||
self$`pattern_with_digits_and_delimiter` <- `pattern_with_digits_and_delimiter`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -470,13 +490,17 @@ FormatTest <- R6::R6Class(
|
||||
}
|
||||
# check the required field `date`
|
||||
if (!is.null(input_json$`date`)) {
|
||||
stopifnot(is.character(input_json$`date`), length(input_json$`date`) == 1)
|
||||
if (!(is.character(input_json$`date`) && length(input_json$`date`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `date`. Must be a string:", input_json$`date`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for FormatTest: the required field `date` is missing."))
|
||||
}
|
||||
# check the required field `password`
|
||||
if (!is.null(input_json$`password`)) {
|
||||
stopifnot(is.character(input_json$`password`), length(input_json$`password`) == 1)
|
||||
if (!(is.character(input_json$`password`) && length(input_json$`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", input_json$`password`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for FormatTest: the required field `password` is missing."))
|
||||
}
|
||||
|
@ -36,15 +36,21 @@ ModelApiResponse <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`code` = NULL, `type` = NULL, `message` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`code`)) {
|
||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||
if (!(is.numeric(`code`) && length(`code`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `code`. Must be an integer:", `code`))
|
||||
}
|
||||
self$`code` <- `code`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(`message`)) {
|
||||
stopifnot(is.character(`message`), length(`message`) == 1)
|
||||
if (!(is.character(`message`) && length(`message`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `message`. Must be a string:", `message`))
|
||||
}
|
||||
self$`message` <- `message`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,7 +33,9 @@ NestedOneOf <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`size` = NULL, `nested_pig` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`size`)) {
|
||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||
if (!(is.numeric(`size`) && length(`size`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `size`. Must be an integer:", `size`))
|
||||
}
|
||||
self$`size` <- `size`
|
||||
}
|
||||
if (!is.null(`nested_pig`)) {
|
||||
|
@ -45,20 +45,26 @@ Order <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`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)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`petId`)) {
|
||||
stopifnot(is.numeric(`petId`), length(`petId`) == 1)
|
||||
if (!(is.numeric(`petId`) && length(`petId`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `petId`. Must be an integer:", `petId`))
|
||||
}
|
||||
self$`petId` <- `petId`
|
||||
}
|
||||
if (!is.null(`quantity`)) {
|
||||
stopifnot(is.numeric(`quantity`), length(`quantity`) == 1)
|
||||
if (!(is.numeric(`quantity`) && length(`quantity`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `quantity`. Must be an integer:", `quantity`))
|
||||
}
|
||||
self$`quantity` <- `quantity`
|
||||
}
|
||||
if (!is.null(`shipDate`)) {
|
||||
if (!is.character(`shipDate`)) {
|
||||
stop(paste("Error! Invalid DateTime. Must be a string:", `shipDate`))
|
||||
stop(paste("Error! Invalid data for `shipDate`. Must be a string:", `shipDate`))
|
||||
}
|
||||
self$`shipDate` <- `shipDate`
|
||||
}
|
||||
@ -66,11 +72,15 @@ Order <- R6::R6Class(
|
||||
if (!(`status` %in% c("placed", "approved", "delivered"))) {
|
||||
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"placed\", \"approved\", \"delivered\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`status`), length(`status`) == 1)
|
||||
if (!(is.character(`status`) && length(`status`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
|
||||
}
|
||||
self$`status` <- `status`
|
||||
}
|
||||
if (!is.null(`complete`)) {
|
||||
stopifnot(is.logical(`complete`), length(`complete`) == 1)
|
||||
if (!(is.logical(`complete`) && length(`complete`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `complete`. Must be a boolean:", `complete`))
|
||||
}
|
||||
self$`complete` <- `complete`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -45,7 +45,9 @@ Pet <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!missing(`photoUrls`)) {
|
||||
@ -54,7 +56,9 @@ Pet <- R6::R6Class(
|
||||
self$`photoUrls` <- `photoUrls`
|
||||
}
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`category`)) {
|
||||
@ -70,7 +74,9 @@ Pet <- R6::R6Class(
|
||||
if (!(`status` %in% c("available", "pending", "sold"))) {
|
||||
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`status`), length(`status`) == 1)
|
||||
if (!(is.character(`status`) && length(`status`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
|
||||
}
|
||||
self$`status` <- `status`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -265,7 +271,9 @@ Pet <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `name`
|
||||
if (!is.null(input_json$`name`)) {
|
||||
stopifnot(is.character(input_json$`name`), length(input_json$`name`) == 1)
|
||||
if (!(is.character(input_json$`name`) && length(input_json$`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", input_json$`name`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `name` is missing."))
|
||||
}
|
||||
|
@ -56,27 +56,39 @@ Special <- R6::R6Class(
|
||||
self$`set_test` <- `set_test`
|
||||
}
|
||||
if (!is.null(`item_self`)) {
|
||||
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
|
||||
if (!(is.numeric(`item_self`) && length(`item_self`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_self`. Must be an integer:", `item_self`))
|
||||
}
|
||||
self$`item_self` <- `item_self`
|
||||
}
|
||||
if (!is.null(`item_private`)) {
|
||||
stopifnot(is.character(`item_private`), length(`item_private`) == 1)
|
||||
if (!(is.character(`item_private`) && length(`item_private`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_private`. Must be a string:", `item_private`))
|
||||
}
|
||||
self$`item_private` <- `item_private`
|
||||
}
|
||||
if (!is.null(`item_super`)) {
|
||||
stopifnot(is.character(`item_super`), length(`item_super`) == 1)
|
||||
if (!(is.character(`item_super`) && length(`item_super`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `item_super`. Must be a string:", `item_super`))
|
||||
}
|
||||
self$`item_super` <- `item_super`
|
||||
}
|
||||
if (!is.null(`123_number`)) {
|
||||
stopifnot(is.character(`123_number`), length(`123_number`) == 1)
|
||||
if (!(is.character(`123_number`) && length(`123_number`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `123_number`. Must be a string:", `123_number`))
|
||||
}
|
||||
self$`123_number` <- `123_number`
|
||||
}
|
||||
if (!is.null(`array[test]`)) {
|
||||
stopifnot(is.character(`array[test]`), length(`array[test]`) == 1)
|
||||
if (!(is.character(`array[test]`) && length(`array[test]`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `array[test]`. Must be a string:", `array[test]`))
|
||||
}
|
||||
self$`array[test]` <- `array[test]`
|
||||
}
|
||||
if (!is.null(`empty_string`)) {
|
||||
stopifnot(is.character(`empty_string`), length(`empty_string`) == 1)
|
||||
if (!(is.character(`empty_string`) && length(`empty_string`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `empty_string`. Must be a string:", `empty_string`))
|
||||
}
|
||||
self$`empty_string` <- `empty_string`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -33,11 +33,15 @@ Tag <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`id` = NULL, `name` = NULL, additional_properties = NULL, ...) {
|
||||
if (!is.null(`id`)) {
|
||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`name`)) {
|
||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||
if (!(is.character(`name`) && length(`name`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
|
||||
}
|
||||
self$`name` <- `name`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -51,35 +51,51 @@ User <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`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)
|
||||
if (!(is.numeric(`id`) && length(`id`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
|
||||
}
|
||||
self$`id` <- `id`
|
||||
}
|
||||
if (!is.null(`username`)) {
|
||||
stopifnot(is.character(`username`), length(`username`) == 1)
|
||||
if (!(is.character(`username`) && length(`username`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `username`. Must be a string:", `username`))
|
||||
}
|
||||
self$`username` <- `username`
|
||||
}
|
||||
if (!is.null(`firstName`)) {
|
||||
stopifnot(is.character(`firstName`), length(`firstName`) == 1)
|
||||
if (!(is.character(`firstName`) && length(`firstName`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `firstName`. Must be a string:", `firstName`))
|
||||
}
|
||||
self$`firstName` <- `firstName`
|
||||
}
|
||||
if (!is.null(`lastName`)) {
|
||||
stopifnot(is.character(`lastName`), length(`lastName`) == 1)
|
||||
if (!(is.character(`lastName`) && length(`lastName`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `lastName`. Must be a string:", `lastName`))
|
||||
}
|
||||
self$`lastName` <- `lastName`
|
||||
}
|
||||
if (!is.null(`email`)) {
|
||||
stopifnot(is.character(`email`), length(`email`) == 1)
|
||||
if (!(is.character(`email`) && length(`email`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `email`. Must be a string:", `email`))
|
||||
}
|
||||
self$`email` <- `email`
|
||||
}
|
||||
if (!is.null(`password`)) {
|
||||
stopifnot(is.character(`password`), length(`password`) == 1)
|
||||
if (!(is.character(`password`) && length(`password`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `password`. Must be a string:", `password`))
|
||||
}
|
||||
self$`password` <- `password`
|
||||
}
|
||||
if (!is.null(`phone`)) {
|
||||
stopifnot(is.character(`phone`), length(`phone`) == 1)
|
||||
if (!(is.character(`phone`) && length(`phone`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `phone`. Must be a string:", `phone`))
|
||||
}
|
||||
self$`phone` <- `phone`
|
||||
}
|
||||
if (!is.null(`userStatus`)) {
|
||||
stopifnot(is.numeric(`userStatus`), length(`userStatus`) == 1)
|
||||
if (!(is.numeric(`userStatus`) && length(`userStatus`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `userStatus`. Must be an integer:", `userStatus`))
|
||||
}
|
||||
self$`userStatus` <- `userStatus`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
|
@ -36,15 +36,21 @@ Whale <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `hasBaleen` = NULL, `hasTeeth` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`hasBaleen`)) {
|
||||
stopifnot(is.logical(`hasBaleen`), length(`hasBaleen`) == 1)
|
||||
if (!(is.logical(`hasBaleen`) && length(`hasBaleen`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `hasBaleen`. Must be a boolean:", `hasBaleen`))
|
||||
}
|
||||
self$`hasBaleen` <- `hasBaleen`
|
||||
}
|
||||
if (!is.null(`hasTeeth`)) {
|
||||
stopifnot(is.logical(`hasTeeth`), length(`hasTeeth`) == 1)
|
||||
if (!(is.logical(`hasTeeth`) && length(`hasTeeth`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `hasTeeth`. Must be a boolean:", `hasTeeth`))
|
||||
}
|
||||
self$`hasTeeth` <- `hasTeeth`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -183,7 +189,9 @@ Whale <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Whale: the required field `className` is missing."))
|
||||
}
|
||||
|
@ -33,14 +33,18 @@ Zebra <- R6::R6Class(
|
||||
#' @export
|
||||
initialize = function(`className`, `type` = NULL, additional_properties = NULL, ...) {
|
||||
if (!missing(`className`)) {
|
||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||
if (!(is.character(`className`) && length(`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", `className`))
|
||||
}
|
||||
self$`className` <- `className`
|
||||
}
|
||||
if (!is.null(`type`)) {
|
||||
if (!(`type` %in% c("plains", "mountain", "grevys"))) {
|
||||
stop(paste("Error! \"", `type`, "\" cannot be assigned to `type`. Must be \"plains\", \"mountain\", \"grevys\".", sep = ""))
|
||||
}
|
||||
stopifnot(is.character(`type`), length(`type`) == 1)
|
||||
if (!(is.character(`type`) && length(`type`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `type`. Must be a string:", `type`))
|
||||
}
|
||||
self$`type` <- `type`
|
||||
}
|
||||
if (!is.null(additional_properties)) {
|
||||
@ -169,7 +173,9 @@ Zebra <- R6::R6Class(
|
||||
input_json <- jsonlite::fromJSON(input)
|
||||
# check the required field `className`
|
||||
if (!is.null(input_json$`className`)) {
|
||||
stopifnot(is.character(input_json$`className`), length(input_json$`className`) == 1)
|
||||
if (!(is.character(input_json$`className`) && length(input_json$`className`) == 1)) {
|
||||
stop(paste("Error! Invalid data for `className`. Must be a string:", input_json$`className`))
|
||||
}
|
||||
} else {
|
||||
stop(paste("The JSON input `", input, "` is invalid for Zebra: the required field `className` is missing."))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user