@@ -351,6 +351,11 @@ ApiClient <- R6::R6Class(
351351 return_obj < - NULL
352352 primitive_types < - c(" character" , " numeric" , " integer" , " logical" , " complex" )
353353
354+ # for deserialization, uniqueness requirements do not matter
355+ return_type < - gsub(pattern = " ^(set|array)\\ [" ,
356+ replacement = " collection\\ [" ,
357+ x = return_type)
358+
354359 # To handle the " map" type
355360 if (startsWith(return_type, " map(" )) {
356361 inner_return_type < - regmatches(return_type,
@@ -359,10 +364,10 @@ ApiClient <- R6::R6Class(
359364 self$deserializeObj (obj[[name]], inner_return_type, pkg_env)
360365 } )
361366 names(return_obj) < - names(obj)
362- } else if (startsWith(return_type, " array [" )) {
363- # To handle the " array" type
367+ } else if (startsWith(return_type, " collection [" )) {
368+ # To handle the " array" and " set " types
364369 inner_return_type < - regmatches(return_type,
365- regexec(pattern = " array \\ [(.*)\\ ]" , return_type))[[1]][2]
370+ regexec(pattern = " collection \\ [(.*)\\ ]" , return_type))[[1]][2]
366371 if (c(inner_return_type) % in% primitive_types) {
367372 return_obj < - vector(" list" , length = length(obj))
368373 if (length(obj) > 0) {
@@ -371,6 +376,9 @@ ApiClient <- R6::R6Class(
371376 }
372377 }
373378 } else {
379+ if (is.list(obj) && length(obj) == 1 && is.data.frame(obj[[1]])) {
380+ obj < - obj[[1]]
381+ }
374382 if (! is.null(nrow(obj))) {
375383 return_obj < - vector(" list" , length = nrow(obj))
376384 if (nrow(obj) > 0) {
0 commit comments