diff --git a/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache index d037b95f2ac..49499873c1d 100644 --- a/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} #' @docType class #' @title ApiResponse #' @description ApiResponse Class @@ -5,11 +6,19 @@ #' @field content The deserialized response body. #' @field response The raw response from the endpoint. #' @export -ApiResponse <- R6::R6Class( +ApiResponse <- R6::R6Class( "ApiResponse", public = list( content = NULL, response = NULL, + #' Initialize a new ApiResponse class. + #' + #' @description + #' Initialize a new ApiResponse class. + #' + #' @param content The deserialized response body. + #' @param response The raw response from the endpoint. + #' @export initialize = function(content, response) { self$content <- content self$response <- response diff --git a/modules/openapi-generator/src/main/resources/r/api_exception.mustache b/modules/openapi-generator/src/main/resources/r/api_exception.mustache index f8e1fa61af8..ba11cd3105c 100644 --- a/modules/openapi-generator/src/main/resources/r/api_exception.mustache +++ b/modules/openapi-generator/src/main/resources/r/api_exception.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {{! ApiException class for returning the ApiException object on encountering errors}} #' @docType class #' @title ApiException @@ -15,13 +16,21 @@ ApiException <- R6::R6Class( reason = NULL, body = NULL, headers = NULL, - + #' Initialize a new ApiException class. + #' + #' @description + #' Initialize a new ApiExceptino class. + #' + #' @param status HTTP status. + #' @param reason Reason of the ApiException. + #' @param http_response HTTP response object. + #' @export initialize = function(status = NULL, reason = NULL, http_response = NULL) { if (!is.null(http_response)) { self$status <- http_response$status_code errorMsg <- toString(content(http_response)) if(errorMsg == ""){ - errorMsg <- "Api exception encountered." + errorMsg <- "Api exception encountered. No details given." } self$body <- errorMsg self$headers <- http_response$headers @@ -33,8 +42,13 @@ ApiException <- R6::R6Class( self$headers <- NULL } }, - - # returns the string format of ApiException + #' Returns the string format of ApiException. + #' + #' @description + #' Returns the string format of ApiException. + #' + #' @return the string format of ApiException. + #' @export toString = function() { errorMsg <- "" errorMsg <- paste("status : ", self$status, "\n", sep = "") @@ -52,4 +66,4 @@ ApiException <- R6::R6Class( errorMsg } ) -) \ No newline at end of file +) diff --git a/samples/client/petstore/R/R/api_exception.R b/samples/client/petstore/R/R/api_exception.R index fccd7090141..c5d40b0f1de 100644 --- a/samples/client/petstore/R/R/api_exception.R +++ b/samples/client/petstore/R/R/api_exception.R @@ -1,3 +1,11 @@ +#' OpenAPI Petstore +#' +#' This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#' +#' The version of the OpenAPI document: 1.0.0 +#' Generated by: https://openapi-generator.tech +#' + #' @docType class #' @title ApiException #' @description ApiException Class @@ -14,13 +22,21 @@ ApiException <- R6::R6Class( reason = NULL, body = NULL, headers = NULL, - + #' Initialize a new ApiException class. + #' + #' @description + #' Initialize a new ApiExceptino class. + #' + #' @param status HTTP status. + #' @param reason Reason of the ApiException. + #' @param http_response HTTP response object. + #' @export initialize = function(status = NULL, reason = NULL, http_response = NULL) { if (!is.null(http_response)) { self$status <- http_response$status_code errorMsg <- toString(content(http_response)) if(errorMsg == ""){ - errorMsg <- "Api exception encountered." + errorMsg <- "Api exception encountered. No details given." } self$body <- errorMsg self$headers <- http_response$headers @@ -32,8 +48,13 @@ ApiException <- R6::R6Class( self$headers <- NULL } }, - - # returns the string format of ApiException + #' Returns the string format of ApiException. + #' + #' @description + #' Returns the string format of ApiException. + #' + #' @return the string format of ApiException. + #' @export toString = function() { errorMsg <- "" errorMsg <- paste("status : ", self$status, "\n", sep = "") @@ -51,4 +72,4 @@ ApiException <- R6::R6Class( errorMsg } ) -) \ No newline at end of file +) diff --git a/samples/client/petstore/R/R/api_response.R b/samples/client/petstore/R/R/api_response.R index d037b95f2ac..2362fd4e466 100644 --- a/samples/client/petstore/R/R/api_response.R +++ b/samples/client/petstore/R/R/api_response.R @@ -1,3 +1,11 @@ +#' OpenAPI Petstore +#' +#' This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#' +#' The version of the OpenAPI document: 1.0.0 +#' Generated by: https://openapi-generator.tech +#' + #' @docType class #' @title ApiResponse #' @description ApiResponse Class @@ -5,11 +13,19 @@ #' @field content The deserialized response body. #' @field response The raw response from the endpoint. #' @export -ApiResponse <- R6::R6Class( +ApiResponse <- R6::R6Class( "ApiResponse", public = list( content = NULL, response = NULL, + #' Initialize a new ApiResponse class. + #' + #' @description + #' Initialize a new ApiResponse class. + #' + #' @param content The deserialized response body. + #' @param response The raw response from the endpoint. + #' @export initialize = function(content, response) { self$content <- content self$response <- response