Add a schema definition
Arguments
- x
A
SchemaDoc.- name
Definition name to add.
- value
Schema fragment using the same list syntax accepted by
schema_doc(), or a fragment produced by helpers such asschema_check(), to store in$defs.- overwrite
Logical flag indicating whether an existing definition of the same name should be replaced.
Examples
schema <- schema_doc(schema_check("string"))
schema <- schema_add_def(schema, "text", schema_check("string"))
schema
#> {
#> "$defs": {
#> "text": {
#> "check": {
#> "kind": "string"
#> }
#> }
#> },
#> "check": {
#> "kind": "string"
#> }
#> }
names(as.list(schema)$`$defs`)
#> [1] "text"