diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 4f18c214f11a..1297561f3973 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -206,8 +206,21 @@ {{/requiredParams}} {{#allParams}} + {{^isNullable}} + if (!missing(`{{paramName}}`) && is.null(`{{paramName}}`)) { + {{#useDefaultExceptionHandling}} + stop("Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, `{{paramName}}` is not nullable") + {{/useDefaultExceptionHandling}} + {{#useRlangExceptionHandling}} + rlang::abort(message = "Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, `{{paramName}}` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, `{{paramName}}` is not nullable")) + {{/useRlangExceptionHandling}} + } + {{/isNullable}} {{#maxLength}} - if (nchar(`{{paramName}}`) > {{maxLength}}) { + if (!is.null(`{{paramName}}`) && nchar(`{{paramName}}`) > {{maxLength}}) { {{#useDefaultExceptionHandling}} stop("Invalid length for `{{paramName}}` when calling {{classname}}${{operationId}}, must be smaller than or equal to {{maxLength}}.") {{/useDefaultExceptionHandling}} @@ -220,7 +233,7 @@ } {{/maxLength}} {{#minLength}} - if (nchar(`{{paramName}}`) < {{minLength}}) { + if (!is.null(`{{paramName}}`) && nchar(`{{paramName}}`) < {{minLength}}) { {{#useDefaultExceptionHandling}} stop("Invalid length for `{{paramName}}` when calling {{classname}}${{operationId}}, must be bigger than or equal to {{minLength}}.") {{/useDefaultExceptionHandling}} @@ -233,7 +246,7 @@ } {{/minLength}} {{#maximum}} - if (`{{paramName}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + if (!is.null(`{{paramName}}`) && `{{paramName}}` > {{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { {{#useDefaultExceptionHandling}} stop("Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.") {{/useDefaultExceptionHandling}} @@ -246,7 +259,7 @@ } {{/maximum}} {{#minimum}} - if (`{{paramName}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + if (!is.null(`{{paramName}}`) && `{{paramName}}` < {{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { {{#useDefaultExceptionHandling}} stop("Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.") {{/useDefaultExceptionHandling}} @@ -259,7 +272,7 @@ } {{/minimum}} {{#pattern}} - if (!str_detect(`{{paramName}}`, "{{{pattern}}}")) { + if (!is.null(`{{paramName}}`) && !stringr::str_detect(`{{paramName}}`, "{{{pattern}}}")) { {{#useDefaultExceptionHandling}} stop("Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, must conform to the pattern {{{pattern}}}.") {{/useDefaultExceptionHandling}} @@ -272,7 +285,7 @@ } {{/pattern}} {{#maxItems}} - if (length(`{{paramName}}`) > {{maxItems}}) { + if (!is.null(`{{paramName}}`) && length(`{{paramName}}`) > {{maxItems}}) { {{#useDefaultExceptionHandling}} stop("Invalid length for `{{paramName}}` when calling {{classname}}${{operationId}}, number of items must be less than or equal to {{maxItems}}.") {{/useDefaultExceptionHandling}} @@ -285,7 +298,7 @@ } {{/maxItems}} {{#minItems}} - if (length(`{{paramName}}`) < {{minItems}}) { + if (!is.null(`{{paramName}}`) && length(`{{paramName}}`) < {{minItems}}) { {{#useDefaultExceptionHandling}} stop("Invalid length for `{{paramName}}` when calling {{classname}}${{operationId}}, number of items must be greater than or equal to {{minItems}}.") {{/useDefaultExceptionHandling}} @@ -307,7 +320,7 @@ {{#isArray}} {{#uniqueItems}} # check if items are unique - if (!identical(`{{{paramName}}}`, unique(`{{{paramName}}}`))) { + if (!is.null(`{{paramName}}`) && !identical(`{{{paramName}}}`, unique(`{{{paramName}}}`))) { {{#useDefaultExceptionHandling}} stop("Invalid value for {{{paramName}}} when calling {{classname}}${{operationId}}. Items must be unique.") {{/useDefaultExceptionHandling}} diff --git a/samples/client/echo_api/r/R/body_api.R b/samples/client/echo_api/r/R/body_api.R index 9f16d197edc0..e9213e0dc94f 100644 --- a/samples/client/echo_api/r/R/body_api.R +++ b/samples/client/echo_api/r/R/body_api.R @@ -300,6 +300,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`body`) && is.null(`body`)) { + stop("Invalid value for `body` when calling BodyApi$TestBodyApplicationOctetstreamBinary, `body` is not nullable") + } if (!is.null(`body`)) { local_var_body <- `body`$toJSONString() @@ -400,6 +403,9 @@ BodyApi <- R6::R6Class( stop("Missing required parameter `files`.") } + if (!missing(`files`) && is.null(`files`)) { + stop("Invalid value for `files` when calling BodyApi$TestBodyMultipartFormdataArrayOfBinary, `files` is not nullable") + } file_params["files"] <- httr::upload_file(`files`) local_var_url_path <- "/body/application/octetstream/array_of_binary" @@ -491,6 +497,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`my_file`) && is.null(`my_file`)) { + stop("Invalid value for `my_file` when calling BodyApi$TestBodyMultipartFormdataSingleBinary, `my_file` is not nullable") + } file_params["my-file"] <- httr::upload_file(`my_file`) local_var_url_path <- "/body/application/octetstream/single_binary" @@ -582,6 +591,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`pet`) && is.null(`pet`)) { + stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyAllOfPet, `pet` is not nullable") + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -678,6 +690,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`body`) && is.null(`body`)) { + stop("Invalid value for `body` when calling BodyApi$TestEchoBodyFreeFormObjectResponseString, `body` is not nullable") + } if (!is.null(`body`)) { local_var_body <- `body`$toJSONString() @@ -774,6 +789,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`pet`) && is.null(`pet`)) { + stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyPet, `pet` is not nullable") + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -870,6 +888,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`pet`) && is.null(`pet`)) { + stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyPetResponseString, `pet` is not nullable") + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -966,6 +987,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`body`) && is.null(`body`)) { + stop("Invalid value for `body` when calling BodyApi$TestEchoBodyStringEnum, `body` is not nullable") + } if (!is.null(`body`)) { local_var_body <- `body`$toJSONString() @@ -1062,6 +1086,9 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`tag`) && is.null(`tag`)) { + stop("Invalid value for `tag` when calling BodyApi$TestEchoBodyTagResponseString, `tag` is not nullable") + } if (!is.null(`tag`)) { local_var_body <- `tag`$toJSONString() diff --git a/samples/client/echo_api/r/R/form_api.R b/samples/client/echo_api/r/R/form_api.R index 040ce871545b..1278ba0b2ade 100644 --- a/samples/client/echo_api/r/R/form_api.R +++ b/samples/client/echo_api/r/R/form_api.R @@ -127,8 +127,17 @@ FormApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`integer_form`) && is.null(`integer_form`)) { + stop("Invalid value for `integer_form` when calling FormApi$TestFormIntegerBooleanString, `integer_form` is not nullable") + } + if (!missing(`boolean_form`) && is.null(`boolean_form`)) { + stop("Invalid value for `boolean_form` when calling FormApi$TestFormIntegerBooleanString, `boolean_form` is not nullable") + } + if (!missing(`string_form`) && is.null(`string_form`)) { + stop("Invalid value for `string_form` when calling FormApi$TestFormIntegerBooleanString, `string_form` is not nullable") + } form_params["integer_form"] <- `integer_form` form_params["boolean_form"] <- `boolean_form` @@ -226,6 +235,9 @@ FormApi <- R6::R6Class( stop("Missing required parameter `marker`.") } + if (!missing(`marker`) && is.null(`marker`)) { + stop("Invalid value for `marker` when calling FormApi$TestFormObjectMultipart, `marker` is not nullable") + } form_params["marker"] <- `marker` local_var_url_path <- "/form/object/multipart" @@ -327,11 +339,29 @@ FormApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`form1`) && is.null(`form1`)) { + stop("Invalid value for `form1` when calling FormApi$TestFormOneof, `form1` is not nullable") + } + if (!missing(`form2`) && is.null(`form2`)) { + stop("Invalid value for `form2` when calling FormApi$TestFormOneof, `form2` is not nullable") + } + if (!missing(`form3`) && is.null(`form3`)) { + stop("Invalid value for `form3` when calling FormApi$TestFormOneof, `form3` is not nullable") + } + if (!missing(`form4`) && is.null(`form4`)) { + stop("Invalid value for `form4` when calling FormApi$TestFormOneof, `form4` is not nullable") + } + if (!missing(`id`) && is.null(`id`)) { + stop("Invalid value for `id` when calling FormApi$TestFormOneof, `id` is not nullable") + } + if (!missing(`name`) && is.null(`name`)) { + stop("Invalid value for `name` when calling FormApi$TestFormOneof, `name` is not nullable") + } form_params["form1"] <- `form1` form_params["form2"] <- `form2` diff --git a/samples/client/echo_api/r/R/header_api.R b/samples/client/echo_api/r/R/header_api.R index c20fab0df874..21280ce6b645 100644 --- a/samples/client/echo_api/r/R/header_api.R +++ b/samples/client/echo_api/r/R/header_api.R @@ -100,10 +100,25 @@ HeaderApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`integer_header`) && is.null(`integer_header`)) { + stop("Invalid value for `integer_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `integer_header` is not nullable") + } + if (!missing(`boolean_header`) && is.null(`boolean_header`)) { + stop("Invalid value for `boolean_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `boolean_header` is not nullable") + } + if (!missing(`string_header`) && is.null(`string_header`)) { + stop("Invalid value for `string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `string_header` is not nullable") + } + if (!missing(`enum_nonref_string_header`) && is.null(`enum_nonref_string_header`)) { + stop("Invalid value for `enum_nonref_string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `enum_nonref_string_header` is not nullable") + } + if (!missing(`enum_ref_string_header`) && is.null(`enum_ref_string_header`)) { + stop("Invalid value for `enum_ref_string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `enum_ref_string_header` is not nullable") + } header_params["integer_header"] <- `integer_header` diff --git a/samples/client/echo_api/r/R/path_api.R b/samples/client/echo_api/r/R/path_api.R index 20456181683f..afe0a36107d0 100644 --- a/samples/client/echo_api/r/R/path_api.R +++ b/samples/client/echo_api/r/R/path_api.R @@ -113,9 +113,21 @@ PathApi <- R6::R6Class( stop("Missing required parameter `enum_ref_string_path`.") } + if (!missing(`path_string`) && is.null(`path_string`)) { + stop("Invalid value for `path_string` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_string` is not nullable") + } + if (!missing(`path_integer`) && is.null(`path_integer`)) { + stop("Invalid value for `path_integer` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_integer` is not nullable") + } + if (!missing(`enum_nonref_string_path`) && is.null(`enum_nonref_string_path`)) { + stop("Invalid value for `enum_nonref_string_path` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `enum_nonref_string_path` is not nullable") + } + if (!missing(`enum_ref_string_path`) && is.null(`enum_ref_string_path`)) { + stop("Invalid value for `enum_ref_string_path` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `enum_ref_string_path` is not nullable") + } local_var_url_path <- "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" if (!missing(`path_string`)) { diff --git a/samples/client/echo_api/r/R/query_api.R b/samples/client/echo_api/r/R/query_api.R index 4fb98bd8008c..b237286bdfaa 100644 --- a/samples/client/echo_api/r/R/query_api.R +++ b/samples/client/echo_api/r/R/query_api.R @@ -221,7 +221,13 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`enum_nonref_string_query`) && is.null(`enum_nonref_string_query`)) { + stop("Invalid value for `enum_nonref_string_query` when calling QueryApi$TestEnumRefString, `enum_nonref_string_query` is not nullable") + } + if (!missing(`enum_ref_string_query`) && is.null(`enum_ref_string_query`)) { + stop("Invalid value for `enum_ref_string_query` when calling QueryApi$TestEnumRefString, `enum_ref_string_query` is not nullable") + } if (!is.null(`enum_nonref_string_query`) && !(`enum_nonref_string_query` %in% c("success", "failure", "unclassified"))) { stop("Invalid value for enum_nonref_string_query when calling QueryApi$TestEnumRefString. Must be [success, failure, unclassified].") @@ -323,8 +329,17 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`datetime_query`) && is.null(`datetime_query`)) { + stop("Invalid value for `datetime_query` when calling QueryApi$TestQueryDatetimeDateString, `datetime_query` is not nullable") + } + if (!missing(`date_query`) && is.null(`date_query`)) { + stop("Invalid value for `date_query` when calling QueryApi$TestQueryDatetimeDateString, `date_query` is not nullable") + } + if (!missing(`string_query`) && is.null(`string_query`)) { + stop("Invalid value for `string_query` when calling QueryApi$TestQueryDatetimeDateString, `string_query` is not nullable") + } query_params[["datetime_query"]] <- `datetime_query` @@ -425,8 +440,17 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`integer_query`) && is.null(`integer_query`)) { + stop("Invalid value for `integer_query` when calling QueryApi$TestQueryIntegerBooleanString, `integer_query` is not nullable") + } + if (!missing(`boolean_query`) && is.null(`boolean_query`)) { + stop("Invalid value for `boolean_query` when calling QueryApi$TestQueryIntegerBooleanString, `boolean_query` is not nullable") + } + if (!missing(`string_query`) && is.null(`string_query`)) { + stop("Invalid value for `string_query` when calling QueryApi$TestQueryIntegerBooleanString, `string_query` is not nullable") + } query_params[["integer_query"]] <- `integer_query` @@ -523,6 +547,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleDeepObjectExplodeTrueObject, `query_object` is not nullable") + } query_params[["query_object"]] <- `query_object` @@ -615,6 +642,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleDeepObjectExplodeTrueObjectAllOf, `query_object` is not nullable") + } query_params[["query_object"]] <- `query_object` @@ -707,6 +737,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeFalseArrayInteger, `query_object` is not nullable") + } # no explore query_params[["query_object"]] <- I(paste(lapply(`query_object`, URLencode, reserved = TRUE), collapse = ",")) @@ -800,6 +833,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeFalseArrayString, `query_object` is not nullable") + } # no explore query_params[["query_object"]] <- I(paste(lapply(`query_object`, URLencode, reserved = TRUE), collapse = ",")) @@ -893,6 +929,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueArrayString, `query_object` is not nullable") + } query_params[["query_object"]] <- `query_object` @@ -985,6 +1024,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueObject, `query_object` is not nullable") + } query_params[["query_object"]] <- `query_object` @@ -1077,6 +1119,9 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`query_object`) && is.null(`query_object`)) { + stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueObjectAllOf, `query_object` is not nullable") + } query_params[["query_object"]] <- `query_object` diff --git a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R index b314363f4b68..9210f42424b2 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R @@ -221,6 +221,12 @@ FakeApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling FakeApi$add_pet_optional, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling FakeApi$add_pet_optional, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -345,7 +351,19 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `dummy`.")) } + if (!missing(`dummy`) && is.null(`dummy`)) { + rlang::abort(message = "Invalid value for `dummy` when calling FakeApi$fake_data_file, `dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `dummy` when calling FakeApi$fake_data_file, `dummy` is not nullable")) + } + if (!missing(`var_data_file`) && is.null(`var_data_file`)) { + rlang::abort(message = "Invalid value for `var_data_file` when calling FakeApi$fake_data_file, `var_data_file` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `var_data_file` when calling FakeApi$fake_data_file, `var_data_file` is not nullable")) + } header_params["dummy"] <- `dummy` @@ -460,6 +478,12 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `path_array`.")) } + if (!missing(`path_array`) && is.null(`path_array`)) { + rlang::abort(message = "Invalid value for `path_array` when calling FakeApi$fake_path_array, `path_array` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `path_array` when calling FakeApi$fake_path_array, `path_array` is not nullable")) + } local_var_url_path <- "/fake/path_array/{path_array}/testing" if (!missing(`path_array`)) { @@ -561,7 +585,13 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (!str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { + if (!missing(`reg_exp_test`) && is.null(`reg_exp_test`)) { + rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, `reg_exp_test` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, `reg_exp_test` is not nullable")) + } + if (!is.null(`reg_exp_test`) && !stringr::str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, must conform to the pattern ^[A-Za-z0-9_]{1,15}$.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, @@ -675,10 +705,22 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } + if (!missing(`set_dummy`) && is.null(`set_dummy`)) { + rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query, `set_dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query, `set_dummy` is not nullable")) + } + if (!missing(`array_dummy`) && is.null(`array_dummy`)) { + rlang::abort(message = "Invalid value for `array_dummy` when calling FakeApi$fake_set_query, `array_dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `array_dummy` when calling FakeApi$fake_set_query, `array_dummy` is not nullable")) + } # check if items are unique - if (!identical(`set_dummy`, unique(`set_dummy`))) { + if (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) { rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query. Items must be unique.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_api.R b/samples/client/petstore/R-httr2-wrapper/R/pet_api.R index e32bd6cea711..83b4a7141c28 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_api.R @@ -431,6 +431,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling PetApi$add_pet, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling PetApi$add_pet, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -553,7 +559,19 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$delete_pet, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$delete_pet, `pet_id` is not nullable")) + } + if (!missing(`api_key`) && is.null(`api_key`)) { + rlang::abort(message = "Invalid value for `api_key` when calling PetApi$delete_pet, `api_key` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `api_key` when calling PetApi$delete_pet, `api_key` is not nullable")) + } header_params["api_key"] <- `api_key` @@ -662,6 +680,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `status`.")) } + if (!missing(`status`) && is.null(`status`)) { + rlang::abort(message = "Invalid value for `status` when calling PetApi$find_pets_by_status, `status` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `status` when calling PetApi$find_pets_by_status, `status` is not nullable")) + } # explore for (query_item in `status`) { @@ -789,6 +813,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `tags`.")) } + if (!missing(`tags`) && is.null(`tags`)) { + rlang::abort(message = "Invalid value for `tags` when calling PetApi$find_pets_by_tags, `tags` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `tags` when calling PetApi$find_pets_by_tags, `tags` is not nullable")) + } # no explore query_params[["tags"]] <- I(paste(lapply(`tags`, URLencode, reserved = TRUE), collapse = ",")) @@ -904,6 +934,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id, `pet_id` is not nullable")) + } local_var_url_path <- "/pet/{petId}" if (!missing(`pet_id`)) { @@ -1030,6 +1066,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id_streaming, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id_streaming, `pet_id` is not nullable")) + } local_var_url_path <- "/pet/{petId}?streaming" if (!missing(`pet_id`)) { @@ -1161,6 +1203,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `header_test_int`.")) } + if (!missing(`header_test_int`) && is.null(`header_test_int`)) { + rlang::abort(message = "Invalid value for `header_test_int` when calling PetApi$test_header, `header_test_int` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `header_test_int` when calling PetApi$test_header, `header_test_int` is not nullable")) + } header_params["header_test_int"] <- `header_test_int` @@ -1284,6 +1332,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling PetApi$update_pet, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling PetApi$update_pet, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -1407,8 +1461,26 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$update_pet_with_form, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$update_pet_with_form, `pet_id` is not nullable")) + } + if (!missing(`name`) && is.null(`name`)) { + rlang::abort(message = "Invalid value for `name` when calling PetApi$update_pet_with_form, `name` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `name` when calling PetApi$update_pet_with_form, `name` is not nullable")) + } + if (!missing(`status`) && is.null(`status`)) { + rlang::abort(message = "Invalid value for `status` when calling PetApi$update_pet_with_form, `status` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `status` when calling PetApi$update_pet_with_form, `status` is not nullable")) + } form_params["name"] <- `name` form_params["status"] <- `status` @@ -1518,8 +1590,26 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$upload_file, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$upload_file, `pet_id` is not nullable")) + } + if (!missing(`additional_metadata`) && is.null(`additional_metadata`)) { + rlang::abort(message = "Invalid value for `additional_metadata` when calling PetApi$upload_file, `additional_metadata` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `additional_metadata` when calling PetApi$upload_file, `additional_metadata` is not nullable")) + } + if (!missing(`file`) && is.null(`file`)) { + rlang::abort(message = "Invalid value for `file` when calling PetApi$upload_file, `file` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `file` when calling PetApi$upload_file, `file` is not nullable")) + } form_params["additionalMetadata"] <- `additional_metadata` file_params[["file"]] <- curl::form_file(`file`) diff --git a/samples/client/petstore/R-httr2-wrapper/R/store_api.R b/samples/client/petstore/R-httr2-wrapper/R/store_api.R index bbf86c4f21c0..1ea684f97270 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/store_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/store_api.R @@ -205,6 +205,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } + if (!missing(`order_id`) && is.null(`order_id`)) { + rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$delete_order, `order_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order_id` when calling StoreApi$delete_order, `order_id` is not nullable")) + } local_var_url_path <- "/store/order/{orderId}" if (!missing(`order_id`)) { @@ -414,13 +420,19 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (`order_id` > 5) { + if (!missing(`order_id`) && is.null(`order_id`)) { + rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, `order_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, `order_id` is not nullable")) + } + if (!is.null(`order_id`) && `order_id` > 5) { rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, must be smaller than or equal to 5.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, must be smaller than or equal to 5.")) } - if (`order_id` < 1) { + if (!is.null(`order_id`) && `order_id` < 1) { rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, must be bigger than or equal to 1.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, @@ -542,6 +554,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } + if (!missing(`order`) && is.null(`order`)) { + rlang::abort(message = "Invalid value for `order` when calling StoreApi$place_order, `order` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order` when calling StoreApi$place_order, `order` is not nullable")) + } if (!is.null(`order`)) { local_var_body <- `order`$toJSONString() diff --git a/samples/client/petstore/R-httr2-wrapper/R/user_api.R b/samples/client/petstore/R-httr2-wrapper/R/user_api.R index a99c036736f8..5b56f8ae3677 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user_api.R @@ -314,6 +314,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$create_user, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$create_user, `user` is not nullable")) + } if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() @@ -421,6 +427,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$create_users_with_array_input, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$create_users_with_array_input, `user` is not nullable")) + } if (!is.null(`user`)) { body.items <- paste(unlist(lapply(`user`, function(param) { @@ -531,6 +543,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$create_users_with_list_input, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$create_users_with_list_input, `user` is not nullable")) + } if (!is.null(`user`)) { body.items <- paste(unlist(lapply(`user`, function(param) { @@ -641,6 +659,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$delete_user, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$delete_user, `username` is not nullable")) + } local_var_url_path <- "/user/{username}" if (!missing(`username`)) { @@ -748,6 +772,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$get_user_by_name, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$get_user_by_name, `username` is not nullable")) + } local_var_url_path <- "/user/{username}" if (!missing(`username`)) { @@ -873,13 +903,25 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } - if (!str_detect(`username`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$login_user, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$login_user, `username` is not nullable")) + } + if (!is.null(`username`) && !stringr::str_detect(`username`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { rlang::abort(message = "Invalid value for `username` when calling UserApi$login_user, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Invalid value for `username` when calling UserApi$login_user, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$.")) } + if (!missing(`password`) && is.null(`password`)) { + rlang::abort(message = "Invalid value for `password` when calling UserApi$login_user, `password` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `password` when calling UserApi$login_user, `password` is not nullable")) + } query_params[["username"]] <- `username` @@ -1094,7 +1136,19 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$update_user, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$update_user, `username` is not nullable")) + } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$update_user, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$update_user, `user` is not nullable")) + } if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() diff --git a/samples/client/petstore/R-httr2/R/fake_api.R b/samples/client/petstore/R-httr2/R/fake_api.R index 2038aabaf7ee..664ffceb021e 100644 --- a/samples/client/petstore/R-httr2/R/fake_api.R +++ b/samples/client/petstore/R-httr2/R/fake_api.R @@ -221,6 +221,12 @@ FakeApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling FakeApi$add_pet_optional, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling FakeApi$add_pet_optional, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -345,7 +351,19 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `dummy`.")) } + if (!missing(`dummy`) && is.null(`dummy`)) { + rlang::abort(message = "Invalid value for `dummy` when calling FakeApi$fake_data_file, `dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `dummy` when calling FakeApi$fake_data_file, `dummy` is not nullable")) + } + if (!missing(`var_data_file`) && is.null(`var_data_file`)) { + rlang::abort(message = "Invalid value for `var_data_file` when calling FakeApi$fake_data_file, `var_data_file` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `var_data_file` when calling FakeApi$fake_data_file, `var_data_file` is not nullable")) + } header_params["dummy"] <- `dummy` @@ -460,6 +478,12 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `path_array_parameter`.")) } + if (!missing(`path_array_parameter`) && is.null(`path_array_parameter`)) { + rlang::abort(message = "Invalid value for `path_array_parameter` when calling FakeApi$fake_path_array, `path_array_parameter` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `path_array_parameter` when calling FakeApi$fake_path_array, `path_array_parameter` is not nullable")) + } local_var_url_path <- "/fake/path_array/{path_array}/testing" if (!missing(`path_array_parameter`)) { @@ -561,7 +585,13 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (!str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { + if (!missing(`reg_exp_test`) && is.null(`reg_exp_test`)) { + rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, `reg_exp_test` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, `reg_exp_test` is not nullable")) + } + if (!is.null(`reg_exp_test`) && !stringr::str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, must conform to the pattern ^[A-Za-z0-9_]{1,15}$.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, @@ -675,10 +705,22 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } + if (!missing(`set_dummy`) && is.null(`set_dummy`)) { + rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query, `set_dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query, `set_dummy` is not nullable")) + } + if (!missing(`array_dummy`) && is.null(`array_dummy`)) { + rlang::abort(message = "Invalid value for `array_dummy` when calling FakeApi$fake_set_query, `array_dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `array_dummy` when calling FakeApi$fake_set_query, `array_dummy` is not nullable")) + } # check if items are unique - if (!identical(`set_dummy`, unique(`set_dummy`))) { + if (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) { rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query. Items must be unique.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, diff --git a/samples/client/petstore/R-httr2/R/pet_api.R b/samples/client/petstore/R-httr2/R/pet_api.R index 12e65404d914..b60f15378597 100644 --- a/samples/client/petstore/R-httr2/R/pet_api.R +++ b/samples/client/petstore/R-httr2/R/pet_api.R @@ -431,6 +431,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling PetApi$add_pet, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling PetApi$add_pet, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -553,7 +559,19 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$delete_pet, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$delete_pet, `pet_id` is not nullable")) + } + if (!missing(`api_key`) && is.null(`api_key`)) { + rlang::abort(message = "Invalid value for `api_key` when calling PetApi$delete_pet, `api_key` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `api_key` when calling PetApi$delete_pet, `api_key` is not nullable")) + } header_params["api_key"] <- `api_key` @@ -662,6 +680,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `status`.")) } + if (!missing(`status`) && is.null(`status`)) { + rlang::abort(message = "Invalid value for `status` when calling PetApi$find_pets_by_status, `status` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `status` when calling PetApi$find_pets_by_status, `status` is not nullable")) + } # explore for (query_item in `status`) { @@ -789,6 +813,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `tags`.")) } + if (!missing(`tags`) && is.null(`tags`)) { + rlang::abort(message = "Invalid value for `tags` when calling PetApi$find_pets_by_tags, `tags` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `tags` when calling PetApi$find_pets_by_tags, `tags` is not nullable")) + } # no explore query_params[["tags"]] <- I(paste(lapply(`tags`, URLencode, reserved = TRUE), collapse = ",")) @@ -904,6 +934,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id, `pet_id` is not nullable")) + } local_var_url_path <- "/pet/{petId}" if (!missing(`pet_id`)) { @@ -1030,6 +1066,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id_streaming, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$get_pet_by_id_streaming, `pet_id` is not nullable")) + } local_var_url_path <- "/pet/{petId}?streaming" if (!missing(`pet_id`)) { @@ -1161,6 +1203,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `header_test_int`.")) } + if (!missing(`header_test_int`) && is.null(`header_test_int`)) { + rlang::abort(message = "Invalid value for `header_test_int` when calling PetApi$test_header, `header_test_int` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `header_test_int` when calling PetApi$test_header, `header_test_int` is not nullable")) + } header_params["header_test_int"] <- `header_test_int` @@ -1284,6 +1332,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling PetApi$update_pet, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling PetApi$update_pet, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -1407,8 +1461,26 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$update_pet_with_form, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$update_pet_with_form, `pet_id` is not nullable")) + } + if (!missing(`name`) && is.null(`name`)) { + rlang::abort(message = "Invalid value for `name` when calling PetApi$update_pet_with_form, `name` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `name` when calling PetApi$update_pet_with_form, `name` is not nullable")) + } + if (!missing(`status`) && is.null(`status`)) { + rlang::abort(message = "Invalid value for `status` when calling PetApi$update_pet_with_form, `status` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `status` when calling PetApi$update_pet_with_form, `status` is not nullable")) + } form_params["name"] <- `name` form_params["status"] <- `status` @@ -1518,8 +1590,26 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$upload_file, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$upload_file, `pet_id` is not nullable")) + } + if (!missing(`additional_metadata`) && is.null(`additional_metadata`)) { + rlang::abort(message = "Invalid value for `additional_metadata` when calling PetApi$upload_file, `additional_metadata` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `additional_metadata` when calling PetApi$upload_file, `additional_metadata` is not nullable")) + } + if (!missing(`file`) && is.null(`file`)) { + rlang::abort(message = "Invalid value for `file` when calling PetApi$upload_file, `file` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `file` when calling PetApi$upload_file, `file` is not nullable")) + } form_params["additionalMetadata"] <- `additional_metadata` file_params[["file"]] <- curl::form_file(`file`) diff --git a/samples/client/petstore/R-httr2/R/store_api.R b/samples/client/petstore/R-httr2/R/store_api.R index fc4ff66dcab1..ec454c8d78cc 100644 --- a/samples/client/petstore/R-httr2/R/store_api.R +++ b/samples/client/petstore/R-httr2/R/store_api.R @@ -205,6 +205,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } + if (!missing(`order_id`) && is.null(`order_id`)) { + rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$delete_order, `order_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order_id` when calling StoreApi$delete_order, `order_id` is not nullable")) + } local_var_url_path <- "/store/order/{orderId}" if (!missing(`order_id`)) { @@ -414,13 +420,19 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (`order_id` > 5) { + if (!missing(`order_id`) && is.null(`order_id`)) { + rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, `order_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, `order_id` is not nullable")) + } + if (!is.null(`order_id`) && `order_id` > 5) { rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, must be smaller than or equal to 5.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, must be smaller than or equal to 5.")) } - if (`order_id` < 1) { + if (!is.null(`order_id`) && `order_id` < 1) { rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$get_order_by_id, must be bigger than or equal to 1.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, @@ -542,6 +554,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } + if (!missing(`order`) && is.null(`order`)) { + rlang::abort(message = "Invalid value for `order` when calling StoreApi$place_order, `order` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order` when calling StoreApi$place_order, `order` is not nullable")) + } if (!is.null(`order`)) { local_var_body <- `order`$toJSONString() diff --git a/samples/client/petstore/R-httr2/R/user_api.R b/samples/client/petstore/R-httr2/R/user_api.R index a1496d504727..242077c4b1e3 100644 --- a/samples/client/petstore/R-httr2/R/user_api.R +++ b/samples/client/petstore/R-httr2/R/user_api.R @@ -314,6 +314,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$create_user, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$create_user, `user` is not nullable")) + } if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() @@ -421,6 +427,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$create_users_with_array_input, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$create_users_with_array_input, `user` is not nullable")) + } if (!is.null(`user`)) { body.items <- paste(unlist(lapply(`user`, function(param) { @@ -531,6 +543,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$create_users_with_list_input, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$create_users_with_list_input, `user` is not nullable")) + } if (!is.null(`user`)) { body.items <- paste(unlist(lapply(`user`, function(param) { @@ -641,6 +659,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$delete_user, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$delete_user, `username` is not nullable")) + } local_var_url_path <- "/user/{username}" if (!missing(`username`)) { @@ -748,6 +772,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$get_user_by_name, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$get_user_by_name, `username` is not nullable")) + } local_var_url_path <- "/user/{username}" if (!missing(`username`)) { @@ -873,13 +903,25 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } - if (!str_detect(`username`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$login_user, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$login_user, `username` is not nullable")) + } + if (!is.null(`username`) && !stringr::str_detect(`username`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { rlang::abort(message = "Invalid value for `username` when calling UserApi$login_user, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Invalid value for `username` when calling UserApi$login_user, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$.")) } + if (!missing(`password`) && is.null(`password`)) { + rlang::abort(message = "Invalid value for `password` when calling UserApi$login_user, `password` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `password` when calling UserApi$login_user, `password` is not nullable")) + } query_params[["username"]] <- `username` @@ -1094,7 +1136,19 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$update_user, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$update_user, `username` is not nullable")) + } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$update_user, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$update_user, `user` is not nullable")) + } if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() diff --git a/samples/client/petstore/R/R/fake_api.R b/samples/client/petstore/R/R/fake_api.R index 452eab587ded..c113579eb032 100644 --- a/samples/client/petstore/R/R/fake_api.R +++ b/samples/client/petstore/R/R/fake_api.R @@ -221,6 +221,12 @@ FakeApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling FakeApi$AddPetOptional, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling FakeApi$AddPetOptional, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -345,7 +351,19 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `dummy`.")) } + if (!missing(`dummy`) && is.null(`dummy`)) { + rlang::abort(message = "Invalid value for `dummy` when calling FakeApi$FakeDataFile, `dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `dummy` when calling FakeApi$FakeDataFile, `dummy` is not nullable")) + } + if (!missing(`var_data_file`) && is.null(`var_data_file`)) { + rlang::abort(message = "Invalid value for `var_data_file` when calling FakeApi$FakeDataFile, `var_data_file` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `var_data_file` when calling FakeApi$FakeDataFile, `var_data_file` is not nullable")) + } header_params["dummy"] <- `dummy` @@ -460,6 +478,12 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `path_array`.")) } + if (!missing(`path_array`) && is.null(`path_array`)) { + rlang::abort(message = "Invalid value for `path_array` when calling FakeApi$FakePathArray, `path_array` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `path_array` when calling FakeApi$FakePathArray, `path_array` is not nullable")) + } local_var_url_path <- "/fake/path_array/{path_array}/testing" if (!missing(`path_array`)) { @@ -561,7 +585,13 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (!str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { + if (!missing(`reg_exp_test`) && is.null(`reg_exp_test`)) { + rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$FakeRegularExpression, `reg_exp_test` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `reg_exp_test` when calling FakeApi$FakeRegularExpression, `reg_exp_test` is not nullable")) + } + if (!is.null(`reg_exp_test`) && !stringr::str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$FakeRegularExpression, must conform to the pattern ^[A-Za-z0-9_]{1,15}$.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, @@ -675,10 +705,22 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } + if (!missing(`set_dummy`) && is.null(`set_dummy`)) { + rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$FakeSetQuery, `set_dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `set_dummy` when calling FakeApi$FakeSetQuery, `set_dummy` is not nullable")) + } + if (!missing(`array_dummy`) && is.null(`array_dummy`)) { + rlang::abort(message = "Invalid value for `array_dummy` when calling FakeApi$FakeSetQuery, `array_dummy` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `array_dummy` when calling FakeApi$FakeSetQuery, `array_dummy` is not nullable")) + } # check if items are unique - if (!identical(`set_dummy`, unique(`set_dummy`))) { + if (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) { rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$FakeSetQuery. Items must be unique.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index 6c74624fad21..40cfdabc2271 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -431,6 +431,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling PetApi$AddPet, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling PetApi$AddPet, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -553,7 +559,19 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$DeletePet, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$DeletePet, `pet_id` is not nullable")) + } + if (!missing(`api_key`) && is.null(`api_key`)) { + rlang::abort(message = "Invalid value for `api_key` when calling PetApi$DeletePet, `api_key` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `api_key` when calling PetApi$DeletePet, `api_key` is not nullable")) + } header_params["api_key"] <- `api_key` @@ -662,6 +680,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `status`.")) } + if (!missing(`status`) && is.null(`status`)) { + rlang::abort(message = "Invalid value for `status` when calling PetApi$FindPetsByStatus, `status` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `status` when calling PetApi$FindPetsByStatus, `status` is not nullable")) + } # explore for (query_item in `status`) { @@ -789,6 +813,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `tags`.")) } + if (!missing(`tags`) && is.null(`tags`)) { + rlang::abort(message = "Invalid value for `tags` when calling PetApi$FindPetsByTags, `tags` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `tags` when calling PetApi$FindPetsByTags, `tags` is not nullable")) + } # no explore query_params[["tags"]] <- I(paste(lapply(`tags`, URLencode, reserved = TRUE), collapse = ",")) @@ -904,6 +934,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$GetPetById, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$GetPetById, `pet_id` is not nullable")) + } local_var_url_path <- "/pet/{petId}" if (!missing(`pet_id`)) { @@ -1030,6 +1066,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$GetPetByIdStreaming, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$GetPetByIdStreaming, `pet_id` is not nullable")) + } local_var_url_path <- "/pet/{petId}?streaming" if (!missing(`pet_id`)) { @@ -1161,6 +1203,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `header_test_int`.")) } + if (!missing(`header_test_int`) && is.null(`header_test_int`)) { + rlang::abort(message = "Invalid value for `header_test_int` when calling PetApi$TestHeader, `header_test_int` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `header_test_int` when calling PetApi$TestHeader, `header_test_int` is not nullable")) + } header_params["header_test_int"] <- `header_test_int` @@ -1284,6 +1332,12 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } + if (!missing(`pet`) && is.null(`pet`)) { + rlang::abort(message = "Invalid value for `pet` when calling PetApi$UpdatePet, `pet` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet` when calling PetApi$UpdatePet, `pet` is not nullable")) + } if (!is.null(`pet`)) { local_var_body <- `pet`$toJSONString() @@ -1407,8 +1461,26 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$UpdatePetWithForm, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$UpdatePetWithForm, `pet_id` is not nullable")) + } + if (!missing(`name`) && is.null(`name`)) { + rlang::abort(message = "Invalid value for `name` when calling PetApi$UpdatePetWithForm, `name` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `name` when calling PetApi$UpdatePetWithForm, `name` is not nullable")) + } + if (!missing(`status`) && is.null(`status`)) { + rlang::abort(message = "Invalid value for `status` when calling PetApi$UpdatePetWithForm, `status` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `status` when calling PetApi$UpdatePetWithForm, `status` is not nullable")) + } form_params["name"] <- `name` form_params["status"] <- `status` @@ -1518,8 +1590,26 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } + if (!missing(`pet_id`) && is.null(`pet_id`)) { + rlang::abort(message = "Invalid value for `pet_id` when calling PetApi$UploadFile, `pet_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `pet_id` when calling PetApi$UploadFile, `pet_id` is not nullable")) + } + if (!missing(`additional_metadata`) && is.null(`additional_metadata`)) { + rlang::abort(message = "Invalid value for `additional_metadata` when calling PetApi$UploadFile, `additional_metadata` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `additional_metadata` when calling PetApi$UploadFile, `additional_metadata` is not nullable")) + } + if (!missing(`file`) && is.null(`file`)) { + rlang::abort(message = "Invalid value for `file` when calling PetApi$UploadFile, `file` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `file` when calling PetApi$UploadFile, `file` is not nullable")) + } form_params["additionalMetadata"] <- `additional_metadata` file_params["file"] <- httr::upload_file(`file`) diff --git a/samples/client/petstore/R/R/store_api.R b/samples/client/petstore/R/R/store_api.R index 81acb942675c..ebb1fde28a4f 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -205,6 +205,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } + if (!missing(`order_id`) && is.null(`order_id`)) { + rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$DeleteOrder, `order_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order_id` when calling StoreApi$DeleteOrder, `order_id` is not nullable")) + } local_var_url_path <- "/store/order/{orderId}" if (!missing(`order_id`)) { @@ -414,13 +420,19 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (`order_id` > 5) { + if (!missing(`order_id`) && is.null(`order_id`)) { + rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$GetOrderById, `order_id` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order_id` when calling StoreApi$GetOrderById, `order_id` is not nullable")) + } + if (!is.null(`order_id`) && `order_id` > 5) { rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$GetOrderById, must be smaller than or equal to 5.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Invalid value for `order_id` when calling StoreApi$GetOrderById, must be smaller than or equal to 5.")) } - if (`order_id` < 1) { + if (!is.null(`order_id`) && `order_id` < 1) { rlang::abort(message = "Invalid value for `order_id` when calling StoreApi$GetOrderById, must be bigger than or equal to 1.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, @@ -542,6 +554,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } + if (!missing(`order`) && is.null(`order`)) { + rlang::abort(message = "Invalid value for `order` when calling StoreApi$PlaceOrder, `order` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `order` when calling StoreApi$PlaceOrder, `order` is not nullable")) + } if (!is.null(`order`)) { local_var_body <- `order`$toJSONString() diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 39b793e40f75..ca366d7eb130 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -314,6 +314,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$CreateUser, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$CreateUser, `user` is not nullable")) + } if (!is.null(`user`)) { local_var_body <- `user`$toJSONString() @@ -421,6 +427,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$CreateUsersWithArrayInput, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$CreateUsersWithArrayInput, `user` is not nullable")) + } if (!is.null(`user`)) { body.items <- paste(unlist(lapply(`user`, function(param) { @@ -531,6 +543,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$CreateUsersWithListInput, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$CreateUsersWithListInput, `user` is not nullable")) + } if (!is.null(`user`)) { body.items <- paste(unlist(lapply(`user`, function(param) { @@ -641,6 +659,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$DeleteUser, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$DeleteUser, `username` is not nullable")) + } local_var_url_path <- "/user/{username}" if (!missing(`username`)) { @@ -748,6 +772,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$GetUserByName, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$GetUserByName, `username` is not nullable")) + } local_var_url_path <- "/user/{username}" if (!missing(`username`)) { @@ -873,13 +903,25 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } - if (!str_detect(`username`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$LoginUser, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$LoginUser, `username` is not nullable")) + } + if (!is.null(`username`) && !stringr::str_detect(`username`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) { rlang::abort(message = "Invalid value for `username` when calling UserApi$LoginUser, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Invalid value for `username` when calling UserApi$LoginUser, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$.")) } + if (!missing(`password`) && is.null(`password`)) { + rlang::abort(message = "Invalid value for `password` when calling UserApi$LoginUser, `password` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `password` when calling UserApi$LoginUser, `password` is not nullable")) + } query_params[["username"]] <- `username` @@ -1094,7 +1136,19 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } + if (!missing(`username`) && is.null(`username`)) { + rlang::abort(message = "Invalid value for `username` when calling UserApi$UpdateUser, `username` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `username` when calling UserApi$UpdateUser, `username` is not nullable")) + } + if (!missing(`user`) && is.null(`user`)) { + rlang::abort(message = "Invalid value for `user` when calling UserApi$UpdateUser, `user` is not nullable", + .subclass = "ApiException", + ApiException = ApiException$new(status = 0, + reason = "Invalid value for `user` when calling UserApi$UpdateUser, `user` is not nullable")) + } if (!is.null(`user`)) { local_var_body <- `user`$toJSONString()