R/validate.R

Defines functions validate

Documented in validate

#' validate descriptor
#' @description Validates whether a schema is a validate Table Schema accordingly to the specifications. 
#' It does not validate data against a schema.
#' @param descriptor schema descriptor, one of:
#' \itemize{
#' \item string with the local CSV file (path)
#' \item string with the remote CSV file (url)
#' \item list object
#' }
#' @return \code{TRUE} on valid
#' @rdname validate
#' @export
#' 

# Module API

validate <- function(descriptor) {
  
  # https://github.com/frictionlessdata/tableschema-js#infer
  def <- Schema.load(descriptor)
  schema <- future::value(def)
  return(list(valid = schema$valid, errors = schema$errors))
}

Try the tableschema.r package in your browser

Any scripts or data that you put into this service are public.

tableschema.r documentation built on Sept. 30, 2022, 1:06 a.m.