Learn R Programming

schemate (version 0.1.0)

schema_set_keys: Set a schema node keys rule

Description

Set a schema node keys rule

Usage

schema_set_keys(x, path = "$", ...)

Value

A modified SchemaDoc.

Arguments

x

A SchemaDoc.

path

Path to the target schema node. Use $ for the root node. Bare field segments such as $id implicitly traverse container fields. Use $fields$id to write the explicit field path. Backtick-quote field names that contain path operators, for example $`a$b` .

...

Named keys rule arguments passed through to the schema DSL.

Examples

Run this code
schema <- schema_doc(list(check = list(kind = "list")))
schema
schema_validate(schema, list(id = 1L), mode = "test")

schema <- schema_set_keys(schema, type = "named", must.include = "id")
schema
schema_validate(schema, list(id = 1L), mode = "assert")

Run the code above in your browser using DataLab