| validate_json | R Documentation |
Check that a JSON file written by write_dependency_graph() or
write_split_spec() conforms to the splitGraph on-disk contract. The
formal JSON Schemas (Draft 2020-12) ship in inst/schema/ and are
referenced from the written JSON via the $schema key; these functions
apply a dependency-free structural check of the same invariants (required
fields, value types, node/edge-type enumerations, and referential integrity
of edge endpoints) so a handoff file can be validated without a JSON Schema
engine.
validate_graph_json(path)
validate_split_spec_json(path)
path |
Path to a serialized |
A splitgraph_json_report: a list with valid (logical),
issues (character vector of failures), the detected
object_type, and the schema $id.
if (requireNamespace("jsonlite", quietly = TRUE)) {
meta <- data.frame(sample_id = c("S1", "S2"), subject_id = c("P1", "P2"))
g <- graph_from_metadata(meta)
tmp <- tempfile(fileext = ".json")
write_dependency_graph(g, tmp)
validate_graph_json(tmp)
unlink(tmp)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.