
Write YAML configuration file
write_config.RdThin wrapper around to_yaml() calling validate() before
converting to YAML and creating the file, ensuring that the saved configuration is valid.
Examples
# Read configuration file:
x <- S7schema(
file = system.file("examples/config.yml", package = "S7schema"),
schema = system.file("examples/schema.json", package = "S7schema")
)
print(x)
#> <S7schema::S7schema> List of 1
#> $ my_config_var: int 1
#> @ schema : chr "/home/runner/work/_temp/Library/S7schema/examples/schema.json"
#> @ validator: <S7schema::validator>
#> .. @ context:Classes 'V8', 'environment' <environment: 0x5638b789ff40>
# Edit content
x$my_config_var <- 2
# Save new file
write_config(
x = x,
file = tempfile(fileext = ".yml")
)