Skip to contents

Parses declarative IR text safely via yaml::yaml.load() or jsonlite::fromJSON() (never evaluating R expressions) and normalizes it into a typed spec_ir object.

Usage

parse_spec_text(
  text,
  format = c("yaml", "json"),
  validate = TRUE,
  auto_migrate = FALSE
)

Arguments

text

Character scalar containing YAML or JSON text.

format

One of "yaml" or "json".

validate

Logical; if TRUE (default), validates the parsed IR.

auto_migrate

Logical; if TRUE, automatically migrates legacy IR versions via migrate_spec_ir(). Defaults to FALSE.

Value

A spec_ir object.

Examples

spec <- new_spec_ir()
txt <- as_spec_yaml(spec)
spec2 <- parse_spec_text(txt, format = "yaml")