R/validation_error.R

# OmicIDX
#
#     The OmicIDX API documentation is available in three forms:  - [RapiDoc](/docs) - [OpenAPI/Swagger Interactive](/swaggerdoc) - [ReDoc (more readable in some ways)](/redoc)  
#
# The version of the OpenAPI document: 0.99.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title ValidationError
#'
#' @description ValidationError Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field loc Location list( character ) 
#'
#' @field msg Message character 
#'
#' @field type Error Type character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ValidationError <- R6::R6Class(
  'ValidationError',
  public = list(
    `loc` = NULL,
    `msg` = NULL,
    `type` = NULL,
    initialize = function(
        `loc`, `msg`, `type`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`loc`)) {
        stopifnot(is.vector(`loc`), length(`loc`) != 0)
        sapply(`loc`, function(x) stopifnot(is.character(x)))
        self$`loc` <- `loc`
      }
      if (!missing(`msg`)) {
        stopifnot(is.character(`msg`), length(`msg`) == 1)
        self$`msg` <- `msg`
      }
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
    },
    toJSON = function() {
      ValidationErrorObject <- list()
      if (!is.null(self$`loc`)) {
        ValidationErrorObject[['loc']] <-
          self$`loc`
      }
      if (!is.null(self$`msg`)) {
        ValidationErrorObject[['msg']] <-
          self$`msg`
      }
      if (!is.null(self$`type`)) {
        ValidationErrorObject[['type']] <-
          self$`type`
      }

      ValidationErrorObject
    },
    fromJSON = function(ValidationErrorJson) {
      ValidationErrorObject <- jsonlite::fromJSON(ValidationErrorJson)
      if (!is.null(ValidationErrorObject$`loc`)) {
        self$`loc` <- ApiClient$new()$deserializeObj(ValidationErrorObject$`loc`, "array[character]", loadNamespace("omicidxClientR"))
      }
      if (!is.null(ValidationErrorObject$`msg`)) {
        self$`msg` <- ValidationErrorObject$`msg`
      }
      if (!is.null(ValidationErrorObject$`type`)) {
        self$`type` <- ValidationErrorObject$`type`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`loc`)) {
        sprintf(
        '"loc":
           [%s]
        ',
        paste(unlist(lapply(self$`loc`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`msg`)) {
        sprintf(
        '"msg":
          "%s"
                ',
        self$`msg`
        )},
        if (!is.null(self$`type`)) {
        sprintf(
        '"type":
          "%s"
                ',
        self$`type`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ValidationErrorJson) {
      ValidationErrorObject <- jsonlite::fromJSON(ValidationErrorJson)
      self$`loc` <- ApiClient$new()$deserializeObj(ValidationErrorObject$`loc`, "array[character]", loadNamespace("omicidxClientR"))
      self$`msg` <- ValidationErrorObject$`msg`
      self$`type` <- ValidationErrorObject$`type`
      self
    }
  )
)
sdgamboa/omicidxClientR documentation built on Dec. 22, 2021, 11:12 p.m.