Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !12979

[R] fix assignment, better doc

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged William Cheng requested to merge r-model-better-format into master 3 years ago
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 30
  • fix assignment
  • better code format
  • fix doc (html escaped comments)
  • remove blank lines

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Compare
  • master (base)

and
  • latest version
    baca147b
    3 commits, 2 years ago

30 files
+ 109
- 129

    Preferences

    File browser
    Compare changes
modules/openapi-‎generator/…/…/…/r‎
Rbuildigno‎re.mustache‎ +1 -0
api.mu‎stache‎ +11 -9
modelAnyO‎f.mustache‎ +1 -1
modelEnum‎.mustache‎ +1 -1
modelGener‎ic.mustache‎ +6 -15
modelOneO‎f.mustache‎ +1 -1
samples/clie‎nt/petstore/R‎
‎R‎
allof_tag_ap‎i_response.R‎ +0 -1
anim‎al.R‎ +0 -1
any_of‎_pig.R‎ +0 -1
basque‎_pig.R‎ +0 -1
ca‎t.R‎ +0 -1
cat_al‎l_of.R‎ +0 -1
categ‎ory.R‎ +0 -1
danish‎_pig.R‎ +0 -1
do‎g.R‎ +0 -1
dog_al‎l_of.R‎ +0 -1
fake_‎api.R‎ +6 -6
model_api_‎response.R‎ +0 -1
nested_‎one_of.R‎ +1 -2
ord‎er.R‎ +0 -1
pe‎t.R‎ +3 -4
pet_‎api.R‎ +39 -39
pi‎g.R‎ +0 -1
spec‎ial.R‎ +0 -1
store‎_api.R‎ +13 -13
ta‎g.R‎ +0 -1
update_pet‎_request.R‎ +1 -2
use‎r.R‎ +0 -1
user_‎api.R‎ +24 -20
.Rbuil‎dignore‎ +1 -0
modules/openapi-generator/src/main/resources/r/Rbuildignore.mustache
+ 1
- 0
  • View file @ baca147b

  • Edit in single-file editor

  • Open in Web IDE


@@ -11,6 +11,7 @@
^\.gitignore$
^\.openapi-generator-ignore$
^\.travis\.yml$
^\.lintr$
^\.github$
^\.openapi-generator$
^docs$
modules/openapi-generator/src/main/resources/r/api.mustache
+ 11
- 9
  • View file @ baca147b

  • Edit in single-file editor

  • Open in Web IDE


@@ -12,7 +12,7 @@
{{#operation}}
#' \strong{ {{operationId}} } \emph{ {{summary}} }
{{#notes}}
#' {{notes}}
#' {{{.}}}
{{/notes}}
#'
#' \itemize{
@@ -64,7 +64,7 @@
{{#responses}}
#' \item status code : {{code}} | {{message}}
#'
#'{{#dataType}} \item return type : {{.}} {{/dataType}}
#'{{#dataType}} \item return type : {{.}}{{/dataType}}
#' \item response headers :
#'
#' \tabular{ll}{
@@ -182,7 +182,7 @@
#' @param {{{paramName}}} {{{description}}}
{{/requiredParams}}
{{#optionalParams}}
#' @param {{{paramName}}} (optional){{{description}}} {{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
#' @param {{{paramName}}} (optional) {{{description}}}{{^description}}No description{{/description}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
{{/optionalParams}}
{{#vendorExtensions.x-streaming}}
#' @param stream_callback (optional) callback function to process the data stream
@@ -193,7 +193,7 @@
#' @param ... Other optional arguments
#' @return {{{returnType}}}{{^returnType}}void{{/returnType}}
#' @export
{{{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}}...) {
{{{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}}...) {
api_response <- self${{{operationId}}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}{{#vendorExtensions.x-streaming}}stream_callback = stream_callback, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = data_file, {{/returnType}}...)
{{#vendorExtensions.x-streaming}}
if (typeof(stream_callback) == "closure") { # return void if streaming is enabled
@@ -221,7 +221,7 @@
#' @param {{{paramName}}} {{{description}}}
{{/requiredParams}}
{{#optionalParams}}
#' @param {{{paramName}}} (optional) {{{description}}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
#' @param {{{paramName}}} (optional) {{{description}}}{{^description}}No description{{/description}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
{{/optionalParams}}
{{#vendorExtensions.x-streaming}}
#' @param stream_callback (optional) callback function to process the data stream
@@ -232,7 +232,7 @@
#' @param ... Other optional arguments
#' @return API response ({{{returnType}}}{{^returnType}}void{{/returnType}}) with additional information such as HTTP status code, headers
#' @export
{{{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}}...) {
{{{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}}...) {
args <- list(...)
query_params <- list()
header_params <- c()
@@ -276,7 +276,9 @@
{{#bodyParams}}
if (!missing(`{{paramName}}`)) {
{{#isArray}}
body.items = paste(unlist(lapply({{paramName}}, function(param) {param$toJSONString()})), collapse = ",")
body.items <- paste(unlist(lapply({{paramName}}, function(param) {
param$toJSONString()
})), collapse = ",")
body <- paste0("[", body.items, "]")
{{/isArray}}
{{^isArray}}
@@ -407,7 +409,7 @@
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
{{#returnExceptionOnFailure}}
error_msg <- toString(content(resp))
if(error_msg == "") {
if (error_msg == "") {
error_msg <- "Api client exception encountered."
}
{{#useDefaultExceptionHandling}}
@@ -425,7 +427,7 @@
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
{{#returnExceptionOnFailure}}
error_msg <- toString(content(resp))
if(error_msg == "") {
if (error_msg == "") {
error_msg <- "Api server exception encountered."
}
{{#useDefaultExceptionHandling}}
modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache
+ 1
- 1
  • View file @ baca147b

  • Edit in single-file editor

  • Open in Web IDE


@@ -131,4 +131,4 @@
as.character(jsonlite::prettify(paste("{", jsoncontent, "}", sep = "")))
}
)
)
)
\ No newline at end of file
modules/openapi-generator/src/main/resources/r/modelEnum.mustache
+ 1
- 1
  • View file @ baca147b

  • Edit in single-file editor

  • Open in Web IDE


@@ -45,4 +45,4 @@
)
unlist(strsplit(res, ", "))
}
{{/allowableValues}}
{{/allowableValues}}
\ No newline at end of file
modules/openapi-generator/src/main/resources/r/modelGeneric.mustache
+ 6
- 15
  • View file @ baca147b

  • Edit in single-file editor

  • Open in Web IDE


{{#models}}
{{#model}}
#' @docType class
#' @title {{classname}}
#' @description {{classname}} Class
@@ -9,10 +7,6 @@
{{/vars}}
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
{{#isEnum}}
{{>modelEnum}}
{{/isEnum}}
{{^isEnum}}
#' @export
{{classname}} <- R6::R6Class(
"{{classname}}",
@@ -239,18 +233,18 @@
{{#isContainer}}
{{#isArray}}
{{#isPrimitiveType}}
paste(unlist(lapply(self$`{{{name}}}`, function(x) paste0('"', x, '"'))), collapse=",")
paste(unlist(lapply(self$`{{{name}}}`, function(x) paste0('"', x, '"'))), collapse = ",")
{{/isPrimitiveType}}
{{^isPrimitiveType}}
paste(sapply(self$`{{{name}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
paste(sapply(self$`{{{name}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
{{/isPrimitiveType}}
{{/isArray}}
{{#isMap}}
{{#isPrimitiveType}}
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x }), auto_unbox = TRUE, digits=NA)
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x }), auto_unbox = TRUE, digits = NA)
{{/isPrimitiveType}}
{{^isPrimitiveType}}
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x$toJSON() }), auto_unbox = TRUE, digits=NA)
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x$toJSON() }), auto_unbox = TRUE, digits = NA)
{{/isPrimitiveType}}
{{/isMap}}
{{/isContainer}}
@@ -259,7 +253,7 @@
{{#isBoolean}}tolower({{/isBoolean}}self$`{{name}}`{{#isBoolean}}){{/isBoolean}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
jsonlite::toJSON(self$`{{name}}`$toJSON(), auto_unbox=TRUE, digits = NA)
jsonlite::toJSON(self$`{{name}}`$toJSON(), auto_unbox = TRUE, digits = NA)
{{/isPrimitiveType}}
{{/isContainer}}
)
@@ -362,7 +356,4 @@
self$toJSONString()
}
)
)
{{/isEnum}}
{{/model}}
{{/models}}
)
\ No newline at end of file
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
Enhancement: Code Cleanup
1
Enhancement: Code Cleanup
    Assign labels
  • Manage project labels

Milestone
5.3.1
5.3.1 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!10808
Source branch: r-model-better-format

Menu

Explore Projects Groups Snippets