diff --git a/DESCRIPTION b/DESCRIPTION index 92beac2..b0b52b9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: jsonvalidate Title: Validate 'JSON' Schema -Version: 1.4.2 +Version: 1.5.0 Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), email = "rich.fitzjohn@gmail.com"), person("Rob", "Ashton", role = "aut"), @@ -29,7 +29,7 @@ Suggests: rmarkdown, testthat, withr -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) VignetteBuilder: knitr Encoding: UTF-8 diff --git a/LICENSE b/LICENSE index 824acc8..c8443a7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2016 +YEAR: 2024 COPYRIGHT HOLDER: Rich FitzJohn diff --git a/R/schema.R b/R/schema.R index 0da1b9c..eb78fe4 100644 --- a/R/schema.R +++ b/R/schema.R @@ -5,7 +5,7 @@ ##' @description Interact with JSON schemas, using them to validate ##' json strings or serialise objects to JSON safely. ##' -##' This interface supercedes [jsonvalidate::json_schema] and changes +##' This interface supersedes [jsonvalidate::json_schema] and changes ##' some default arguments. While the old interface is not going ##' away any time soon, users are encouraged to switch to this ##' interface, which is what we will develop in the future. diff --git a/R/serialise.R b/R/serialise.R index 2412351..6f8b7ff 100644 --- a/R/serialise.R +++ b/R/serialise.R @@ -5,7 +5,7 @@ ##' particular: ##' ##' * R has no scalar types so it is not clear if `1` should be -##' serialised as a number or a vector of length 1; jsonlite +##' serialised as a number or a vector of length 1; `jsonlite` ##' provides support for "automatically unboxing" such values ##' (assuming that length-1 vectors are scalars) or never unboxing ##' them unless asked to using [jsonlite::unbox] @@ -20,7 +20,7 @@ ##' ##' These issues are somewhat lessened when we have a schema because ##' we know what our target type looks like. This function attempts -##' to use the schema to guide serialsation of json safely. Currently +##' to use the schema to guide serialisation of json safely. Currently ##' it only supports detecting the appropriate treatment of length-1 ##' vectors, but we will expand functionality over time. ##' @@ -43,7 +43,7 @@ ##' schemas contained within a `oneOf` block (or similar) will not be ##' recursed into. ##' -##' @section: Warning: +##' # Warning ##' ##' Direct use of this function will be slow! If you are going to ##' serialise more than one or two objects with a single schema, you diff --git a/R/validate.R b/R/validate.R index 1e14004..a067ded 100644 --- a/R/validate.R +++ b/R/validate.R @@ -21,7 +21,7 @@ ##' scope this option if you want to quieten it within code you do ##' not control. Alternatively, setting the option ##' `jsonvalidate.no_note_imjv` to `FALSE` will print the message -##' even noninteractively. +##' even non-interactively. ##' ##' Updating the engine should be simply a case of adding `engine ##' = "ajv"` to your `json_validator` or `json_validate` @@ -80,7 +80,7 @@ ##' ##' @return A function that can be used to validate a ##' schema. Additionally, the function has two attributes assigned: -##' `v8` which is the javascript context (used internally) and +##' `v8` which is the JavaScript context (used internally) and ##' `engine`, which contains the name of the engine used. ##' ##' @export diff --git a/R/zzz.R b/R/zzz.R index d4ed60c..6155ba0 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -6,6 +6,6 @@ jsonvalidate_js <- function() { ## Via Gabor, remove NOTE about Imports while not loading R6 at load. -function() { +ignore_unused_imports <- function() { R6::R6Class } diff --git a/README.md b/README.md index 9f812a2..581ecec 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![R-CMD-check](https://github.com/ropensci/jsonvalidate/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/jsonvalidate/actions/workflows/R-CMD-check.yaml) -[![codecov.io](https://codecov.io/github/ropensci/jsonvalidate/coverage.svg?branch=master)](https://codecov.io/github/ropensci/jsonvalidate?branch=master) +[![codecov.io](https://codecov.io/github/ropensci/jsonvalidate/coverage.svg?branch=master)](https://app.codecov.io/github/ropensci/jsonvalidate?branch=master) [![](http://www.r-pkg.org/badges/version/jsonvalidate)](https://cran.r-project.org/package=jsonvalidate) diff --git a/inst/WORDLIST b/inst/WORDLIST index 0da3de8..a7f398e 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,6 +1,9 @@ +CMD +R's ajv arg codecov +deserialise imjv io js @@ -10,3 +13,4 @@ metaschema org ropensci subschema +unboxable diff --git a/man/json_schema.Rd b/man/json_schema.Rd index cea3e67..a32f864 100644 --- a/man/json_schema.Rd +++ b/man/json_schema.Rd @@ -7,7 +7,7 @@ Interact with JSON schemas, using them to validate json strings or serialise objects to JSON safely. -This interface supercedes \link{json_schema} and changes +This interface supersedes \link{json_schema} and changes some default arguments. While the old interface is not going away any time soon, users are encouraged to switch to this interface, which is what we will develop in the future. diff --git a/man/json_serialise.Rd b/man/json_serialise.Rd index 71403ec..f66ca59 100644 --- a/man/json_serialise.Rd +++ b/man/json_serialise.Rd @@ -50,7 +50,7 @@ differences between R's types and those available in JSON. In particular: \itemize{ \item R has no scalar types so it is not clear if \code{1} should be -serialised as a number or a vector of length 1; jsonlite +serialised as a number or a vector of length 1; \code{jsonlite} provides support for "automatically unboxing" such values (assuming that length-1 vectors are scalars) or never unboxing them unless asked to using \link[jsonlite:unbox]{jsonlite::unbox} @@ -66,7 +66,7 @@ balancing precision and storage. These issues are somewhat lessened when we have a schema because we know what our target type looks like. This function attempts -to use the schema to guide serialsation of json safely. Currently +to use the schema to guide serialisation of json safely. Currently it only supports detecting the appropriate treatment of length-1 vectors, but we will expand functionality over time. @@ -90,9 +90,7 @@ unboxable values will be found - at the moment we know that schemas contained within a \code{oneOf} block (or similar) will not be recursed into. } -\section{}{ - Warning: - +\section{Warning}{ Direct use of this function will be slow! If you are going to serialise more than one or two objects with a single schema, you should use the \code{serialise} method of a diff --git a/man/json_validator.Rd b/man/json_validator.Rd index 7e5e163..9c8dbb3 100644 --- a/man/json_validator.Rd +++ b/man/json_validator.Rd @@ -32,7 +32,7 @@ https://ajv.js.org/strict-mode.html for details. Only available in \value{ A function that can be used to validate a schema. Additionally, the function has two attributes assigned: -\code{v8} which is the javascript context (used internally) and +\code{v8} which is the JavaScript context (used internally) and \code{engine}, which contains the name of the engine used. } \description{ @@ -60,7 +60,7 @@ option \code{jsonvalidate.no_note_imjv} to \code{TRUE}. Consider using scope this option if you want to quieten it within code you do not control. Alternatively, setting the option \code{jsonvalidate.no_note_imjv} to \code{FALSE} will print the message -even noninteractively. +even non-interactively. Updating the engine should be simply a case of adding \code{engine = "ajv"} to your \code{json_validator} or \code{json_validate} calls, but you may see some issues when doing so. diff --git a/vignettes/jsonvalidate.Rmd b/vignettes/jsonvalidate.Rmd index 2c7c746..94c2816 100644 --- a/vignettes/jsonvalidate.Rmd +++ b/vignettes/jsonvalidate.Rmd @@ -19,13 +19,13 @@ using [V8](https://cran.r-project.org/package=V8) to do JSON schema validation in R. You need a JSON schema file; see -[json-schema.org](http://json-schema.org) for details on writing +[json-schema.org](https://json-schema.org/) for details on writing these. Often someone else has done the hard work of writing one for you, and you can just check that the JSON you are producing or consuming conforms to the schema. The examples below come from the [JSON schema -website](http://json-schema.org/learn/getting-started-step-by-step.html) +website](https://json-schema.org//learn/getting-started-step-by-step.html) They describe a JSON based product catalogue, where each product has an id, a name, a price, and an optional set of tags. A JSON