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
  • !12638

[R] Add documentations to oneOf, anyOf

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged William Cheng requested to merge r-doc into master 3 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 27
  • Add documentations to oneOf, anyOf

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.0.1) (patch release), 6.1.x (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.

cc @Ramanth (2019/07) @saigiridhar21 (2019/07)

Compare
  • master (base)

and
  • latest version
    cdc174c8
    1 commit, 2 years ago

27 files
+ 311
- 151

    Preferences

    File browser
    Compare changes
modules/openapi-‎generator/…/…/…/r‎
modelAnyO‎f.mustache‎ +36 -2
modelOneO‎f.mustache‎ +37 -4
partial_hea‎der.mustache‎ +8 -7
samples/clie‎nt/petstore/R‎
‎R‎
allof_tag_ap‎i_response.R‎ +7 -6
anim‎al.R‎ +7 -6
any_of‎_pig.R‎ +43 -8
api_cl‎ient.R‎ +7 -6
basque‎_pig.R‎ +7 -6
ca‎t.R‎ +7 -6
cat_al‎l_of.R‎ +7 -6
categ‎ory.R‎ +7 -6
danish‎_pig.R‎ +7 -6
do‎g.R‎ +7 -6
dog_al‎l_of.R‎ +7 -6
fake_‎api.R‎ +7 -6
model_api_‎response.R‎ +7 -6
ord‎er.R‎ +7 -6
pe‎t.R‎ +7 -6
pet_‎api.R‎ +7 -6
pi‎g.R‎ +44 -10
store‎_api.R‎ +7 -6
ta‎g.R‎ +7 -6
update_pet‎_request.R‎ +7 -6
use‎r.R‎ +7 -6
user_‎api.R‎ +7 -6
build_and‎_test.bash‎ +1 -0
.giti‎gnore‎ +2 -0
modules/openapi-generator/src/main/resources/r/modelAnyOf.mustache
+ 36
- 2
  • View file @ cdc174c8

  • Edit in single-file editor

  • Open in Web IDE


@@ -11,14 +11,31 @@
{{classname}} <- R6::R6Class(
'{{classname}}',
public = list(
#' @field actual_instance the object stored in this instance.
actual_instance = NULL,
#' @field actual_type the type of the object stored in this instance.
actual_type = NULL,
#' @field any_of a list of object types defined in the anyOf schema.
any_of = list({{#anyOf}}"{{{.}}}"{{^-last}}, {{/-last}}{{/anyOf}}),
#' Initialize a new {{{classname}}}.
#'
#' @description
#' Initialize a new {{{classname}}}.
#'
#' @export
#' @md
initialize = function(
{{#requiredVars}}`{{baseName}}`, {{/requiredVars}}{{#optionalVars}}`{{baseName}}`={{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}...
) {
local_optional_var <- list(...)
},
#' Deserialize JSON string into an instance of {{{classname}}}.
#'
#' @description
#' Deserialize JSON string into an instance of {{{classname}}}.
#'
#' @param input The input JSON.
#' @return An instance of {{{classname}}}.
#' @export
#' @md
fromJSON = function(input) {
error_messages <- list()
@@ -41,6 +58,14 @@
# no match
stop(paste("No match found when deserializing the payload into {{{classname}}} with anyOf schemas {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. Details: ", paste(error_messages, collapse = ', ')))
},
#' Serialize {{{classname}}} to JSON string.
#'
#' @description
#' Serialize {{{classname}}} to JSON string.
#'
#' @return JSON string reprenation of the {{{classname}}}.
#' @export
#' @md
toJSON = function() {
if (!is.null(self$actual_instance)) {
self$actual_instance$toJSONString()
@@ -48,6 +73,15 @@
NULL
}
},
#' Validate the input JSON with respect to {{{classname}}}.
#'
#' @description
#' Validate the input JSON with respect to {{{classname}}} and
#' throw exception if invalid.
#'
#' @param input The input JSON.
#' @export
#' @md
validateJSON = function(input) {
# backup current values
actual_instance_bak <- self$actual_instance
modules/openapi-generator/src/main/resources/r/modelOneOf.mustache
+ 37
- 4
  • View file @ cdc174c8

  • Edit in single-file editor

  • Open in Web IDE


@@ -11,14 +11,30 @@
{{classname}} <- R6::R6Class(
'{{classname}}',
public = list(
#' @field actual_instance the object stored in this instance.
actual_instance = NULL,
#' @field actual_type the type of the object stored in this instance.
actual_type = NULL,
#' @field one_of a list of object types defined in the oneOf schema.
one_of = list({{#oneOf}}"{{{.}}}"{{^-last}}, {{/-last}}{{/oneOf}}),
initialize = function(
{{#requiredVars}}`{{baseName}}`, {{/requiredVars}}{{#optionalVars}}`{{baseName}}`={{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}...
) {
local_optional_var <- list(...)
#' Initialize a new {{{classname}}}.
#'
#' @description
#' Initialize a new {{{classname}}}.
#'
#' @export
#' @md
initialize = function() {
},
#' Deserialize JSON string into an instance of {{{classname}}}.
#'
#' @description
#' Deserialize JSON string into an instance of {{{classname}}}.
#'
#' @param input The input JSON.
#' @return An instance of {{{classname}}}.
#' @export
#' @md
fromJSON = function(input) {
matched <- 0 # match counter
matched_schemas <- list() #names of matched schemas
@@ -56,6 +72,14 @@
self
},
#' Serialize {{{classname}}} to JSON string.
#'
#' @description
#' Serialize {{{classname}}} to JSON string.
#'
#' @return JSON string reprenation of the {{{classname}}}.
#' @export
#' @md
toJSON = function() {
if (!is.null(self$actual_instance)) {
self$actual_instance$toJSONString()
@@ -63,6 +87,15 @@
NULL
}
},
#' Validate the input JSON with respect to {{{classname}}}.
#'
#' @description
#' Validate the input JSON with respect to {{{classname}}} and
#' throw exception if invalid.
#'
#' @param input The input JSON.
#' @export
#' @md
validateJSON = function(input) {
# backup current values
actual_instance_bak <- self$actual_instance
modules/openapi-generator/src/main/resources/r/partial_header.mustache
+ 8
- 7
  • View file @ cdc174c8

  • Edit in single-file editor

  • Open in Web IDE

{{#appName}}
# {{{.}}}
#
#' {{{.}}}
#'
{{/appName}}
{{#appDescription}}
# {{{.}}}
#
#' {{{.}}}
#'
{{/appDescription}}
{{#version}}
# The version of the OpenAPI document: {{{.}}}
#' The version of the OpenAPI document: {{{.}}}
{{/version}}
{{#infoEmail}}
# Contact: {{{.}}}
#' Contact: {{{.}}}
{{/infoEmail}}
# Generated by: https://openapi-generator.tech
#' Generated by: https://openapi-generator.tech
#'
samples/client/petstore/R/R/allof_tag_api_response.R
+ 7
- 6
  • View file @ cdc174c8

  • Edit in single-file editor

  • Open in Web IDE


# 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
#' 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 AllofTagApiResponse
samples/client/petstore/R/R/animal.R
+ 7
- 6
  • View file @ cdc174c8

  • Edit in single-file editor

  • Open in Web IDE


# 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
#' 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 Animal
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
5.2.1
5.2.1 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!10146
Source branch: r-doc

Menu

Explore Projects Groups Snippets