% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/schema-validate.R
\name{migrate_json}
\alias{migrate_json}
\alias{migrate_dependency_graph_json}
\alias{migrate_split_spec_json}
\title{Upgrade Serialized splitGraph JSON to the Current Schema Version}
\usage{
migrate_dependency_graph_json(path, out = path)

migrate_split_spec_json(path, out = path)
}
\arguments{
\item{path}{Path to the JSON file to upgrade.}

\item{out}{Path to write the upgraded file to. Defaults to \code{path}
(in-place upgrade).}
}
\value{
The output path, invisibly.
}
\description{
Read a \code{dependency_graph} or \code{split_spec} JSON file written under
an older \code{schema_version} and rewrite it at the installed version. The
round-trip fills any field introduced since the file was written with its
default (\code{NA} for missing \code{sample_data} columns), stamps the
current \code{schema_version}, and adds the \code{$schema} reference. Files
already at the current version are rewritten unchanged.
}
\examples{
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)
  migrate_dependency_graph_json(tmp)
  unlink(tmp)
}
}
