Learn R Programming

schemate (version 0.1.0)

schema_paths: Query schema paths and matching nodes

Description

schema_paths() lists editable logical schema paths. schema_find() returns paths whose schema node satisfies a predicate.

Usage

schema_paths(x, defs = TRUE)

schema_find(x, where, defs = TRUE)

Value

A character vector of schema paths.

Arguments

x

A schema document or raw schema DSL list.

defs

Whether to include root $defs entries.

where

Predicate function with signature function(path, node).

Details

Logical paths describe fields as users see them in the validated data. Grouped fields are expanded to one path per field.

Examples

Run this code
schema <- schema_compact(schema_infer(list(
    issued = list(`date-parts` = list(list(2024L))),
    created = list(`date-parts` = list(list(2024L)))
), arrays = "rest"))
schema

schema_find(schema, schema_where_path("(^|\\$)`date-parts`\\$rest$"))
schema_find(schema, schema_where_check("int"))

Run the code above in your browser using DataLab