diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index a608280e8cd..d8290e4aab9 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -367,46 +367,46 @@ {{^isNullable}} {{#required}} # check if the required `{{{name}}}` is null - if (is.null(`{{{name}}}`)) { - FALSE + if (is.null(self$`{{{name}}}`)) { + return(FALSE) } {{/required}} {{/isNullable}} {{#hasValidation}} {{#maxLength}} - if (nchar(`{{{name}}}`) > {{maxLength}}) { - FALSE + if (nchar(self$`{{{name}}}`) > {{maxLength}}) { + return(FALSE) } {{/maxLength}} {{#minLength}} - if (nchar(`{{{name}}}`) < {{minLength}}) { - FALSE + if (nchar(self$`{{{name}}}`) < {{minLength}}) { + return(FALSE) } {{/minLength}} {{#maximum}} - if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { - FALSE + if (self$`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + return(FALSE) } {{/maximum}} {{#minimum}} - if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { - FALSE + if (self$`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + return(FALSE) } {{/minimum}} {{#pattern}} - if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) { - FALSE + if (!str_detect(self$`{{{name}}}`, "{{{pattern}}}")) { + return(FALSE) } {{/pattern}} {{#maxItems}} - if (length(`{{{name}}}`) > {{maxItems}}) { - FALSE + if (length(self$`{{{name}}}`) > {{maxItems}}) { + return(FALSE) } {{/maxItems}} {{#minItems}} - if (length(`{{{name}}}`) < {{minItems}}) { - FALSE + if (length(self$`{{{name}}}`) < {{minItems}}) { + return(FALSE) } {{/minItems}} @@ -427,46 +427,46 @@ {{^isNullable}} {{#required}} # check if the required `{{{name}}}` is null - if (is.null(`{{{name}}}`)) { - invalid_fields[`{{{name}}}`] = "Non-nullable required field `{{{name}}}` cannot be null." + if (is.null(self$`{{{name}}}`)) { + invalid_fields["{{{name}}}"] = "Non-nullable required field `{{{name}}}` cannot be null." } {{/required}} {{/isNullable}} {{#hasValidation}} {{#maxLength}} - if (nchar(`{{{name}}}`) > {{maxLength}}) { - invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, must be smaller than or equal to {{maxLength}}." + if (nchar(self$`{{{name}}}`) > {{maxLength}}) { + invalid_fields["{{{name}}}"] = "Invalid length for `{{{name}}}`, must be smaller than or equal to {{maxLength}}." } {{/maxLength}} {{#minLength}} - if (nchar(`{{{name}}}`) < {{minLength}}) { - invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, must be bigger than or equal to {{minLength}}." + if (nchar(self$`{{{name}}}`) < {{minLength}}) { + invalid_fields["{{{name}}}"] = "Invalid length for `{{{name}}}`, must be bigger than or equal to {{minLength}}." } {{/minLength}} {{#maximum}} - if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { - invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must be smaller than {{^exclusiveMaximum}}or equal to {{/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}}." } {{/maximum}} {{#minimum}} - if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { - invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must be bigger than {{^exclusiveMinimum}}or equal to {{/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}}." } {{/minimum}} {{#pattern}} - if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) { - invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must conform to the pattern {{{pattern}}}." + if (!str_detect(self$`{{{name}}}`, "{{{pattern}}}")) { + invalid_fields["{{{name}}}"] = "Invalid value for `{{{name}}}`, must conform to the pattern {{{pattern}}}." } {{/pattern}} {{#maxItems}} - if (length(`{{{name}}}`) > {{maxItems}}) { - invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, number of items must be less than or equal to {{maxItems}}." + if (length(self$`{{{name}}}`) > {{maxItems}}) { + invalid_fields["{{{name}}}"] = "Invalid length for `{{{name}}}`, number of items must be less than or equal to {{maxItems}}." } {{/maxItems}} {{#minItems}} - if (length(`{{{name}}}`) < {{minItems}}) { - invalid_fields[`{{{name}}}`] = "Invalid length for `{{{param}}}`, number of items must be greater than or equal to {{minItems}}." + if (length(self$`{{{name}}}`) < {{minItems}}) { + invalid_fields["{{{name}}}"] = "Invalid length for `{{{param}}}`, number of items must be greater than or equal to {{minItems}}." } {{/minItems}} @@ -475,4 +475,4 @@ invalid_fields } ) -) \ No newline at end of file +) diff --git a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R index 8a148dbd067..793f2bcf1a7 100644 --- a/samples/client/petstore/R-httr2/R/allof_tag_api_response.R +++ b/samples/client/petstore/R-httr2/R/allof_tag_api_response.R @@ -234,3 +234,4 @@ AllofTagApiResponse <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 9189e9c1597..05778bcbeba 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -157,8 +157,8 @@ Animal <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } TRUE @@ -173,11 +173,12 @@ Animal <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R-httr2/R/basque_pig.R b/samples/client/petstore/R-httr2/R/basque_pig.R index 3a4ca70654e..6c626a55eca 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -163,13 +163,13 @@ BasquePig <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } # check if the required `color` is null - if (is.null(`color`)) { - FALSE + if (is.null(self$`color`)) { + return(FALSE) } TRUE @@ -184,16 +184,17 @@ BasquePig <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } # check if the required `color` is null - if (is.null(`color`)) { - invalid_fields[`color`] = "Non-nullable required field `color` cannot be null." + if (is.null(self$`color`)) { + invalid_fields["color"] = "Non-nullable required field `color` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R-httr2/R/cat.R b/samples/client/petstore/R-httr2/R/cat.R index 1d9a7017f55..16ea3003ffc 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -181,8 +181,8 @@ Cat <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } TRUE @@ -197,11 +197,12 @@ Cat <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R-httr2/R/cat_all_of.R b/samples/client/petstore/R-httr2/R/cat_all_of.R index 8f6055ccd29..8a0841346f1 100644 --- a/samples/client/petstore/R-httr2/R/cat_all_of.R +++ b/samples/client/petstore/R-httr2/R/cat_all_of.R @@ -142,3 +142,4 @@ CatAllOf <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index 0bd55f34ce2..bc8cbab3637 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -150,8 +150,8 @@ Category <- R6::R6Class( #' @return true if the values in all fields are valid. #' @export isValid = function() { - if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { - FALSE + if (!str_detect(self$`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { + return(FALSE) } TRUE @@ -165,11 +165,12 @@ Category <- R6::R6Class( #' @export getInvalidFields = function() { invalid_fields <- list() - if (!str_detect(`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]+$." + 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 } ) ) + diff --git a/samples/client/petstore/R-httr2/R/danish_pig.R b/samples/client/petstore/R-httr2/R/danish_pig.R index a7584f4700b..a675c01e28e 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -163,13 +163,13 @@ DanishPig <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } # check if the required `size` is null - if (is.null(`size`)) { - FALSE + if (is.null(self$`size`)) { + return(FALSE) } TRUE @@ -184,16 +184,17 @@ DanishPig <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } # check if the required `size` is null - if (is.null(`size`)) { - invalid_fields[`size`] = "Non-nullable required field `size` cannot be null." + if (is.null(self$`size`)) { + invalid_fields["size"] = "Non-nullable required field `size` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R-httr2/R/dog.R b/samples/client/petstore/R-httr2/R/dog.R index 59f39c2e091..ee057d1dd9b 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -181,8 +181,8 @@ Dog <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } TRUE @@ -197,11 +197,12 @@ Dog <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R-httr2/R/dog_all_of.R b/samples/client/petstore/R-httr2/R/dog_all_of.R index 8956ffc3771..cacc9a8be59 100644 --- a/samples/client/petstore/R-httr2/R/dog_all_of.R +++ b/samples/client/petstore/R-httr2/R/dog_all_of.R @@ -142,3 +142,4 @@ DogAllOf <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/model_api_response.R b/samples/client/petstore/R-httr2/R/model_api_response.R index 713ab123bb7..671de10dec2 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -188,3 +188,4 @@ ModelApiResponse <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/nested_one_of.R b/samples/client/petstore/R-httr2/R/nested_one_of.R index 95840db010f..251f18325e6 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -167,3 +167,4 @@ NestedOneOf <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index 892cb94a4d4..d2acccd9416 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -257,3 +257,4 @@ Order <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index e8537ad77d0..aa2a375b50d 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -260,13 +260,13 @@ Pet <- R6::R6Class( #' @export isValid = function() { # check if the required `name` is null - if (is.null(`name`)) { - FALSE + if (is.null(self$`name`)) { + return(FALSE) } # check if the required `photoUrls` is null - if (is.null(`photoUrls`)) { - FALSE + if (is.null(self$`photoUrls`)) { + return(FALSE) } TRUE @@ -281,16 +281,17 @@ Pet <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `name` is null - if (is.null(`name`)) { - invalid_fields[`name`] = "Non-nullable required field `name` cannot be null." + if (is.null(self$`name`)) { + invalid_fields["name"] = "Non-nullable required field `name` cannot be null." } # check if the required `photoUrls` is null - if (is.null(`photoUrls`)) { - invalid_fields[`photoUrls`] = "Non-nullable required field `photoUrls` cannot be null." + if (is.null(self$`photoUrls`)) { + invalid_fields["photoUrls"] = "Non-nullable required field `photoUrls` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R-httr2/R/special.R b/samples/client/petstore/R-httr2/R/special.R index 5027b80757e..733ddf057dd 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -257,3 +257,4 @@ Special <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index e0cff8390fe..871a0a11811 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -165,3 +165,4 @@ Tag <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/update_pet_request.R b/samples/client/petstore/R-httr2/R/update_pet_request.R index fd573b5a8e3..b5e78e331bf 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -166,3 +166,4 @@ UpdatePetRequest <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index e99de33bdfc..bccd1511946 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -303,3 +303,4 @@ User <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R b/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R index 2e9aa2f8842..bd5f6d326b6 100644 --- a/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R +++ b/samples/client/petstore/R-httr2/tests/testthat/test_petstore.R @@ -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", { basque_pig_json <- '{"className": "BasquePig", "color": "red"}' diff --git a/samples/client/petstore/R/R/allof_tag_api_response.R b/samples/client/petstore/R/R/allof_tag_api_response.R index 8a148dbd067..793f2bcf1a7 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -234,3 +234,4 @@ AllofTagApiResponse <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index 9189e9c1597..05778bcbeba 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -157,8 +157,8 @@ Animal <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } TRUE @@ -173,11 +173,12 @@ Animal <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index 3a4ca70654e..6c626a55eca 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -163,13 +163,13 @@ BasquePig <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } # check if the required `color` is null - if (is.null(`color`)) { - FALSE + if (is.null(self$`color`)) { + return(FALSE) } TRUE @@ -184,16 +184,17 @@ BasquePig <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } # check if the required `color` is null - if (is.null(`color`)) { - invalid_fields[`color`] = "Non-nullable required field `color` cannot be null." + if (is.null(self$`color`)) { + invalid_fields["color"] = "Non-nullable required field `color` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R/R/cat.R b/samples/client/petstore/R/R/cat.R index 1d9a7017f55..16ea3003ffc 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -181,8 +181,8 @@ Cat <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } TRUE @@ -197,11 +197,12 @@ Cat <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R/R/cat_all_of.R b/samples/client/petstore/R/R/cat_all_of.R index 8f6055ccd29..8a0841346f1 100644 --- a/samples/client/petstore/R/R/cat_all_of.R +++ b/samples/client/petstore/R/R/cat_all_of.R @@ -142,3 +142,4 @@ CatAllOf <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 0bd55f34ce2..bc8cbab3637 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -150,8 +150,8 @@ Category <- R6::R6Class( #' @return true if the values in all fields are valid. #' @export isValid = function() { - if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { - FALSE + if (!str_detect(self$`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { + return(FALSE) } TRUE @@ -165,11 +165,12 @@ Category <- R6::R6Class( #' @export getInvalidFields = function() { invalid_fields <- list() - if (!str_detect(`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]+$." + 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 } ) ) + diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index a7584f4700b..a675c01e28e 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -163,13 +163,13 @@ DanishPig <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } # check if the required `size` is null - if (is.null(`size`)) { - FALSE + if (is.null(self$`size`)) { + return(FALSE) } TRUE @@ -184,16 +184,17 @@ DanishPig <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } # check if the required `size` is null - if (is.null(`size`)) { - invalid_fields[`size`] = "Non-nullable required field `size` cannot be null." + if (is.null(self$`size`)) { + invalid_fields["size"] = "Non-nullable required field `size` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R/R/dog.R b/samples/client/petstore/R/R/dog.R index 59f39c2e091..ee057d1dd9b 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -181,8 +181,8 @@ Dog <- R6::R6Class( #' @export isValid = function() { # check if the required `className` is null - if (is.null(`className`)) { - FALSE + if (is.null(self$`className`)) { + return(FALSE) } TRUE @@ -197,11 +197,12 @@ Dog <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `className` is null - if (is.null(`className`)) { - invalid_fields[`className`] = "Non-nullable required field `className` cannot be null." + if (is.null(self$`className`)) { + invalid_fields["className"] = "Non-nullable required field `className` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R/R/dog_all_of.R b/samples/client/petstore/R/R/dog_all_of.R index 8956ffc3771..cacc9a8be59 100644 --- a/samples/client/petstore/R/R/dog_all_of.R +++ b/samples/client/petstore/R/R/dog_all_of.R @@ -142,3 +142,4 @@ DogAllOf <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index 713ab123bb7..671de10dec2 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -188,3 +188,4 @@ ModelApiResponse <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index 95840db010f..251f18325e6 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -167,3 +167,4 @@ NestedOneOf <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 892cb94a4d4..d2acccd9416 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -257,3 +257,4 @@ Order <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index e8537ad77d0..aa2a375b50d 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -260,13 +260,13 @@ Pet <- R6::R6Class( #' @export isValid = function() { # check if the required `name` is null - if (is.null(`name`)) { - FALSE + if (is.null(self$`name`)) { + return(FALSE) } # check if the required `photoUrls` is null - if (is.null(`photoUrls`)) { - FALSE + if (is.null(self$`photoUrls`)) { + return(FALSE) } TRUE @@ -281,16 +281,17 @@ Pet <- R6::R6Class( getInvalidFields = function() { invalid_fields <- list() # check if the required `name` is null - if (is.null(`name`)) { - invalid_fields[`name`] = "Non-nullable required field `name` cannot be null." + if (is.null(self$`name`)) { + invalid_fields["name"] = "Non-nullable required field `name` cannot be null." } # check if the required `photoUrls` is null - if (is.null(`photoUrls`)) { - invalid_fields[`photoUrls`] = "Non-nullable required field `photoUrls` cannot be null." + if (is.null(self$`photoUrls`)) { + invalid_fields["photoUrls"] = "Non-nullable required field `photoUrls` cannot be null." } invalid_fields } ) ) + diff --git a/samples/client/petstore/R/R/special.R b/samples/client/petstore/R/R/special.R index 5027b80757e..733ddf057dd 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -257,3 +257,4 @@ Special <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index e0cff8390fe..871a0a11811 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -165,3 +165,4 @@ Tag <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index fd573b5a8e3..b5e78e331bf 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -166,3 +166,4 @@ UpdatePetRequest <- R6::R6Class( } ) ) + diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index e99de33bdfc..bccd1511946 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -303,3 +303,4 @@ User <- R6::R6Class( } ) ) +