Set or replace a container rest schema
Arguments
- x
A
SchemaDoc.- field
Schema fragment using the same list syntax accepted by
schema_doc(), or a fragment produced by helpers such asschema_check(), to store as therestschema.- path
Path to the target container node. Use
$for the root node. Bare field segments such as$idimplicitly traverse containerfields. Use$fields$idto write the explicit field path. Backtick-quote field names that contain path operators, for example$`a$b`.
Examples
schema <- schema_doc(list(
check = list(kind = "list"),
keys = list(type = "unnamed")
))
schema <- schema_set_rest(schema, schema_check("string"))
schema
#> {
#> "check": {
#> "kind": "list"
#> },
#> "keys": {
#> "type": "unnamed"
#> },
#> "rest": {
#> "check": {
#> "kind": "string"
#> }
#> }
#> }
schema_validate(schema, list("a", "b"), mode = "test")
#> [1] TRUE