Converts a configuration schema to JSON format for external use.
Arguments
- schema
Schema created with
create_config_schema()- pretty
Whether to pretty-print the JSON (default: TRUE)
Examples
schema <- create_config_schema(
title = "My Model",
properties = list(
n_samples = schema_integer(default = 100L)
)
)
json <- schema_to_json(schema)
cat(json)
#> {
#> "$schema": "http://json-schema.org/draft-07/schema#",
#> "type": "object",
#> "title": "My Model",
#> "properties": {
#> "n_samples": {
#> "type": "integer",
#> "default": 100
#> }
#> },
#> "additionalProperties": true
#> }