diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java index f5830ce1e57..137805cde1b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java @@ -607,6 +607,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { this.operationIdNaming = operationIdNaming; } + @Override public String escapeQuotationMark(String input) { // remove " to avoid code injection @@ -952,8 +953,8 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { } // remove trailing '/' - if (pattern.charAt(pattern.length()-1) == '/') { - pattern = pattern.substring(0, pattern.length()-1); + if (pattern.charAt(pattern.length() - 1) == '/') { + pattern = pattern.substring(0, pattern.length() - 1); } return escapeText(pattern); diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 527b62d4eb2..1b93f6119c2 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -573,4 +573,4 @@ {{/operation}} ) ) -{{/operations}} +{{/operations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache index 129530a51f3..a608280e8cd 100644 --- a/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/r/modelGeneric.mustache @@ -354,6 +354,125 @@ #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + {{#allVars}} + {{^isNullable}} + {{#required}} + # check if the required `{{{name}}}` is null + if (is.null(`{{{name}}}`)) { + FALSE + } + + {{/required}} + {{/isNullable}} + {{#hasValidation}} + {{#maxLength}} + if (nchar(`{{{name}}}`) > {{maxLength}}) { + FALSE + } + {{/maxLength}} + {{#minLength}} + if (nchar(`{{{name}}}`) < {{minLength}}) { + FALSE + } + {{/minLength}} + {{#maximum}} + if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + FALSE + } + {{/maximum}} + {{#minimum}} + if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + FALSE + } + {{/minimum}} + {{#pattern}} + if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) { + FALSE + } + {{/pattern}} + {{#maxItems}} + if (length(`{{{name}}}`) > {{maxItems}}) { + FALSE + } + {{/maxItems}} + {{#minItems}} + if (length(`{{{name}}}`) < {{minItems}}) { + FALSE + } + {{/minItems}} + + {{/hasValidation}} + {{/allVars}} + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + {{#allVars}} + {{^isNullable}} + {{#required}} + # check if the required `{{{name}}}` is null + if (is.null(`{{{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}}." + } + {{/maxLength}} + {{#minLength}} + if (nchar(`{{{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}}." + } + {{/maximum}} + {{#minimum}} + if (`{{{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}}}." + } + {{/pattern}} + {{#maxItems}} + if (length(`{{{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}}." + } + {{/minItems}} + + {{/hasValidation}} + {{/allVars}} + 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 8cae653d3e6..8a148dbd067 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 @@ -210,6 +210,27 @@ AllofTagApiResponse <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R-httr2/R/animal.R b/samples/client/petstore/R-httr2/R/animal.R index 3640667985a..9189e9c1597 100644 --- a/samples/client/petstore/R-httr2/R/animal.R +++ b/samples/client/petstore/R-httr2/R/animal.R @@ -147,6 +147,37 @@ Animal <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + 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 0324d48c10a..3a4ca70654e 100644 --- a/samples/client/petstore/R-httr2/R/basque_pig.R +++ b/samples/client/petstore/R-httr2/R/basque_pig.R @@ -153,6 +153,47 @@ BasquePig <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + # check if the required `color` is null + if (is.null(`color`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + # check if the required `color` is null + if (is.null(`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 1ec34dc4a75..1d9a7017f55 100644 --- a/samples/client/petstore/R-httr2/R/cat.R +++ b/samples/client/petstore/R-httr2/R/cat.R @@ -171,6 +171,37 @@ Cat <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + 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 063ece351fd..8f6055ccd29 100644 --- a/samples/client/petstore/R-httr2/R/cat_all_of.R +++ b/samples/client/petstore/R-httr2/R/cat_all_of.R @@ -118,6 +118,27 @@ CatAllOf <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R-httr2/R/category.R b/samples/client/petstore/R-httr2/R/category.R index 051506bbc9e..0bd55f34ce2 100644 --- a/samples/client/petstore/R-httr2/R/category.R +++ b/samples/client/petstore/R-httr2/R/category.R @@ -141,6 +141,35 @@ Category <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @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 + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @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]+$." + } + + 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 97eef4cda57..a7584f4700b 100644 --- a/samples/client/petstore/R-httr2/R/danish_pig.R +++ b/samples/client/petstore/R-httr2/R/danish_pig.R @@ -153,6 +153,47 @@ DanishPig <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + # check if the required `size` is null + if (is.null(`size`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + # check if the required `size` is null + if (is.null(`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 b52f75ccbae..59f39c2e091 100644 --- a/samples/client/petstore/R-httr2/R/dog.R +++ b/samples/client/petstore/R-httr2/R/dog.R @@ -171,6 +171,37 @@ Dog <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + 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 8f4328feb28..8956ffc3771 100644 --- a/samples/client/petstore/R-httr2/R/dog_all_of.R +++ b/samples/client/petstore/R-httr2/R/dog_all_of.R @@ -118,6 +118,27 @@ DogAllOf <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) 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 a5b39c53444..713ab123bb7 100644 --- a/samples/client/petstore/R-httr2/R/model_api_response.R +++ b/samples/client/petstore/R-httr2/R/model_api_response.R @@ -164,6 +164,27 @@ ModelApiResponse <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) 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 0c86dbd7075..95840db010f 100644 --- a/samples/client/petstore/R-httr2/R/nested_one_of.R +++ b/samples/client/petstore/R-httr2/R/nested_one_of.R @@ -143,6 +143,27 @@ NestedOneOf <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R-httr2/R/order.R b/samples/client/petstore/R-httr2/R/order.R index 3d342c3a4f7..892cb94a4d4 100644 --- a/samples/client/petstore/R-httr2/R/order.R +++ b/samples/client/petstore/R-httr2/R/order.R @@ -233,6 +233,27 @@ Order <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R-httr2/R/pet.R b/samples/client/petstore/R-httr2/R/pet.R index 08a0dd66ac5..e8537ad77d0 100644 --- a/samples/client/petstore/R-httr2/R/pet.R +++ b/samples/client/petstore/R-httr2/R/pet.R @@ -250,6 +250,47 @@ Pet <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `name` is null + if (is.null(`name`)) { + FALSE + } + + # check if the required `photoUrls` is null + if (is.null(`photoUrls`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + # check if the required `photoUrls` is null + if (is.null(`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 0680b7f193d..5027b80757e 100644 --- a/samples/client/petstore/R-httr2/R/special.R +++ b/samples/client/petstore/R-httr2/R/special.R @@ -233,6 +233,27 @@ Special <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R-httr2/R/tag.R b/samples/client/petstore/R-httr2/R/tag.R index 015063f7191..e0cff8390fe 100644 --- a/samples/client/petstore/R-httr2/R/tag.R +++ b/samples/client/petstore/R-httr2/R/tag.R @@ -141,6 +141,27 @@ Tag <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) 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 de949b175ca..fd573b5a8e3 100644 --- a/samples/client/petstore/R-httr2/R/update_pet_request.R +++ b/samples/client/petstore/R-httr2/R/update_pet_request.R @@ -142,6 +142,27 @@ UpdatePetRequest <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R-httr2/R/user.R b/samples/client/petstore/R-httr2/R/user.R index 541b1ba0332..e99de33bdfc 100644 --- a/samples/client/petstore/R-httr2/R/user.R +++ b/samples/client/petstore/R-httr2/R/user.R @@ -279,6 +279,27 @@ User <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) 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 8cae653d3e6..8a148dbd067 100644 --- a/samples/client/petstore/R/R/allof_tag_api_response.R +++ b/samples/client/petstore/R/R/allof_tag_api_response.R @@ -210,6 +210,27 @@ AllofTagApiResponse <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/animal.R b/samples/client/petstore/R/R/animal.R index 3640667985a..9189e9c1597 100644 --- a/samples/client/petstore/R/R/animal.R +++ b/samples/client/petstore/R/R/animal.R @@ -147,6 +147,37 @@ Animal <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/basque_pig.R b/samples/client/petstore/R/R/basque_pig.R index 0324d48c10a..3a4ca70654e 100644 --- a/samples/client/petstore/R/R/basque_pig.R +++ b/samples/client/petstore/R/R/basque_pig.R @@ -153,6 +153,47 @@ BasquePig <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + # check if the required `color` is null + if (is.null(`color`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + # check if the required `color` is null + if (is.null(`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 1ec34dc4a75..1d9a7017f55 100644 --- a/samples/client/petstore/R/R/cat.R +++ b/samples/client/petstore/R/R/cat.R @@ -171,6 +171,37 @@ Cat <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + 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 063ece351fd..8f6055ccd29 100644 --- a/samples/client/petstore/R/R/cat_all_of.R +++ b/samples/client/petstore/R/R/cat_all_of.R @@ -118,6 +118,27 @@ CatAllOf <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index 051506bbc9e..0bd55f34ce2 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -141,6 +141,35 @@ Category <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @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 + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @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]+$." + } + + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/danish_pig.R b/samples/client/petstore/R/R/danish_pig.R index 97eef4cda57..a7584f4700b 100644 --- a/samples/client/petstore/R/R/danish_pig.R +++ b/samples/client/petstore/R/R/danish_pig.R @@ -153,6 +153,47 @@ DanishPig <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + # check if the required `size` is null + if (is.null(`size`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + # check if the required `size` is null + if (is.null(`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 b52f75ccbae..59f39c2e091 100644 --- a/samples/client/petstore/R/R/dog.R +++ b/samples/client/petstore/R/R/dog.R @@ -171,6 +171,37 @@ Dog <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `className` is null + if (is.null(`className`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + 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 8f4328feb28..8956ffc3771 100644 --- a/samples/client/petstore/R/R/dog_all_of.R +++ b/samples/client/petstore/R/R/dog_all_of.R @@ -118,6 +118,27 @@ DogAllOf <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index a5b39c53444..713ab123bb7 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -164,6 +164,27 @@ ModelApiResponse <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/nested_one_of.R b/samples/client/petstore/R/R/nested_one_of.R index 0c86dbd7075..95840db010f 100644 --- a/samples/client/petstore/R/R/nested_one_of.R +++ b/samples/client/petstore/R/R/nested_one_of.R @@ -143,6 +143,27 @@ NestedOneOf <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 3d342c3a4f7..892cb94a4d4 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -233,6 +233,27 @@ Order <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 08a0dd66ac5..e8537ad77d0 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -250,6 +250,47 @@ Pet <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `name` is null + if (is.null(`name`)) { + FALSE + } + + # check if the required `photoUrls` is null + if (is.null(`photoUrls`)) { + FALSE + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + 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." + } + + # check if the required `photoUrls` is null + if (is.null(`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 0680b7f193d..5027b80757e 100644 --- a/samples/client/petstore/R/R/special.R +++ b/samples/client/petstore/R/R/special.R @@ -233,6 +233,27 @@ Special <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index 015063f7191..e0cff8390fe 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -141,6 +141,27 @@ Tag <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/update_pet_request.R b/samples/client/petstore/R/R/update_pet_request.R index de949b175ca..fd573b5a8e3 100644 --- a/samples/client/petstore/R/R/update_pet_request.R +++ b/samples/client/petstore/R/R/update_pet_request.R @@ -142,6 +142,27 @@ UpdatePetRequest <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) ) diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index 541b1ba0332..e99de33bdfc 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -279,6 +279,27 @@ User <- R6::R6Class( #' @export toString = function() { self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields } ) )