Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,15 @@
self$`{{name}}`
{{/isPrimitiveType}}
{{^isPrimitiveType}}
lapply(self$`{{name}}`, function(x) x$toSimpleType())
self$extractSimpleType(self$`{{name}}`)
{{/isPrimitiveType}}
{{/isArray}}
{{#isMap}}
{{#isPrimitiveType}}
self$`{{name}}`
{{/isPrimitiveType}}
{{^isPrimitiveType}}
lapply(self$`{{name}}`, function(x) x$toSimpleType())
self$extractSimpleType(self$`{{name}}`)
{{/isPrimitiveType}}
{{/isMap}}
{{/isContainer}}
Expand All @@ -259,7 +259,7 @@
self$`{{name}}`
{{/isPrimitiveType}}
{{^isPrimitiveType}}
self$`{{name}}`$toSimpleType()
self$extractSimpleType(self$`{{name}}`)
{{/isPrimitiveType}}
{{/isContainer}}
}
Expand All @@ -273,6 +273,29 @@
return({{classname}}Object)
},

extractSimpleType = function(x) {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of {{{classname}}}
#'
Expand Down
23 changes: 23 additions & 0 deletions samples/client/echo_api/r/R/bird.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,29 @@ Bird <- R6::R6Class(
return(BirdObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of Bird
#'
Expand Down
23 changes: 23 additions & 0 deletions samples/client/echo_api/r/R/category.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,29 @@ Category <- R6::R6Class(
return(CategoryObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of Category
#'
Expand Down
23 changes: 23 additions & 0 deletions samples/client/echo_api/r/R/data_query.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,29 @@ DataQuery <- R6::R6Class(
return(DataQueryObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of DataQuery
#'
Expand Down
25 changes: 24 additions & 1 deletion samples/client/echo_api/r/R/default_value.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ DefaultValue <- R6::R6Class(
DefaultValueObject <- list()
if (!is.null(self$`array_string_enum_ref_default`)) {
DefaultValueObject[["array_string_enum_ref_default"]] <-
lapply(self$`array_string_enum_ref_default`, function(x) x$toSimpleType())
self$extractSimpleType(self$`array_string_enum_ref_default`)
}
if (!is.null(self$`array_string_enum_default`)) {
DefaultValueObject[["array_string_enum_default"]] <-
Expand Down Expand Up @@ -152,6 +152,29 @@ DefaultValue <- R6::R6Class(
return(DefaultValueObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of DefaultValue
#'
Expand Down
23 changes: 23 additions & 0 deletions samples/client/echo_api/r/R/number_properties_only.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,29 @@ NumberPropertiesOnly <- R6::R6Class(
return(NumberPropertiesOnlyObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of NumberPropertiesOnly
#'
Expand Down
27 changes: 25 additions & 2 deletions samples/client/echo_api/r/R/pet.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ Pet <- R6::R6Class(
}
if (!is.null(self$`category`)) {
PetObject[["category"]] <-
self$`category`$toSimpleType()
self$extractSimpleType(self$`category`)
}
if (!is.null(self$`photoUrls`)) {
PetObject[["photoUrls"]] <-
self$`photoUrls`
}
if (!is.null(self$`tags`)) {
PetObject[["tags"]] <-
lapply(self$`tags`, function(x) x$toSimpleType())
self$extractSimpleType(self$`tags`)
}
if (!is.null(self$`status`)) {
PetObject[["status"]] <-
Expand All @@ -132,6 +132,29 @@ Pet <- R6::R6Class(
return(PetObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of Pet
#'
Expand Down
23 changes: 23 additions & 0 deletions samples/client/echo_api/r/R/query.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,29 @@ Query <- R6::R6Class(
return(QueryObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of Query
#'
Expand Down
23 changes: 23 additions & 0 deletions samples/client/echo_api/r/R/tag.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,29 @@ Tag <- R6::R6Class(
return(TagObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of Tag
#'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class(
return(TestFormObjectMultipartRequestMarkerObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of TestFormObjectMultipartRequestMarker
#'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas
return(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject)
},

extractSimpleType = function(x) {
if (R6::is.R6(x)) {
return(x$toSimpleType())
} else if (!self$hasNestedR6(x)) {
return(x)
}
lapply(x, self$extractSimpleType)
},

hasNestedR6 = function(x) {
if (R6::is.R6(x)) {
return(TRUE)
}
if (is.list(x)) {
for (item in x) {
if (self$hasNestedR6(item)) {
return(TRUE)
}
}
}
FALSE
},

#' @description
#' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
Expand Down
Loading
Loading