Skip to content

Commit 3cec95d

Browse files
committed
update samples
1 parent 4c7a454 commit 3cec95d

17 files changed

Lines changed: 741 additions & 0 deletions

File tree

samples/client/echo_api/r/R/body_api.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ BodyApi <- R6::R6Class(
300300
oauth_scopes <- NULL
301301
is_oauth <- FALSE
302302

303+
if (is.null(`body`)) {
304+
stop("Invalid value for `body` when calling BodyApi$TestBodyApplicationOctetstreamBinary, `body` is not nullable")
305+
}
303306

304307
if (!is.null(`body`)) {
305308
local_var_body <- `body`$toJSONString()
@@ -400,6 +403,9 @@ BodyApi <- R6::R6Class(
400403
stop("Missing required parameter `files`.")
401404
}
402405

406+
if (is.null(`files`)) {
407+
stop("Invalid value for `files` when calling BodyApi$TestBodyMultipartFormdataArrayOfBinary, `files` is not nullable")
408+
}
403409

404410
file_params["files"] <- httr::upload_file(`files`)
405411
local_var_url_path <- "/body/application/octetstream/array_of_binary"
@@ -491,6 +497,9 @@ BodyApi <- R6::R6Class(
491497
oauth_scopes <- NULL
492498
is_oauth <- FALSE
493499

500+
if (is.null(`my_file`)) {
501+
stop("Invalid value for `my_file` when calling BodyApi$TestBodyMultipartFormdataSingleBinary, `my_file` is not nullable")
502+
}
494503

495504
file_params["my-file"] <- httr::upload_file(`my_file`)
496505
local_var_url_path <- "/body/application/octetstream/single_binary"
@@ -582,6 +591,9 @@ BodyApi <- R6::R6Class(
582591
oauth_scopes <- NULL
583592
is_oauth <- FALSE
584593

594+
if (is.null(`pet`)) {
595+
stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyAllOfPet, `pet` is not nullable")
596+
}
585597

586598
if (!is.null(`pet`)) {
587599
local_var_body <- `pet`$toJSONString()
@@ -678,6 +690,9 @@ BodyApi <- R6::R6Class(
678690
oauth_scopes <- NULL
679691
is_oauth <- FALSE
680692

693+
if (is.null(`body`)) {
694+
stop("Invalid value for `body` when calling BodyApi$TestEchoBodyFreeFormObjectResponseString, `body` is not nullable")
695+
}
681696

682697
if (!is.null(`body`)) {
683698
local_var_body <- `body`$toJSONString()
@@ -774,6 +789,9 @@ BodyApi <- R6::R6Class(
774789
oauth_scopes <- NULL
775790
is_oauth <- FALSE
776791

792+
if (is.null(`pet`)) {
793+
stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyPet, `pet` is not nullable")
794+
}
777795

778796
if (!is.null(`pet`)) {
779797
local_var_body <- `pet`$toJSONString()
@@ -870,6 +888,9 @@ BodyApi <- R6::R6Class(
870888
oauth_scopes <- NULL
871889
is_oauth <- FALSE
872890

891+
if (is.null(`pet`)) {
892+
stop("Invalid value for `pet` when calling BodyApi$TestEchoBodyPetResponseString, `pet` is not nullable")
893+
}
873894

874895
if (!is.null(`pet`)) {
875896
local_var_body <- `pet`$toJSONString()
@@ -966,6 +987,9 @@ BodyApi <- R6::R6Class(
966987
oauth_scopes <- NULL
967988
is_oauth <- FALSE
968989

990+
if (is.null(`body`)) {
991+
stop("Invalid value for `body` when calling BodyApi$TestEchoBodyStringEnum, `body` is not nullable")
992+
}
969993

970994
if (!is.null(`body`)) {
971995
local_var_body <- `body`$toJSONString()
@@ -1062,6 +1086,9 @@ BodyApi <- R6::R6Class(
10621086
oauth_scopes <- NULL
10631087
is_oauth <- FALSE
10641088

1089+
if (is.null(`tag`)) {
1090+
stop("Invalid value for `tag` when calling BodyApi$TestEchoBodyTagResponseString, `tag` is not nullable")
1091+
}
10651092

10661093
if (!is.null(`tag`)) {
10671094
local_var_body <- `tag`$toJSONString()

samples/client/echo_api/r/R/form_api.R

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,17 @@ FormApi <- R6::R6Class(
127127
oauth_scopes <- NULL
128128
is_oauth <- FALSE
129129

130+
if (is.null(`integer_form`)) {
131+
stop("Invalid value for `integer_form` when calling FormApi$TestFormIntegerBooleanString, `integer_form` is not nullable")
132+
}
130133

134+
if (is.null(`boolean_form`)) {
135+
stop("Invalid value for `boolean_form` when calling FormApi$TestFormIntegerBooleanString, `boolean_form` is not nullable")
136+
}
131137

138+
if (is.null(`string_form`)) {
139+
stop("Invalid value for `string_form` when calling FormApi$TestFormIntegerBooleanString, `string_form` is not nullable")
140+
}
132141

133142
form_params["integer_form"] <- `integer_form`
134143
form_params["boolean_form"] <- `boolean_form`
@@ -226,6 +235,9 @@ FormApi <- R6::R6Class(
226235
stop("Missing required parameter `marker`.")
227236
}
228237

238+
if (is.null(`marker`)) {
239+
stop("Invalid value for `marker` when calling FormApi$TestFormObjectMultipart, `marker` is not nullable")
240+
}
229241

230242
form_params["marker"] <- `marker`
231243
local_var_url_path <- "/form/object/multipart"
@@ -327,11 +339,29 @@ FormApi <- R6::R6Class(
327339
oauth_scopes <- NULL
328340
is_oauth <- FALSE
329341

342+
if (is.null(`form1`)) {
343+
stop("Invalid value for `form1` when calling FormApi$TestFormOneof, `form1` is not nullable")
344+
}
330345

346+
if (is.null(`form2`)) {
347+
stop("Invalid value for `form2` when calling FormApi$TestFormOneof, `form2` is not nullable")
348+
}
331349

350+
if (is.null(`form3`)) {
351+
stop("Invalid value for `form3` when calling FormApi$TestFormOneof, `form3` is not nullable")
352+
}
332353

354+
if (is.null(`form4`)) {
355+
stop("Invalid value for `form4` when calling FormApi$TestFormOneof, `form4` is not nullable")
356+
}
333357

358+
if (is.null(`id`)) {
359+
stop("Invalid value for `id` when calling FormApi$TestFormOneof, `id` is not nullable")
360+
}
334361

362+
if (is.null(`name`)) {
363+
stop("Invalid value for `name` when calling FormApi$TestFormOneof, `name` is not nullable")
364+
}
335365

336366
form_params["form1"] <- `form1`
337367
form_params["form2"] <- `form2`

samples/client/echo_api/r/R/header_api.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,25 @@ HeaderApi <- R6::R6Class(
100100
oauth_scopes <- NULL
101101
is_oauth <- FALSE
102102

103+
if (is.null(`integer_header`)) {
104+
stop("Invalid value for `integer_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `integer_header` is not nullable")
105+
}
103106

107+
if (is.null(`boolean_header`)) {
108+
stop("Invalid value for `boolean_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `boolean_header` is not nullable")
109+
}
104110

111+
if (is.null(`string_header`)) {
112+
stop("Invalid value for `string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `string_header` is not nullable")
113+
}
105114

115+
if (is.null(`enum_nonref_string_header`)) {
116+
stop("Invalid value for `enum_nonref_string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `enum_nonref_string_header` is not nullable")
117+
}
106118

119+
if (is.null(`enum_ref_string_header`)) {
120+
stop("Invalid value for `enum_ref_string_header` when calling HeaderApi$TestHeaderIntegerBooleanStringEnums, `enum_ref_string_header` is not nullable")
121+
}
107122

108123
header_params["integer_header"] <- `integer_header`
109124

samples/client/echo_api/r/R/path_api.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,21 @@ PathApi <- R6::R6Class(
113113
stop("Missing required parameter `enum_ref_string_path`.")
114114
}
115115

116+
if (is.null(`path_string`)) {
117+
stop("Invalid value for `path_string` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_string` is not nullable")
118+
}
116119

120+
if (is.null(`path_integer`)) {
121+
stop("Invalid value for `path_integer` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `path_integer` is not nullable")
122+
}
117123

124+
if (is.null(`enum_nonref_string_path`)) {
125+
stop("Invalid value for `enum_nonref_string_path` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `enum_nonref_string_path` is not nullable")
126+
}
118127

128+
if (is.null(`enum_ref_string_path`)) {
129+
stop("Invalid value for `enum_ref_string_path` when calling PathApi$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, `enum_ref_string_path` is not nullable")
130+
}
119131

120132
local_var_url_path <- "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}"
121133
if (!missing(`path_string`)) {

samples/client/echo_api/r/R/query_api.R

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ QueryApi <- R6::R6Class(
221221
oauth_scopes <- NULL
222222
is_oauth <- FALSE
223223

224+
if (is.null(`enum_nonref_string_query`)) {
225+
stop("Invalid value for `enum_nonref_string_query` when calling QueryApi$TestEnumRefString, `enum_nonref_string_query` is not nullable")
226+
}
224227

228+
if (is.null(`enum_ref_string_query`)) {
229+
stop("Invalid value for `enum_ref_string_query` when calling QueryApi$TestEnumRefString, `enum_ref_string_query` is not nullable")
230+
}
225231

226232
if (!is.null(`enum_nonref_string_query`) && !(`enum_nonref_string_query` %in% c("success", "failure", "unclassified"))) {
227233
stop("Invalid value for enum_nonref_string_query when calling QueryApi$TestEnumRefString. Must be [success, failure, unclassified].")
@@ -323,8 +329,17 @@ QueryApi <- R6::R6Class(
323329
oauth_scopes <- NULL
324330
is_oauth <- FALSE
325331

332+
if (is.null(`datetime_query`)) {
333+
stop("Invalid value for `datetime_query` when calling QueryApi$TestQueryDatetimeDateString, `datetime_query` is not nullable")
334+
}
326335

336+
if (is.null(`date_query`)) {
337+
stop("Invalid value for `date_query` when calling QueryApi$TestQueryDatetimeDateString, `date_query` is not nullable")
338+
}
327339

340+
if (is.null(`string_query`)) {
341+
stop("Invalid value for `string_query` when calling QueryApi$TestQueryDatetimeDateString, `string_query` is not nullable")
342+
}
328343

329344
query_params[["datetime_query"]] <- `datetime_query`
330345

@@ -425,8 +440,17 @@ QueryApi <- R6::R6Class(
425440
oauth_scopes <- NULL
426441
is_oauth <- FALSE
427442

443+
if (is.null(`integer_query`)) {
444+
stop("Invalid value for `integer_query` when calling QueryApi$TestQueryIntegerBooleanString, `integer_query` is not nullable")
445+
}
428446

447+
if (is.null(`boolean_query`)) {
448+
stop("Invalid value for `boolean_query` when calling QueryApi$TestQueryIntegerBooleanString, `boolean_query` is not nullable")
449+
}
429450

451+
if (is.null(`string_query`)) {
452+
stop("Invalid value for `string_query` when calling QueryApi$TestQueryIntegerBooleanString, `string_query` is not nullable")
453+
}
430454

431455
query_params[["integer_query"]] <- `integer_query`
432456

@@ -523,6 +547,9 @@ QueryApi <- R6::R6Class(
523547
oauth_scopes <- NULL
524548
is_oauth <- FALSE
525549

550+
if (is.null(`query_object`)) {
551+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleDeepObjectExplodeTrueObject, `query_object` is not nullable")
552+
}
526553

527554
query_params[["query_object"]] <- `query_object`
528555

@@ -615,6 +642,9 @@ QueryApi <- R6::R6Class(
615642
oauth_scopes <- NULL
616643
is_oauth <- FALSE
617644

645+
if (is.null(`query_object`)) {
646+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleDeepObjectExplodeTrueObjectAllOf, `query_object` is not nullable")
647+
}
618648

619649
query_params[["query_object"]] <- `query_object`
620650

@@ -707,6 +737,9 @@ QueryApi <- R6::R6Class(
707737
oauth_scopes <- NULL
708738
is_oauth <- FALSE
709739

740+
if (is.null(`query_object`)) {
741+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeFalseArrayInteger, `query_object` is not nullable")
742+
}
710743

711744
# no explore
712745
query_params[["query_object"]] <- I(paste(lapply(`query_object`, URLencode, reserved = TRUE), collapse = ","))
@@ -800,6 +833,9 @@ QueryApi <- R6::R6Class(
800833
oauth_scopes <- NULL
801834
is_oauth <- FALSE
802835

836+
if (is.null(`query_object`)) {
837+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeFalseArrayString, `query_object` is not nullable")
838+
}
803839

804840
# no explore
805841
query_params[["query_object"]] <- I(paste(lapply(`query_object`, URLencode, reserved = TRUE), collapse = ","))
@@ -893,6 +929,9 @@ QueryApi <- R6::R6Class(
893929
oauth_scopes <- NULL
894930
is_oauth <- FALSE
895931

932+
if (is.null(`query_object`)) {
933+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueArrayString, `query_object` is not nullable")
934+
}
896935

897936
query_params[["query_object"]] <- `query_object`
898937

@@ -985,6 +1024,9 @@ QueryApi <- R6::R6Class(
9851024
oauth_scopes <- NULL
9861025
is_oauth <- FALSE
9871026

1027+
if (is.null(`query_object`)) {
1028+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueObject, `query_object` is not nullable")
1029+
}
9881030

9891031
query_params[["query_object"]] <- `query_object`
9901032

@@ -1077,6 +1119,9 @@ QueryApi <- R6::R6Class(
10771119
oauth_scopes <- NULL
10781120
is_oauth <- FALSE
10791121

1122+
if (is.null(`query_object`)) {
1123+
stop("Invalid value for `query_object` when calling QueryApi$TestQueryStyleFormExplodeTrueObjectAllOf, `query_object` is not nullable")
1124+
}
10801125

10811126
query_params[["query_object"]] <- `query_object`
10821127

samples/client/petstore/R-httr2-wrapper/R/fake_api.R

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ FakeApi <- R6::R6Class(
221221
oauth_scopes <- NULL
222222
is_oauth <- FALSE
223223

224+
if (is.null(`pet`)) {
225+
rlang::abort(message = "Invalid value for `pet` when calling FakeApi$add_pet_optional, `pet` is not nullable",
226+
.subclass = "ApiException",
227+
ApiException = ApiException$new(status = 0,
228+
reason = "Invalid value for `pet` when calling FakeApi$add_pet_optional, `pet` is not nullable"))
229+
}
224230

225231
if (!is.null(`pet`)) {
226232
local_var_body <- `pet`$toJSONString()
@@ -345,7 +351,19 @@ FakeApi <- R6::R6Class(
345351
reason = "Missing required parameter `dummy`."))
346352
}
347353

354+
if (is.null(`dummy`)) {
355+
rlang::abort(message = "Invalid value for `dummy` when calling FakeApi$fake_data_file, `dummy` is not nullable",
356+
.subclass = "ApiException",
357+
ApiException = ApiException$new(status = 0,
358+
reason = "Invalid value for `dummy` when calling FakeApi$fake_data_file, `dummy` is not nullable"))
359+
}
348360

361+
if (is.null(`var_data_file`)) {
362+
rlang::abort(message = "Invalid value for `var_data_file` when calling FakeApi$fake_data_file, `var_data_file` is not nullable",
363+
.subclass = "ApiException",
364+
ApiException = ApiException$new(status = 0,
365+
reason = "Invalid value for `var_data_file` when calling FakeApi$fake_data_file, `var_data_file` is not nullable"))
366+
}
349367

350368
header_params["dummy"] <- `dummy`
351369

@@ -460,6 +478,12 @@ FakeApi <- R6::R6Class(
460478
reason = "Missing required parameter `path_array`."))
461479
}
462480

481+
if (is.null(`path_array`)) {
482+
rlang::abort(message = "Invalid value for `path_array` when calling FakeApi$fake_path_array, `path_array` is not nullable",
483+
.subclass = "ApiException",
484+
ApiException = ApiException$new(status = 0,
485+
reason = "Invalid value for `path_array` when calling FakeApi$fake_path_array, `path_array` is not nullable"))
486+
}
463487

464488
local_var_url_path <- "/fake/path_array/{path_array}/testing"
465489
if (!missing(`path_array`)) {
@@ -561,6 +585,12 @@ FakeApi <- R6::R6Class(
561585
reason = "Missing required parameter `reg_exp_test`."))
562586
}
563587

588+
if (is.null(`reg_exp_test`)) {
589+
rlang::abort(message = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, `reg_exp_test` is not nullable",
590+
.subclass = "ApiException",
591+
ApiException = ApiException$new(status = 0,
592+
reason = "Invalid value for `reg_exp_test` when calling FakeApi$fake_regular_expression, `reg_exp_test` is not nullable"))
593+
}
564594
if (!is.null(`reg_exp_test`) && !stringr::str_detect(`reg_exp_test`, "^[A-Za-z0-9_]{1,15}$")) {
565595
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}$.",
566596
.subclass = "ApiException",
@@ -675,7 +705,19 @@ FakeApi <- R6::R6Class(
675705
reason = "Missing required parameter `array_dummy`."))
676706
}
677707

708+
if (is.null(`set_dummy`)) {
709+
rlang::abort(message = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query, `set_dummy` is not nullable",
710+
.subclass = "ApiException",
711+
ApiException = ApiException$new(status = 0,
712+
reason = "Invalid value for `set_dummy` when calling FakeApi$fake_set_query, `set_dummy` is not nullable"))
713+
}
678714

715+
if (is.null(`array_dummy`)) {
716+
rlang::abort(message = "Invalid value for `array_dummy` when calling FakeApi$fake_set_query, `array_dummy` is not nullable",
717+
.subclass = "ApiException",
718+
ApiException = ApiException$new(status = 0,
719+
reason = "Invalid value for `array_dummy` when calling FakeApi$fake_set_query, `array_dummy` is not nullable"))
720+
}
679721

680722
# check if items are unique
681723
if (!is.null(`set_dummy`) && !identical(`set_dummy`, unique(`set_dummy`))) {

0 commit comments

Comments
 (0)