| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/lockfile-validate.R |
| 3 |
\name{lockfile_validate} |
| 4 |
\alias{lockfile_validate} |
| 5 |
\title{Validate an renv lockfile against a schema} |
| 6 |
\usage{ |
| 7 |
lockfile_validate( |
| 8 |
project = NULL, |
| 9 |
lockfile = NULL, |
| 10 |
schema = NULL, |
| 11 |
greedy = FALSE, |
| 12 |
error = FALSE, |
| 13 |
verbose = FALSE, |
| 14 |
strict = FALSE |
| 15 |
) |
| 16 |
} |
| 17 |
\arguments{ |
| 18 |
\item{project}{The project directory. If \code{NULL}, then the active project will |
| 19 |
be used. If no project is currently active, then the current working |
| 20 |
directory is used instead.} |
| 21 |
|
| 22 |
\item{lockfile}{Contents of the lockfile, or a filename containing one. |
| 23 |
If not provided, it defaults to the project's lockfile.} |
| 24 |
|
| 25 |
\item{schema}{Contents of a renv schema, or a filename containing a schema. |
| 26 |
If not provided, renv's default schema is used.} |
| 27 |
|
| 28 |
\item{greedy}{Boolean. Continue after first error?} |
| 29 |
|
| 30 |
\item{error}{Boolean. Throw an error on parse failure?} |
| 31 |
|
| 32 |
\item{verbose}{Boolean. If \code{TRUE}, then an attribute \code{errors} will list |
| 33 |
validation failures as a \code{data.frame}.} |
| 34 |
|
| 35 |
\item{strict}{Boolean. Set whether the schema should be parsed strictly or |
| 36 |
not. If in strict mode schemas will error to "prevent any unexpected |
| 37 |
behaviours or silently ignored mistakes in user schema". For example it |
| 38 |
will error if encounters unknown formats or unknown keywords. See |
| 39 |
https://ajv.js.org/strict-mode.html for details.} |
| 40 |
} |
| 41 |
\value{ |
| 42 |
Boolean. \code{TRUE} if validation passes. \code{FALSE} if validation fails. |
| 43 |
} |
| 44 |
\description{ |
| 45 |
\code{renv::lockfile_validate()} can be used to validate your \code{renv.lock} |
| 46 |
against a default or custom schema. It can be used to automate checks, |
| 47 |
check for obvious errors, and ensure that any custom fields you add fit |
| 48 |
your specific needs. |
| 49 |
} |
| 50 |
\details{ |
| 51 |
See the \href{https://json-schema.org/}{JSON Schema docs} for more information |
| 52 |
on JSON schemas, their use in validation, and how to write your own schema. |
| 53 |
|
| 54 |
\code{renv::lockfile_validate()} wraps ROpenSci's |
| 55 |
\href{https://docs.ropensci.org/jsonvalidate/}{\code{jsonvalidate}} package, passing |
| 56 |
many of its parameters to that package's \code{json_validate()} function. Use |
| 57 |
\code{?jsonvalidate::json_validate} for more information. |
| 58 |
} |
| 59 |
\examples{ |
| 60 |
\dontrun{ |
| 61 |
|
| 62 |
# validate the project's lockfile |
| 63 |
renv::lockfile_validate() |
| 64 |
|
| 65 |
# validate the project's lockfile using a non-default schema |
| 66 |
renv::lockfile_validate(schema = "/path/to/your/custom/schema.json") |
| 67 |
|
| 68 |
# validate a lockfile using its path |
| 69 |
renv::lockfile_validate(lockfile = "/path/to/your/renv.lock") |
| 70 |
} |
| 71 |
|
| 72 |
} |
| 73 |
\keyword{internal} |