Skip to content

Commit 95f14b2

Browse files
committed
scope .parse to endpoints that return data
1 parent a7244cb commit 95f14b2

19 files changed

Lines changed: 191 additions & 147 deletions

File tree

modules/openapi-generator/src/main/resources/r/api.mustache

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,13 @@
142142
#' @param data_file (optional) name of the data file to save the result
143143
{{/returnType}}
144144
#' @param ... Other optional arguments
145+
{{#returnType}}
145146
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
147+
{{/returnType}}
146148
#'
147149
#' @return {{{returnType}}}{{^returnType}}void{{/returnType}}
148-
{{{operationId}}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}} = {{^defaultValue}}NULL{{/defaultValue}}{{{defaultValue}}}, {{/optionalParams}}{{#vendorExtensions.x-streaming}}stream_callback = NULL, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = NULL, {{/returnType}}..., .parse = TRUE) {
149-
local_var_response <- self${{{operationId}}}{{WithHttpInfo}}({{#allParams}}{{paramName}}, {{/allParams}}{{#vendorExtensions.x-streaming}}stream_callback = stream_callback, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = data_file, {{/returnType}}..., .parse = .parse)
150+
{{{operationId}}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}} = {{^defaultValue}}NULL{{/defaultValue}}{{{defaultValue}}}, {{/optionalParams}}{{#vendorExtensions.x-streaming}}stream_callback = NULL, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = NULL, {{/returnType}}...{{#returnType}}, .parse = TRUE{{/returnType}}) {
151+
local_var_response <- self${{{operationId}}}{{WithHttpInfo}}({{#allParams}}{{paramName}}, {{/allParams}}{{#vendorExtensions.x-streaming}}stream_callback = stream_callback, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = data_file, {{/returnType}}...{{#returnType}}, .parse = .parse{{/returnType}})
150152
{{#vendorExtensions.x-streaming}}
151153
if (typeof(stream_callback) == "closure") { # return void if streaming is enabled
152154
return(invisible(NULL))
@@ -180,9 +182,12 @@
180182
#' @param data_file (optional) name of the data file to save the result
181183
{{/returnType}}
182184
#' @param ... Other optional arguments
185+
{{#returnType}}
186+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
187+
{{/returnType}}
183188
#'
184189
#' @return API response ({{{returnType}}}{{^returnType}}void{{/returnType}}) with additional information such as HTTP status code, headers
185-
{{{operationId}}}{{WithHttpInfo}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}} = {{^defaultValue}}NULL{{/defaultValue}}{{{defaultValue}}}, {{/optionalParams}}{{#vendorExtensions.x-streaming}}stream_callback = NULL, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = NULL, {{/returnType}}..., .parse = TRUE) {
190+
{{{operationId}}}{{WithHttpInfo}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}} = {{^defaultValue}}NULL{{/defaultValue}}{{{defaultValue}}}, {{/optionalParams}}{{#vendorExtensions.x-streaming}}stream_callback = NULL, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = NULL, {{/returnType}}...{{#returnType}}, .parse = TRUE{{/returnType}}) {
186191
args <- list(...)
187192
query_params <- list()
188193
header_params <- c()
@@ -570,10 +575,12 @@
570575
self$api_client$WriteFile(local_var_resp, data_file)
571576
}
572577
578+
{{#returnType}}
573579
if (!.parse) {
574580
local_var_resp$content <- local_var_resp$response_as_text()
575581
return(local_var_resp)
576582
}
583+
{{/returnType}}
577584
578585
deserialized_resp_obj <- tryCatch(
579586
self$api_client$DeserializeResponse(local_var_resp, "{{returnType}}"),

samples/client/echo_api/r/R/auth_api.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ AuthApi <- R6::R6Class(
9494
#'
9595
#' @param data_file (optional) name of the data file to save the result
9696
#' @param ... Other optional arguments
97+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
9798
#'
9899
#' @return API response (character) with additional information such as HTTP status code, headers
99100
TestAuthHttpBasicWithHttpInfo = function(data_file = NULL, ..., .parse = TRUE) {
@@ -191,6 +192,7 @@ AuthApi <- R6::R6Class(
191192
#'
192193
#' @param data_file (optional) name of the data file to save the result
193194
#' @param ... Other optional arguments
195+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
194196
#'
195197
#' @return API response (character) with additional information such as HTTP status code, headers
196198
TestAuthHttpBearerWithHttpInfo = function(data_file = NULL, ..., .parse = TRUE) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ BodyApi <- R6::R6Class(
200200
#'
201201
#' @param data_file (optional) name of the data file to save the result
202202
#' @param ... Other optional arguments
203+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
203204
#'
204205
#' @return API response (data.frame) with additional information such as HTTP status code, headers
205206
TestBinaryGifWithHttpInfo = function(data_file = NULL, ..., .parse = TRUE) {
@@ -295,6 +296,7 @@ BodyApi <- R6::R6Class(
295296
#' @param body (optional) No description
296297
#' @param data_file (optional) name of the data file to save the result
297298
#' @param ... Other optional arguments
299+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
298300
#'
299301
#' @return API response (character) with additional information such as HTTP status code, headers
300302
TestBodyApplicationOctetstreamBinaryWithHttpInfo = function(body = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -400,6 +402,7 @@ BodyApi <- R6::R6Class(
400402
#' @param files
401403
#' @param data_file (optional) name of the data file to save the result
402404
#' @param ... Other optional arguments
405+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
403406
#'
404407
#' @return API response (character) with additional information such as HTTP status code, headers
405408
TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo = function(files, data_file = NULL, ..., .parse = TRUE) {
@@ -504,6 +507,7 @@ BodyApi <- R6::R6Class(
504507
#' @param my_file (optional) No description
505508
#' @param data_file (optional) name of the data file to save the result
506509
#' @param ... Other optional arguments
510+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
507511
#'
508512
#' @return API response (character) with additional information such as HTTP status code, headers
509513
TestBodyMultipartFormdataSingleBinaryWithHttpInfo = function(my_file = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -604,6 +608,7 @@ BodyApi <- R6::R6Class(
604608
#' @param pet (optional) Pet object that needs to be added to the store
605609
#' @param data_file (optional) name of the data file to save the result
606610
#' @param ... Other optional arguments
611+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
607612
#'
608613
#' @return API response (Pet) with additional information such as HTTP status code, headers
609614
TestEchoBodyAllOfPetWithHttpInfo = function(pet = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -709,6 +714,7 @@ BodyApi <- R6::R6Class(
709714
#' @param body (optional) Free form object
710715
#' @param data_file (optional) name of the data file to save the result
711716
#' @param ... Other optional arguments
717+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
712718
#'
713719
#' @return API response (character) with additional information such as HTTP status code, headers
714720
TestEchoBodyFreeFormObjectResponseStringWithHttpInfo = function(body = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -814,6 +820,7 @@ BodyApi <- R6::R6Class(
814820
#' @param pet (optional) Pet object that needs to be added to the store
815821
#' @param data_file (optional) name of the data file to save the result
816822
#' @param ... Other optional arguments
823+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
817824
#'
818825
#' @return API response (Pet) with additional information such as HTTP status code, headers
819826
TestEchoBodyPetWithHttpInfo = function(pet = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -919,6 +926,7 @@ BodyApi <- R6::R6Class(
919926
#' @param pet (optional) Pet object that needs to be added to the store
920927
#' @param data_file (optional) name of the data file to save the result
921928
#' @param ... Other optional arguments
929+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
922930
#'
923931
#' @return API response (character) with additional information such as HTTP status code, headers
924932
TestEchoBodyPetResponseStringWithHttpInfo = function(pet = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -1024,6 +1032,7 @@ BodyApi <- R6::R6Class(
10241032
#' @param body (optional) String enum
10251033
#' @param data_file (optional) name of the data file to save the result
10261034
#' @param ... Other optional arguments
1035+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
10271036
#'
10281037
#' @return API response (StringEnumRef) with additional information such as HTTP status code, headers
10291038
TestEchoBodyStringEnumWithHttpInfo = function(body = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -1129,6 +1138,7 @@ BodyApi <- R6::R6Class(
11291138
#' @param tag (optional) Tag object
11301139
#' @param data_file (optional) name of the data file to save the result
11311140
#' @param ... Other optional arguments
1141+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
11321142
#'
11331143
#' @return API response (character) with additional information such as HTTP status code, headers
11341144
TestEchoBodyTagResponseStringWithHttpInfo = function(tag = NULL, data_file = NULL, ..., .parse = TRUE) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ FormApi <- R6::R6Class(
116116
#' @param string_form (optional) No description
117117
#' @param data_file (optional) name of the data file to save the result
118118
#' @param ... Other optional arguments
119+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
119120
#'
120121
#' @return API response (character) with additional information such as HTTP status code, headers
121122
TestFormIntegerBooleanStringWithHttpInfo = function(integer_form = NULL, boolean_form = NULL, string_form = NULL, data_file = NULL, ..., .parse = TRUE) {
@@ -226,6 +227,7 @@ FormApi <- R6::R6Class(
226227
#' @param marker
227228
#' @param data_file (optional) name of the data file to save the result
228229
#' @param ... Other optional arguments
230+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
229231
#'
230232
#' @return API response (character) with additional information such as HTTP status code, headers
231233
TestFormObjectMultipartWithHttpInfo = function(marker, data_file = NULL, ..., .parse = TRUE) {
@@ -340,6 +342,7 @@ FormApi <- R6::R6Class(
340342
#' @param name (optional) No description
341343
#' @param data_file (optional) name of the data file to save the result
342344
#' @param ... Other optional arguments
345+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
343346
#'
344347
#' @return API response (character) with additional information such as HTTP status code, headers
345348
TestFormOneofWithHttpInfo = function(form1 = NULL, form2 = NULL, form3 = NULL, form4 = NULL, id = NULL, name = NULL, data_file = NULL, ..., .parse = TRUE) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ HeaderApi <- R6::R6Class(
8989
#' @param enum_ref_string_header (optional) No description
9090
#' @param data_file (optional) name of the data file to save the result
9191
#' @param ... Other optional arguments
92+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
9293
#'
9394
#' @return API response (character) with additional information such as HTTP status code, headers
9495
TestHeaderIntegerBooleanStringEnumsWithHttpInfo = function(integer_header = NULL, boolean_header = NULL, string_header = NULL, enum_nonref_string_header = NULL, enum_ref_string_header = NULL, data_file = NULL, ..., .parse = TRUE) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ PathApi <- R6::R6Class(
8686
#' @param enum_ref_string_path
8787
#' @param data_file (optional) name of the data file to save the result
8888
#' @param ... Other optional arguments
89+
#' @param .parse Logical. If \code{TRUE} then the response will be parsed to a generated type. If \code{FALSE} the response will be returned as unparsed text.
8990
#'
9091
#' @return API response (character) with additional information such as HTTP status code, headers
9192
TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo = function(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, data_file = NULL, ..., .parse = TRUE) {

0 commit comments

Comments
 (0)