From a4aac2a05549c563d2e791013ebe3f8c4471f9cd Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Thu, 24 Jul 2025 14:07:20 -0400 Subject: [PATCH 1/7] [R] check optional parametrs for null before evaluating param conditions --- .../src/main/resources/r/api.mustache | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 4f18c214f11a..a19e482b908d 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -207,7 +207,7 @@ {{/requiredParams}} {{#allParams}} {{#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 +220,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 +233,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 +246,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 +259,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 +272,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 +285,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 +307,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}} From 1d7111f650726b05108e7b2983d69eb1abcf6929 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Thu, 24 Jul 2025 14:40:55 -0400 Subject: [PATCH 2/7] update petstore --- samples/client/petstore/R-httr2-wrapper/R/fake_api.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/store_api.R | 4 ++-- samples/client/petstore/R-httr2-wrapper/R/user_api.R | 2 +- samples/client/petstore/R-httr2/R/fake_api.R | 4 ++-- samples/client/petstore/R-httr2/R/store_api.R | 4 ++-- samples/client/petstore/R-httr2/R/user_api.R | 2 +- samples/client/petstore/R/R/fake_api.R | 4 ++-- samples/client/petstore/R/R/store_api.R | 4 ++-- samples/client/petstore/R/R/user_api.R | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) 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..89f3ea553c4a 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R @@ -561,7 +561,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (!str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { + 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, @@ -678,7 +678,7 @@ FakeApi <- R6::R6Class( # 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/store_api.R b/samples/client/petstore/R-httr2-wrapper/R/store_api.R index bbf86c4f21c0..395a5903f64d 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/store_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/store_api.R @@ -414,13 +414,13 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (`order_id` > 5) { + 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, 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..b5c4e3b4173b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user_api.R @@ -873,7 +873,7 @@ 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 (!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, diff --git a/samples/client/petstore/R-httr2/R/fake_api.R b/samples/client/petstore/R-httr2/R/fake_api.R index 2038aabaf7ee..63efaccd4c0d 100644 --- a/samples/client/petstore/R-httr2/R/fake_api.R +++ b/samples/client/petstore/R-httr2/R/fake_api.R @@ -561,7 +561,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (!str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { + 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, @@ -678,7 +678,7 @@ FakeApi <- R6::R6Class( # 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/store_api.R b/samples/client/petstore/R-httr2/R/store_api.R index fc4ff66dcab1..a4f4251ee44e 100644 --- a/samples/client/petstore/R-httr2/R/store_api.R +++ b/samples/client/petstore/R-httr2/R/store_api.R @@ -414,13 +414,13 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (`order_id` > 5) { + 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, diff --git a/samples/client/petstore/R-httr2/R/user_api.R b/samples/client/petstore/R-httr2/R/user_api.R index a1496d504727..3feeded99627 100644 --- a/samples/client/petstore/R-httr2/R/user_api.R +++ b/samples/client/petstore/R-httr2/R/user_api.R @@ -873,7 +873,7 @@ 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 (!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, diff --git a/samples/client/petstore/R/R/fake_api.R b/samples/client/petstore/R/R/fake_api.R index 452eab587ded..1477052f611c 100644 --- a/samples/client/petstore/R/R/fake_api.R +++ b/samples/client/petstore/R/R/fake_api.R @@ -561,7 +561,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (!str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) { + 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, @@ -678,7 +678,7 @@ FakeApi <- R6::R6Class( # 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/store_api.R b/samples/client/petstore/R/R/store_api.R index 81acb942675c..d1c35697662a 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -414,13 +414,13 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (`order_id` > 5) { + 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, diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 39b793e40f75..0463ac0fdf3b 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -873,7 +873,7 @@ 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 (!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, From 4c7a4549f553b57fda15d7d45918523d78bd3352 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Fri, 25 Jul 2025 05:38:32 -0400 Subject: [PATCH 3/7] handle isNullable when checking api parameters --- .../src/main/resources/r/api.mustache | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index a19e482b908d..cf6c6a946425 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -206,6 +206,19 @@ {{/requiredParams}} {{#allParams}} + {{^isNullable}} + if (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 (!is.null(`{{paramName}}`) && nchar(`{{paramName}}`) > {{maxLength}}) { {{#useDefaultExceptionHandling}} From 3cec95d191b09b067863a3a6282506473bf5faef Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Fri, 25 Jul 2025 05:48:18 -0400 Subject: [PATCH 4/7] update samples --- samples/client/echo_api/r/R/body_api.R | 27 ++++++ samples/client/echo_api/r/R/form_api.R | 30 +++++++ samples/client/echo_api/r/R/header_api.R | 15 ++++ samples/client/echo_api/r/R/path_api.R | 12 +++ samples/client/echo_api/r/R/query_api.R | 45 ++++++++++ .../petstore/R-httr2-wrapper/R/fake_api.R | 42 +++++++++ .../petstore/R-httr2-wrapper/R/pet_api.R | 90 +++++++++++++++++++ .../petstore/R-httr2-wrapper/R/store_api.R | 18 ++++ .../petstore/R-httr2-wrapper/R/user_api.R | 54 +++++++++++ samples/client/petstore/R-httr2/R/fake_api.R | 42 +++++++++ samples/client/petstore/R-httr2/R/pet_api.R | 90 +++++++++++++++++++ samples/client/petstore/R-httr2/R/store_api.R | 18 ++++ samples/client/petstore/R-httr2/R/user_api.R | 54 +++++++++++ samples/client/petstore/R/R/fake_api.R | 42 +++++++++ samples/client/petstore/R/R/pet_api.R | 90 +++++++++++++++++++ samples/client/petstore/R/R/store_api.R | 18 ++++ samples/client/petstore/R/R/user_api.R | 54 +++++++++++ 17 files changed, 741 insertions(+) diff --git a/samples/client/echo_api/r/R/body_api.R b/samples/client/echo_api/r/R/body_api.R index 9f16d197edc0..a0554820ddd1 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 (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 (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 (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 (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 (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 (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 (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 (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 (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..97977d931d7f 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 (is.null(`integer_form`)) { + stop("Invalid value for `integer_form` when calling FormApi$TestFormIntegerBooleanString, `integer_form` is not nullable") + } + if (is.null(`boolean_form`)) { + stop("Invalid value for `boolean_form` when calling FormApi$TestFormIntegerBooleanString, `boolean_form` is not nullable") + } + if (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 (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 (is.null(`form1`)) { + stop("Invalid value for `form1` when calling FormApi$TestFormOneof, `form1` is not nullable") + } + if (is.null(`form2`)) { + stop("Invalid value for `form2` when calling FormApi$TestFormOneof, `form2` is not nullable") + } + if (is.null(`form3`)) { + stop("Invalid value for `form3` when calling FormApi$TestFormOneof, `form3` is not nullable") + } + if (is.null(`form4`)) { + stop("Invalid value for `form4` when calling FormApi$TestFormOneof, `form4` is not nullable") + } + if (is.null(`id`)) { + stop("Invalid value for `id` when calling FormApi$TestFormOneof, `id` is not nullable") + } + if (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..f58f35dcd428 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 (is.null(`integer_header`)) { + stop("Invalid value for `integer_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `integer_header` is not nullable") + } + if (is.null(`boolean_header`)) { + stop("Invalid value for `boolean_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `boolean_header` is not nullable") + } + if (is.null(`string_header`)) { + stop("Invalid value for `string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `string_header` is not nullable") + } + if (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 (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..d4095b94bc77 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 (is.null(`path_string`)) { + stop("Invalid value for `path_string` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_string` is not nullable") + } + if (is.null(`path_integer`)) { + stop("Invalid value for `path_integer` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_integer` is not nullable") + } + if (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 (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..d8e0799dc9a8 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 (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 (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 (is.null(`datetime_query`)) { + stop("Invalid value for `datetime_query` when calling QueryApi$TestQueryDatetimeDateString, `datetime_query` is not nullable") + } + if (is.null(`date_query`)) { + stop("Invalid value for `date_query` when calling QueryApi$TestQueryDatetimeDateString, `date_query` is not nullable") + } + if (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 (is.null(`integer_query`)) { + stop("Invalid value for `integer_query` when calling QueryApi$TestQueryIntegerBooleanString, `integer_query` is not nullable") + } + if (is.null(`boolean_query`)) { + stop("Invalid value for `boolean_query` when calling QueryApi$TestQueryIntegerBooleanString, `boolean_query` is not nullable") + } + if (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 (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 (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 (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 (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 (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 (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 (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 89f3ea553c4a..0476f6fe1e97 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 (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 (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 (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 (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,6 +585,12 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } + if (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", @@ -675,7 +705,19 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } + if (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 (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 (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) { 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..26b3a5c526d9 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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 395a5903f64d..2d637c130ca2 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 (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,6 +420,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } + if (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", @@ -542,6 +554,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } + if (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 b5c4e3b4173b..e5f645942a49 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 (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 (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 (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 (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 (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,6 +903,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } + if (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", @@ -880,6 +916,12 @@ UserApi <- R6::R6Class( 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 (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 (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 (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 63efaccd4c0d..6b55a95628b7 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 (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 (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 (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 (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,6 +585,12 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } + if (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", @@ -675,7 +705,19 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } + if (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 (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 (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) { diff --git a/samples/client/petstore/R-httr2/R/pet_api.R b/samples/client/petstore/R-httr2/R/pet_api.R index 12e65404d914..bf219b0a28e9 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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 a4f4251ee44e..271807e37f60 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 (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,6 +420,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } + if (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", @@ -542,6 +554,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } + if (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 3feeded99627..158317a1c8a4 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 (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 (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 (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 (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 (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,6 +903,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } + if (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", @@ -880,6 +916,12 @@ UserApi <- R6::R6Class( 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 (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 (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 (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 1477052f611c..2a21496f259d 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 (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 (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 (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 (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,6 +585,12 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } + if (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", @@ -675,7 +705,19 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } + if (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 (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 (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) { diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index 6c74624fad21..c11c72f93267 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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 d1c35697662a..1da19ef37394 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 (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,6 +420,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } + if (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", @@ -542,6 +554,12 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } + if (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 0463ac0fdf3b..88d8c972476a 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 (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 (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 (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 (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 (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,6 +903,12 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } + if (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", @@ -880,6 +916,12 @@ UserApi <- R6::R6Class( 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 (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 (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 (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() From d1cd5142f53ef933ca267db3407fd9bc81db3bf7 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Fri, 25 Jul 2025 06:01:08 -0400 Subject: [PATCH 5/7] allow not-nullable parameters to be missing --- modules/openapi-generator/src/main/resources/r/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index cf6c6a946425..1297561f3973 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -207,7 +207,7 @@ {{/requiredParams}} {{#allParams}} {{^isNullable}} - if (is.null(`{{paramName}}`)) { + if (!missing(`{{paramName}}`) && is.null(`{{paramName}}`)) { {{#useDefaultExceptionHandling}} stop("Invalid value for `{{paramName}}` when calling {{classname}}${{operationId}}, `{{paramName}}` is not nullable") {{/useDefaultExceptionHandling}} From 1392b09083a64a3dc34c3319480b470ae8c7f545 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Fri, 25 Jul 2025 06:06:33 -0400 Subject: [PATCH 6/7] update samples --- samples/client/echo_api/r/R/body_api.R | 18 +++++------ samples/client/echo_api/r/R/form_api.R | 20 ++++++------- samples/client/echo_api/r/R/header_api.R | 10 +++---- samples/client/echo_api/r/R/path_api.R | 8 ++--- samples/client/echo_api/r/R/query_api.R | 30 +++++++++---------- .../.openapi-generator/FILES | 4 +-- .../models/ObjectSerializer.ts | 14 +++++---- .../builds/null-types-simple/models/all.ts | 4 +-- .../null-types-simple/types/ObjectParamAPI.ts | 4 +-- .../null-types-simple/types/ObservableAPI.ts | 4 +-- .../null-types-simple/types/PromiseAPI.ts | 4 +-- .../petstore/R-httr2-wrapper/R/fake_api.R | 14 ++++----- .../petstore/R-httr2-wrapper/R/pet_api.R | 30 +++++++++---------- .../petstore/R-httr2-wrapper/R/store_api.R | 6 ++-- .../petstore/R-httr2-wrapper/R/user_api.R | 18 +++++------ samples/client/petstore/R-httr2/R/fake_api.R | 14 ++++----- samples/client/petstore/R-httr2/R/pet_api.R | 30 +++++++++---------- samples/client/petstore/R-httr2/R/store_api.R | 6 ++-- samples/client/petstore/R-httr2/R/user_api.R | 18 +++++------ samples/client/petstore/R/R/fake_api.R | 14 ++++----- samples/client/petstore/R/R/pet_api.R | 30 +++++++++---------- samples/client/petstore/R/R/store_api.R | 6 ++-- samples/client/petstore/R/R/user_api.R | 18 +++++------ 23 files changed, 163 insertions(+), 161 deletions(-) diff --git a/samples/client/echo_api/r/R/body_api.R b/samples/client/echo_api/r/R/body_api.R index a0554820ddd1..e9213e0dc94f 100644 --- a/samples/client/echo_api/r/R/body_api.R +++ b/samples/client/echo_api/r/R/body_api.R @@ -300,7 +300,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`body`)) { + if (!missing(`body`) && is.null(`body`)) { stop("Invalid value for `body` when calling BodyApi$TestBodyApplicationOctetstreamBinary, `body` is not nullable") } @@ -403,7 +403,7 @@ BodyApi <- R6::R6Class( stop("Missing required parameter `files`.") } - if (is.null(`files`)) { + if (!missing(`files`) && is.null(`files`)) { stop("Invalid value for `files` when calling BodyApi$TestBodyMultipartFormdataArrayOfBinary, `files` is not nullable") } @@ -497,7 +497,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`my_file`)) { + if (!missing(`my_file`) && is.null(`my_file`)) { stop("Invalid value for `my_file` when calling BodyApi$TestBodyMultipartFormdataSingleBinary, `my_file` is not nullable") } @@ -591,7 +591,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`pet`)) { + if (!missing(`pet`) && is.null(`pet`)) { stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyAllOfPet, `pet` is not nullable") } @@ -690,7 +690,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`body`)) { + if (!missing(`body`) && is.null(`body`)) { stop("Invalid value for `body` when calling BodyApi$TestEchoBodyFreeFormObjectResponseString, `body` is not nullable") } @@ -789,7 +789,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`pet`)) { + if (!missing(`pet`) && is.null(`pet`)) { stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyPet, `pet` is not nullable") } @@ -888,7 +888,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`pet`)) { + if (!missing(`pet`) && is.null(`pet`)) { stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyPetResponseString, `pet` is not nullable") } @@ -987,7 +987,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`body`)) { + if (!missing(`body`) && is.null(`body`)) { stop("Invalid value for `body` when calling BodyApi$TestEchoBodyStringEnum, `body` is not nullable") } @@ -1086,7 +1086,7 @@ BodyApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`tag`)) { + if (!missing(`tag`) && is.null(`tag`)) { stop("Invalid value for `tag` when calling BodyApi$TestEchoBodyTagResponseString, `tag` is not nullable") } diff --git a/samples/client/echo_api/r/R/form_api.R b/samples/client/echo_api/r/R/form_api.R index 97977d931d7f..1278ba0b2ade 100644 --- a/samples/client/echo_api/r/R/form_api.R +++ b/samples/client/echo_api/r/R/form_api.R @@ -127,15 +127,15 @@ FormApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`integer_form`)) { + if (!missing(`integer_form`) && is.null(`integer_form`)) { stop("Invalid value for `integer_form` when calling FormApi$TestFormIntegerBooleanString, `integer_form` is not nullable") } - if (is.null(`boolean_form`)) { + if (!missing(`boolean_form`) && is.null(`boolean_form`)) { stop("Invalid value for `boolean_form` when calling FormApi$TestFormIntegerBooleanString, `boolean_form` is not nullable") } - if (is.null(`string_form`)) { + if (!missing(`string_form`) && is.null(`string_form`)) { stop("Invalid value for `string_form` when calling FormApi$TestFormIntegerBooleanString, `string_form` is not nullable") } @@ -235,7 +235,7 @@ FormApi <- R6::R6Class( stop("Missing required parameter `marker`.") } - if (is.null(`marker`)) { + if (!missing(`marker`) && is.null(`marker`)) { stop("Invalid value for `marker` when calling FormApi$TestFormObjectMultipart, `marker` is not nullable") } @@ -339,27 +339,27 @@ FormApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`form1`)) { + if (!missing(`form1`) && is.null(`form1`)) { stop("Invalid value for `form1` when calling FormApi$TestFormOneof, `form1` is not nullable") } - if (is.null(`form2`)) { + if (!missing(`form2`) && is.null(`form2`)) { stop("Invalid value for `form2` when calling FormApi$TestFormOneof, `form2` is not nullable") } - if (is.null(`form3`)) { + if (!missing(`form3`) && is.null(`form3`)) { stop("Invalid value for `form3` when calling FormApi$TestFormOneof, `form3` is not nullable") } - if (is.null(`form4`)) { + if (!missing(`form4`) && is.null(`form4`)) { stop("Invalid value for `form4` when calling FormApi$TestFormOneof, `form4` is not nullable") } - if (is.null(`id`)) { + if (!missing(`id`) && is.null(`id`)) { stop("Invalid value for `id` when calling FormApi$TestFormOneof, `id` is not nullable") } - if (is.null(`name`)) { + if (!missing(`name`) && is.null(`name`)) { stop("Invalid value for `name` when calling FormApi$TestFormOneof, `name` is not nullable") } diff --git a/samples/client/echo_api/r/R/header_api.R b/samples/client/echo_api/r/R/header_api.R index f58f35dcd428..21280ce6b645 100644 --- a/samples/client/echo_api/r/R/header_api.R +++ b/samples/client/echo_api/r/R/header_api.R @@ -100,23 +100,23 @@ HeaderApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`integer_header`)) { + if (!missing(`integer_header`) && is.null(`integer_header`)) { stop("Invalid value for `integer_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `integer_header` is not nullable") } - if (is.null(`boolean_header`)) { + if (!missing(`boolean_header`) && is.null(`boolean_header`)) { stop("Invalid value for `boolean_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `boolean_header` is not nullable") } - if (is.null(`string_header`)) { + if (!missing(`string_header`) && is.null(`string_header`)) { stop("Invalid value for `string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `string_header` is not nullable") } - if (is.null(`enum_nonref_string_header`)) { + 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 (is.null(`enum_ref_string_header`)) { + 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") } diff --git a/samples/client/echo_api/r/R/path_api.R b/samples/client/echo_api/r/R/path_api.R index d4095b94bc77..afe0a36107d0 100644 --- a/samples/client/echo_api/r/R/path_api.R +++ b/samples/client/echo_api/r/R/path_api.R @@ -113,19 +113,19 @@ PathApi <- R6::R6Class( stop("Missing required parameter `enum_ref_string_path`.") } - if (is.null(`path_string`)) { + if (!missing(`path_string`) && is.null(`path_string`)) { stop("Invalid value for `path_string` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_string` is not nullable") } - if (is.null(`path_integer`)) { + if (!missing(`path_integer`) && is.null(`path_integer`)) { stop("Invalid value for `path_integer` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_integer` is not nullable") } - if (is.null(`enum_nonref_string_path`)) { + 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 (is.null(`enum_ref_string_path`)) { + 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") } diff --git a/samples/client/echo_api/r/R/query_api.R b/samples/client/echo_api/r/R/query_api.R index d8e0799dc9a8..b237286bdfaa 100644 --- a/samples/client/echo_api/r/R/query_api.R +++ b/samples/client/echo_api/r/R/query_api.R @@ -221,11 +221,11 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`enum_nonref_string_query`)) { + 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 (is.null(`enum_ref_string_query`)) { + 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") } @@ -329,15 +329,15 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`datetime_query`)) { + if (!missing(`datetime_query`) && is.null(`datetime_query`)) { stop("Invalid value for `datetime_query` when calling QueryApi$TestQueryDatetimeDateString, `datetime_query` is not nullable") } - if (is.null(`date_query`)) { + if (!missing(`date_query`) && is.null(`date_query`)) { stop("Invalid value for `date_query` when calling QueryApi$TestQueryDatetimeDateString, `date_query` is not nullable") } - if (is.null(`string_query`)) { + if (!missing(`string_query`) && is.null(`string_query`)) { stop("Invalid value for `string_query` when calling QueryApi$TestQueryDatetimeDateString, `string_query` is not nullable") } @@ -440,15 +440,15 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`integer_query`)) { + if (!missing(`integer_query`) && is.null(`integer_query`)) { stop("Invalid value for `integer_query` when calling QueryApi$TestQueryIntegerBooleanString, `integer_query` is not nullable") } - if (is.null(`boolean_query`)) { + if (!missing(`boolean_query`) && is.null(`boolean_query`)) { stop("Invalid value for `boolean_query` when calling QueryApi$TestQueryIntegerBooleanString, `boolean_query` is not nullable") } - if (is.null(`string_query`)) { + if (!missing(`string_query`) && is.null(`string_query`)) { stop("Invalid value for `string_query` when calling QueryApi$TestQueryIntegerBooleanString, `string_query` is not nullable") } @@ -547,7 +547,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleDeepObjectExplodeTrueObject, `query_object` is not nullable") } @@ -642,7 +642,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleDeepObjectExplodeTrueObjectAllOf, `query_object` is not nullable") } @@ -737,7 +737,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeFalseArrayInteger, `query_object` is not nullable") } @@ -833,7 +833,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeFalseArrayString, `query_object` is not nullable") } @@ -929,7 +929,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueArrayString, `query_object` is not nullable") } @@ -1024,7 +1024,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueObject, `query_object` is not nullable") } @@ -1119,7 +1119,7 @@ QueryApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`query_object`)) { + if (!missing(`query_object`) && is.null(`query_object`)) { stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueObjectAllOf, `query_object` is not nullable") } diff --git a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES index f586694f5f67..832d1d1b6d4d 100644 --- a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES +++ b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES @@ -11,8 +11,8 @@ http/isomorphic-fetch.ts index.ts middleware.ts models/ObjectSerializer.ts -models/SomeObject.ts -models/WithNullableType.ts +models/SingleValueEnum30.ts +models/SingleValueEnum31.ts models/all.ts package.json rxjsStub.ts diff --git a/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts index d44f397943e3..15b6c13639d3 100644 --- a/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts @@ -1,8 +1,8 @@ -export * from '../models/SomeObject'; -export * from '../models/WithNullableType'; +export * from '../models/SingleValueEnum30'; +export * from '../models/SingleValueEnum31'; -import { SomeObject } from '../models/SomeObject'; -import { WithNullableType } from '../models/WithNullableType'; +import { SingleValueEnum30, SingleValueEnum30TypeEnum } from '../models/SingleValueEnum30'; +import { SingleValueEnum31, SingleValueEnum31TypeEnum } from '../models/SingleValueEnum31'; /* tslint:disable:no-unused-variable */ let primitives = [ @@ -17,11 +17,13 @@ let primitives = [ ]; let enumsMap: Set = new Set([ + "SingleValueEnum30TypeEnum", + "SingleValueEnum31TypeEnum", ]); let typeMap: {[index: string]: any} = { - "SomeObject": SomeObject, - "WithNullableType": WithNullableType, + "SingleValueEnum30": SingleValueEnum30, + "SingleValueEnum31": SingleValueEnum31, } type MimeTypeDescriptor = { diff --git a/samples/client/others/typescript/builds/null-types-simple/models/all.ts b/samples/client/others/typescript/builds/null-types-simple/models/all.ts index ed435990d1a4..dc9e55201d87 100644 --- a/samples/client/others/typescript/builds/null-types-simple/models/all.ts +++ b/samples/client/others/typescript/builds/null-types-simple/models/all.ts @@ -1,2 +1,2 @@ -export * from '../models/SomeObject' -export * from '../models/WithNullableType' +export * from '../models/SingleValueEnum30' +export * from '../models/SingleValueEnum31' diff --git a/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts b/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts index 5daa1b27ef4d..766e01f37104 100644 --- a/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts +++ b/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts @@ -2,5 +2,5 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/htt import { Configuration, ConfigurationOptions } from '../configuration' import type { Middleware } from '../middleware'; -import { SomeObject } from '../models/SomeObject'; -import { WithNullableType } from '../models/WithNullableType'; +import { SingleValueEnum30 } from '../models/SingleValueEnum30'; +import { SingleValueEnum31 } from '../models/SingleValueEnum31'; diff --git a/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts b/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts index edc88673397e..8f220fcd26ab 100644 --- a/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts +++ b/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts @@ -3,5 +3,5 @@ import { Configuration, ConfigurationOptions, mergeConfiguration } from '../conf import type { Middleware } from '../middleware'; import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; -import { SomeObject } from '../models/SomeObject'; -import { WithNullableType } from '../models/WithNullableType'; +import { SingleValueEnum30 } from '../models/SingleValueEnum30'; +import { SingleValueEnum31 } from '../models/SingleValueEnum31'; diff --git a/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts b/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts index 35b52e35be9b..a3ade293f9be 100644 --- a/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts +++ b/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts @@ -2,5 +2,5 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/htt import { Configuration, PromiseConfigurationOptions, wrapOptions } from '../configuration' import { PromiseMiddleware, Middleware, PromiseMiddlewareWrapper } from '../middleware'; -import { SomeObject } from '../models/SomeObject'; -import { WithNullableType } from '../models/WithNullableType'; +import { SingleValueEnum30 } from '../models/SingleValueEnum30'; +import { SingleValueEnum31 } from '../models/SingleValueEnum31'; 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 0476f6fe1e97..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,7 +221,7 @@ FakeApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`pet`)) { + 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, @@ -351,14 +351,14 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `dummy`.")) } - if (is.null(`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 (is.null(`var_data_file`)) { + 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, @@ -478,7 +478,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `path_array`.")) } - if (is.null(`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, @@ -585,7 +585,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (is.null(`reg_exp_test`)) { + 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, @@ -705,14 +705,14 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } - if (is.null(`set_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 (is.null(`array_dummy`)) { + 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, 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 26b3a5c526d9..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,7 +431,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } - if (is.null(`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, @@ -559,14 +559,14 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`api_key`)) { + 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, @@ -680,7 +680,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `status`.")) } - if (is.null(`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, @@ -813,7 +813,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `tags`.")) } - if (is.null(`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, @@ -934,7 +934,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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, @@ -1066,7 +1066,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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, @@ -1203,7 +1203,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `header_test_int`.")) } - if (is.null(`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, @@ -1332,7 +1332,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } - if (is.null(`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, @@ -1461,21 +1461,21 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`name`)) { + 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 (is.null(`status`)) { + 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, @@ -1590,21 +1590,21 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`additional_metadata`)) { + 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 (is.null(`file`)) { + 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, 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 2d637c130ca2..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,7 +205,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (is.null(`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, @@ -420,7 +420,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (is.null(`order_id`)) { + 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, @@ -554,7 +554,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } - if (is.null(`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, 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 e5f645942a49..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,7 +314,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -427,7 +427,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -543,7 +543,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -659,7 +659,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } - if (is.null(`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, @@ -772,7 +772,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } - if (is.null(`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, @@ -903,7 +903,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } - if (is.null(`username`)) { + 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, @@ -916,7 +916,7 @@ UserApi <- R6::R6Class( 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 (is.null(`password`)) { + 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, @@ -1136,14 +1136,14 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`username`)) { + 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 (is.null(`user`)) { + 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, diff --git a/samples/client/petstore/R-httr2/R/fake_api.R b/samples/client/petstore/R-httr2/R/fake_api.R index 6b55a95628b7..664ffceb021e 100644 --- a/samples/client/petstore/R-httr2/R/fake_api.R +++ b/samples/client/petstore/R-httr2/R/fake_api.R @@ -221,7 +221,7 @@ FakeApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`pet`)) { + 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, @@ -351,14 +351,14 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `dummy`.")) } - if (is.null(`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 (is.null(`var_data_file`)) { + 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, @@ -478,7 +478,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `path_array_parameter`.")) } - if (is.null(`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, @@ -585,7 +585,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (is.null(`reg_exp_test`)) { + 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, @@ -705,14 +705,14 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } - if (is.null(`set_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 (is.null(`array_dummy`)) { + 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, diff --git a/samples/client/petstore/R-httr2/R/pet_api.R b/samples/client/petstore/R-httr2/R/pet_api.R index bf219b0a28e9..b60f15378597 100644 --- a/samples/client/petstore/R-httr2/R/pet_api.R +++ b/samples/client/petstore/R-httr2/R/pet_api.R @@ -431,7 +431,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } - if (is.null(`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, @@ -559,14 +559,14 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`api_key`)) { + 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, @@ -680,7 +680,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `status`.")) } - if (is.null(`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, @@ -813,7 +813,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `tags`.")) } - if (is.null(`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, @@ -934,7 +934,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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, @@ -1066,7 +1066,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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, @@ -1203,7 +1203,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `header_test_int`.")) } - if (is.null(`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, @@ -1332,7 +1332,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } - if (is.null(`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, @@ -1461,21 +1461,21 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`name`)) { + 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 (is.null(`status`)) { + 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, @@ -1590,21 +1590,21 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`additional_metadata`)) { + 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 (is.null(`file`)) { + 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, diff --git a/samples/client/petstore/R-httr2/R/store_api.R b/samples/client/petstore/R-httr2/R/store_api.R index 271807e37f60..ec454c8d78cc 100644 --- a/samples/client/petstore/R-httr2/R/store_api.R +++ b/samples/client/petstore/R-httr2/R/store_api.R @@ -205,7 +205,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (is.null(`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, @@ -420,7 +420,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (is.null(`order_id`)) { + 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, @@ -554,7 +554,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } - if (is.null(`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, diff --git a/samples/client/petstore/R-httr2/R/user_api.R b/samples/client/petstore/R-httr2/R/user_api.R index 158317a1c8a4..242077c4b1e3 100644 --- a/samples/client/petstore/R-httr2/R/user_api.R +++ b/samples/client/petstore/R-httr2/R/user_api.R @@ -314,7 +314,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -427,7 +427,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -543,7 +543,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -659,7 +659,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } - if (is.null(`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, @@ -772,7 +772,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } - if (is.null(`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, @@ -903,7 +903,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } - if (is.null(`username`)) { + 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, @@ -916,7 +916,7 @@ UserApi <- R6::R6Class( 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 (is.null(`password`)) { + 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, @@ -1136,14 +1136,14 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`username`)) { + 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 (is.null(`user`)) { + 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, diff --git a/samples/client/petstore/R/R/fake_api.R b/samples/client/petstore/R/R/fake_api.R index 2a21496f259d..c113579eb032 100644 --- a/samples/client/petstore/R/R/fake_api.R +++ b/samples/client/petstore/R/R/fake_api.R @@ -221,7 +221,7 @@ FakeApi <- R6::R6Class( oauth_scopes <- NULL is_oauth <- FALSE - if (is.null(`pet`)) { + 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, @@ -351,14 +351,14 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `dummy`.")) } - if (is.null(`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 (is.null(`var_data_file`)) { + 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, @@ -478,7 +478,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `path_array`.")) } - if (is.null(`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, @@ -585,7 +585,7 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `reg_exp_test`.")) } - if (is.null(`reg_exp_test`)) { + 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, @@ -705,14 +705,14 @@ FakeApi <- R6::R6Class( reason = "Missing required parameter `array_dummy`.")) } - if (is.null(`set_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 (is.null(`array_dummy`)) { + 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, diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index c11c72f93267..40cfdabc2271 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -431,7 +431,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } - if (is.null(`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, @@ -559,14 +559,14 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`api_key`)) { + 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, @@ -680,7 +680,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `status`.")) } - if (is.null(`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, @@ -813,7 +813,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `tags`.")) } - if (is.null(`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, @@ -934,7 +934,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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, @@ -1066,7 +1066,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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, @@ -1203,7 +1203,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `header_test_int`.")) } - if (is.null(`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, @@ -1332,7 +1332,7 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet`.")) } - if (is.null(`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, @@ -1461,21 +1461,21 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`name`)) { + 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 (is.null(`status`)) { + 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, @@ -1590,21 +1590,21 @@ PetApi <- R6::R6Class( reason = "Missing required parameter `pet_id`.")) } - if (is.null(`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 (is.null(`additional_metadata`)) { + 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 (is.null(`file`)) { + 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, diff --git a/samples/client/petstore/R/R/store_api.R b/samples/client/petstore/R/R/store_api.R index 1da19ef37394..ebb1fde28a4f 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -205,7 +205,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (is.null(`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, @@ -420,7 +420,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order_id`.")) } - if (is.null(`order_id`)) { + 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, @@ -554,7 +554,7 @@ StoreApi <- R6::R6Class( reason = "Missing required parameter `order`.")) } - if (is.null(`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, diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 88d8c972476a..ca366d7eb130 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -314,7 +314,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -427,7 +427,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -543,7 +543,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`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, @@ -659,7 +659,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } - if (is.null(`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, @@ -772,7 +772,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `username`.")) } - if (is.null(`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, @@ -903,7 +903,7 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `password`.")) } - if (is.null(`username`)) { + 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, @@ -916,7 +916,7 @@ UserApi <- R6::R6Class( 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 (is.null(`password`)) { + 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, @@ -1136,14 +1136,14 @@ UserApi <- R6::R6Class( reason = "Missing required parameter `user`.")) } - if (is.null(`username`)) { + 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 (is.null(`user`)) { + 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, From ac0c71769b5aa6bd18365370805d9dee3e0589c9 Mon Sep 17 00:00:00 2001 From: Matthew Pollock Date: Fri, 25 Jul 2025 06:34:08 -0400 Subject: [PATCH 7/7] samples --- .../null-types-simple/.openapi-generator/FILES | 4 ++-- .../null-types-simple/models/ObjectSerializer.ts | 14 ++++++-------- .../builds/null-types-simple/models/all.ts | 4 ++-- .../null-types-simple/types/ObjectParamAPI.ts | 4 ++-- .../null-types-simple/types/ObservableAPI.ts | 4 ++-- .../builds/null-types-simple/types/PromiseAPI.ts | 4 ++-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES index 832d1d1b6d4d..f586694f5f67 100644 --- a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES +++ b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES @@ -11,8 +11,8 @@ http/isomorphic-fetch.ts index.ts middleware.ts models/ObjectSerializer.ts -models/SingleValueEnum30.ts -models/SingleValueEnum31.ts +models/SomeObject.ts +models/WithNullableType.ts models/all.ts package.json rxjsStub.ts diff --git a/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts index 15b6c13639d3..d44f397943e3 100644 --- a/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts @@ -1,8 +1,8 @@ -export * from '../models/SingleValueEnum30'; -export * from '../models/SingleValueEnum31'; +export * from '../models/SomeObject'; +export * from '../models/WithNullableType'; -import { SingleValueEnum30, SingleValueEnum30TypeEnum } from '../models/SingleValueEnum30'; -import { SingleValueEnum31, SingleValueEnum31TypeEnum } from '../models/SingleValueEnum31'; +import { SomeObject } from '../models/SomeObject'; +import { WithNullableType } from '../models/WithNullableType'; /* tslint:disable:no-unused-variable */ let primitives = [ @@ -17,13 +17,11 @@ let primitives = [ ]; let enumsMap: Set = new Set([ - "SingleValueEnum30TypeEnum", - "SingleValueEnum31TypeEnum", ]); let typeMap: {[index: string]: any} = { - "SingleValueEnum30": SingleValueEnum30, - "SingleValueEnum31": SingleValueEnum31, + "SomeObject": SomeObject, + "WithNullableType": WithNullableType, } type MimeTypeDescriptor = { diff --git a/samples/client/others/typescript/builds/null-types-simple/models/all.ts b/samples/client/others/typescript/builds/null-types-simple/models/all.ts index dc9e55201d87..ed435990d1a4 100644 --- a/samples/client/others/typescript/builds/null-types-simple/models/all.ts +++ b/samples/client/others/typescript/builds/null-types-simple/models/all.ts @@ -1,2 +1,2 @@ -export * from '../models/SingleValueEnum30' -export * from '../models/SingleValueEnum31' +export * from '../models/SomeObject' +export * from '../models/WithNullableType' diff --git a/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts b/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts index 766e01f37104..5daa1b27ef4d 100644 --- a/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts +++ b/samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts @@ -2,5 +2,5 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/htt import { Configuration, ConfigurationOptions } from '../configuration' import type { Middleware } from '../middleware'; -import { SingleValueEnum30 } from '../models/SingleValueEnum30'; -import { SingleValueEnum31 } from '../models/SingleValueEnum31'; +import { SomeObject } from '../models/SomeObject'; +import { WithNullableType } from '../models/WithNullableType'; diff --git a/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts b/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts index 8f220fcd26ab..edc88673397e 100644 --- a/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts +++ b/samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts @@ -3,5 +3,5 @@ import { Configuration, ConfigurationOptions, mergeConfiguration } from '../conf import type { Middleware } from '../middleware'; import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; -import { SingleValueEnum30 } from '../models/SingleValueEnum30'; -import { SingleValueEnum31 } from '../models/SingleValueEnum31'; +import { SomeObject } from '../models/SomeObject'; +import { WithNullableType } from '../models/WithNullableType'; diff --git a/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts b/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts index a3ade293f9be..35b52e35be9b 100644 --- a/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts +++ b/samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts @@ -2,5 +2,5 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/htt import { Configuration, PromiseConfigurationOptions, wrapOptions } from '../configuration' import { PromiseMiddleware, Middleware, PromiseMiddlewareWrapper } from '../middleware'; -import { SingleValueEnum30 } from '../models/SingleValueEnum30'; -import { SingleValueEnum31 } from '../models/SingleValueEnum31'; +import { SomeObject } from '../models/SomeObject'; +import { WithNullableType } from '../models/WithNullableType';