forked from loafle/openapi-generator-original
fix r model validations, add tests (#13181)
This commit is contained in:
parent
9e20b01b12
commit
c4dd42e7a0
@ -367,46 +367,46 @@
|
|||||||
{{^isNullable}}
|
{{^isNullable}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
# check if the required `{{{name}}}` is null
|
# check if the required `{{{name}}}` is null
|
||||||
if (is.null(`{{{name}}}`)) {
|
if (is.null(self$`{{{name}}}`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/isNullable}}
|
{{/isNullable}}
|
||||||
{{#hasValidation}}
|
{{#hasValidation}}
|
||||||
{{#maxLength}}
|
{{#maxLength}}
|
||||||
if (nchar(`{{{name}}}`) > {{maxLength}}) {
|
if (nchar(self$`{{{name}}}`) > {{maxLength}}) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/maxLength}}
|
{{/maxLength}}
|
||||||
{{#minLength}}
|
{{#minLength}}
|
||||||
if (nchar(`{{{name}}}`) < {{minLength}}) {
|
if (nchar(self$`{{{name}}}`) < {{minLength}}) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/minLength}}
|
{{/minLength}}
|
||||||
{{#maximum}}
|
{{#maximum}}
|
||||||
if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
|
if (self$`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/maximum}}
|
{{/maximum}}
|
||||||
{{#minimum}}
|
{{#minimum}}
|
||||||
if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
|
if (self$`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/minimum}}
|
{{/minimum}}
|
||||||
{{#pattern}}
|
{{#pattern}}
|
||||||
if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) {
|
if (!str_detect(self$`{{{name}}}`, "{{{pattern}}}")) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{#maxItems}}
|
{{#maxItems}}
|
||||||
if (length(`{{{name}}}`) > {{maxItems}}) {
|
if (length(self$`{{{name}}}`) > {{maxItems}}) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/maxItems}}
|
{{/maxItems}}
|
||||||
{{#minItems}}
|
{{#minItems}}
|
||||||
if (length(`{{{name}}}`) < {{minItems}}) {
|
if (length(self$`{{{name}}}`) < {{minItems}}) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
{{/minItems}}
|
{{/minItems}}
|
||||||
|
|
||||||
@ -427,46 +427,46 @@
|
|||||||
{{^isNullable}}
|
{{^isNullable}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
# check if the required `{{{name}}}` is null
|
# check if the required `{{{name}}}` is null
|
||||||
if (is.null(`{{{name}}}`)) {
|
if (is.null(self$`{{{name}}}`)) {
|
||||||
invalid_fields[`{{{name}}}`] = "Non-nullable required field `{{{name}}}` cannot be null."
|
invalid_fields["{{{name}}}"] = "Non-nullable required field `{{{name}}}` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/isNullable}}
|
{{/isNullable}}
|
||||||
{{#hasValidation}}
|
{{#hasValidation}}
|
||||||
{{#maxLength}}
|
{{#maxLength}}
|
||||||
if (nchar(`{{{name}}}`) > {{maxLength}}) {
|
if (nchar(self$`{{{name}}}`) > {{maxLength}}) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, must be smaller than or equal to {{maxLength}}."
|
invalid_fields["{{{name}}}"] = "Invalid length for `{{{name}}}`, must be smaller than or equal to {{maxLength}}."
|
||||||
}
|
}
|
||||||
{{/maxLength}}
|
{{/maxLength}}
|
||||||
{{#minLength}}
|
{{#minLength}}
|
||||||
if (nchar(`{{{name}}}`) < {{minLength}}) {
|
if (nchar(self$`{{{name}}}`) < {{minLength}}) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, must be bigger than or equal to {{minLength}}."
|
invalid_fields["{{{name}}}"] = "Invalid length for `{{{name}}}`, must be bigger than or equal to {{minLength}}."
|
||||||
}
|
}
|
||||||
{{/minLength}}
|
{{/minLength}}
|
||||||
{{#maximum}}
|
{{#maximum}}
|
||||||
if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
|
if (self$`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}."
|
invalid_fields["{{{name}}}"] = "Invalid value for `{{{name}}}`, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}."
|
||||||
}
|
}
|
||||||
{{/maximum}}
|
{{/maximum}}
|
||||||
{{#minimum}}
|
{{#minimum}}
|
||||||
if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
|
if (self$`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}."
|
invalid_fields["{{{name}}}"] = "Invalid value for `{{{name}}}`, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}."
|
||||||
}
|
}
|
||||||
{{/minimum}}
|
{{/minimum}}
|
||||||
{{#pattern}}
|
{{#pattern}}
|
||||||
if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) {
|
if (!str_detect(self$`{{{name}}}`, "{{{pattern}}}")) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must conform to the pattern {{{pattern}}}."
|
invalid_fields["{{{name}}}"] = "Invalid value for `{{{name}}}`, must conform to the pattern {{{pattern}}}."
|
||||||
}
|
}
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{#maxItems}}
|
{{#maxItems}}
|
||||||
if (length(`{{{name}}}`) > {{maxItems}}) {
|
if (length(self$`{{{name}}}`) > {{maxItems}}) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, number of items must be less than or equal to {{maxItems}}."
|
invalid_fields["{{{name}}}"] = "Invalid length for `{{{name}}}`, number of items must be less than or equal to {{maxItems}}."
|
||||||
}
|
}
|
||||||
{{/maxItems}}
|
{{/maxItems}}
|
||||||
{{#minItems}}
|
{{#minItems}}
|
||||||
if (length(`{{{name}}}`) < {{minItems}}) {
|
if (length(self$`{{{name}}}`) < {{minItems}}) {
|
||||||
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{param}}}`, number of items must be greater than or equal to {{minItems}}."
|
invalid_fields["{{{name}}}"] = "Invalid length for `{{{param}}}`, number of items must be greater than or equal to {{minItems}}."
|
||||||
}
|
}
|
||||||
{{/minItems}}
|
{{/minItems}}
|
||||||
|
|
||||||
@ -475,4 +475,4 @@
|
|||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -234,3 +234,4 @@ AllofTagApiResponse <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -157,8 +157,8 @@ Animal <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -173,11 +173,12 @@ Animal <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -163,13 +163,13 @@ BasquePig <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `color` is null
|
# check if the required `color` is null
|
||||||
if (is.null(`color`)) {
|
if (is.null(self$`color`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -184,16 +184,17 @@ BasquePig <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `color` is null
|
# check if the required `color` is null
|
||||||
if (is.null(`color`)) {
|
if (is.null(self$`color`)) {
|
||||||
invalid_fields[`color`] = "Non-nullable required field `color` cannot be null."
|
invalid_fields["color"] = "Non-nullable required field `color` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ Cat <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -197,11 +197,12 @@ Cat <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -142,3 +142,4 @@ CatAllOf <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ Category <- R6::R6Class(
|
|||||||
#' @return true if the values in all fields are valid.
|
#' @return true if the values in all fields are valid.
|
||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
if (!str_detect(self$`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -165,11 +165,12 @@ Category <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
if (!str_detect(self$`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
||||||
invalid_fields[`name`] = "Invalid value for `name`, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$."
|
invalid_fields["name"] = "Invalid value for `name`, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -163,13 +163,13 @@ DanishPig <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `size` is null
|
# check if the required `size` is null
|
||||||
if (is.null(`size`)) {
|
if (is.null(self$`size`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -184,16 +184,17 @@ DanishPig <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `size` is null
|
# check if the required `size` is null
|
||||||
if (is.null(`size`)) {
|
if (is.null(self$`size`)) {
|
||||||
invalid_fields[`size`] = "Non-nullable required field `size` cannot be null."
|
invalid_fields["size"] = "Non-nullable required field `size` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ Dog <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -197,11 +197,12 @@ Dog <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -142,3 +142,4 @@ DogAllOf <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -188,3 +188,4 @@ ModelApiResponse <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -167,3 +167,4 @@ NestedOneOf <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -257,3 +257,4 @@ Order <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -260,13 +260,13 @@ Pet <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `name` is null
|
# check if the required `name` is null
|
||||||
if (is.null(`name`)) {
|
if (is.null(self$`name`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `photoUrls` is null
|
# check if the required `photoUrls` is null
|
||||||
if (is.null(`photoUrls`)) {
|
if (is.null(self$`photoUrls`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -281,16 +281,17 @@ Pet <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `name` is null
|
# check if the required `name` is null
|
||||||
if (is.null(`name`)) {
|
if (is.null(self$`name`)) {
|
||||||
invalid_fields[`name`] = "Non-nullable required field `name` cannot be null."
|
invalid_fields["name"] = "Non-nullable required field `name` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `photoUrls` is null
|
# check if the required `photoUrls` is null
|
||||||
if (is.null(`photoUrls`)) {
|
if (is.null(self$`photoUrls`)) {
|
||||||
invalid_fields[`photoUrls`] = "Non-nullable required field `photoUrls` cannot be null."
|
invalid_fields["photoUrls"] = "Non-nullable required field `photoUrls` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -257,3 +257,4 @@ Special <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -165,3 +165,4 @@ Tag <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -166,3 +166,4 @@ UpdatePetRequest <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -303,3 +303,4 @@ User <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -242,6 +242,24 @@ test_that("Tests special item names", {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test_that ("Tests validations", {
|
||||||
|
invalid_pet <- Pet$new()
|
||||||
|
|
||||||
|
expect_false(invalid_pet$isValid())
|
||||||
|
|
||||||
|
invalid_fields <- invalid_pet$getInvalidFields()
|
||||||
|
expect_equal(invalid_fields[["name"]], "Non-nullable required field `name` cannot be null.")
|
||||||
|
expect_equal(invalid_fields[["photoUrls"]], "Non-nullable required field `photoUrls` cannot be null.")
|
||||||
|
|
||||||
|
# fix invalid fields
|
||||||
|
invalid_pet$name <- "valid pet"
|
||||||
|
invalid_pet$photoUrls <- list("photo_test", "second test")
|
||||||
|
|
||||||
|
expect_true(invalid_pet$isValid())
|
||||||
|
expect_equal(invalid_pet$getInvalidFields(), list())
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
test_that("Tests oneOf", {
|
test_that("Tests oneOf", {
|
||||||
basque_pig_json <-
|
basque_pig_json <-
|
||||||
'{"className": "BasquePig", "color": "red"}'
|
'{"className": "BasquePig", "color": "red"}'
|
||||||
|
@ -234,3 +234,4 @@ AllofTagApiResponse <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -157,8 +157,8 @@ Animal <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -173,11 +173,12 @@ Animal <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -163,13 +163,13 @@ BasquePig <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `color` is null
|
# check if the required `color` is null
|
||||||
if (is.null(`color`)) {
|
if (is.null(self$`color`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -184,16 +184,17 @@ BasquePig <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `color` is null
|
# check if the required `color` is null
|
||||||
if (is.null(`color`)) {
|
if (is.null(self$`color`)) {
|
||||||
invalid_fields[`color`] = "Non-nullable required field `color` cannot be null."
|
invalid_fields["color"] = "Non-nullable required field `color` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ Cat <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -197,11 +197,12 @@ Cat <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -142,3 +142,4 @@ CatAllOf <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ Category <- R6::R6Class(
|
|||||||
#' @return true if the values in all fields are valid.
|
#' @return true if the values in all fields are valid.
|
||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
if (!str_detect(self$`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -165,11 +165,12 @@ Category <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
if (!str_detect(self$`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
|
||||||
invalid_fields[`name`] = "Invalid value for `name`, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$."
|
invalid_fields["name"] = "Invalid value for `name`, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -163,13 +163,13 @@ DanishPig <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `size` is null
|
# check if the required `size` is null
|
||||||
if (is.null(`size`)) {
|
if (is.null(self$`size`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -184,16 +184,17 @@ DanishPig <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `size` is null
|
# check if the required `size` is null
|
||||||
if (is.null(`size`)) {
|
if (is.null(self$`size`)) {
|
||||||
invalid_fields[`size`] = "Non-nullable required field `size` cannot be null."
|
invalid_fields["size"] = "Non-nullable required field `size` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ Dog <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -197,11 +197,12 @@ Dog <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `className` is null
|
# check if the required `className` is null
|
||||||
if (is.null(`className`)) {
|
if (is.null(self$`className`)) {
|
||||||
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
|
invalid_fields["className"] = "Non-nullable required field `className` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -142,3 +142,4 @@ DogAllOf <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -188,3 +188,4 @@ ModelApiResponse <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -167,3 +167,4 @@ NestedOneOf <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -257,3 +257,4 @@ Order <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -260,13 +260,13 @@ Pet <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
isValid = function() {
|
isValid = function() {
|
||||||
# check if the required `name` is null
|
# check if the required `name` is null
|
||||||
if (is.null(`name`)) {
|
if (is.null(self$`name`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `photoUrls` is null
|
# check if the required `photoUrls` is null
|
||||||
if (is.null(`photoUrls`)) {
|
if (is.null(self$`photoUrls`)) {
|
||||||
FALSE
|
return(FALSE)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRUE
|
TRUE
|
||||||
@ -281,16 +281,17 @@ Pet <- R6::R6Class(
|
|||||||
getInvalidFields = function() {
|
getInvalidFields = function() {
|
||||||
invalid_fields <- list()
|
invalid_fields <- list()
|
||||||
# check if the required `name` is null
|
# check if the required `name` is null
|
||||||
if (is.null(`name`)) {
|
if (is.null(self$`name`)) {
|
||||||
invalid_fields[`name`] = "Non-nullable required field `name` cannot be null."
|
invalid_fields["name"] = "Non-nullable required field `name` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the required `photoUrls` is null
|
# check if the required `photoUrls` is null
|
||||||
if (is.null(`photoUrls`)) {
|
if (is.null(self$`photoUrls`)) {
|
||||||
invalid_fields[`photoUrls`] = "Non-nullable required field `photoUrls` cannot be null."
|
invalid_fields["photoUrls"] = "Non-nullable required field `photoUrls` cannot be null."
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_fields
|
invalid_fields
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -257,3 +257,4 @@ Special <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -165,3 +165,4 @@ Tag <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -166,3 +166,4 @@ UpdatePetRequest <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -303,3 +303,4 @@ User <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user