Nested: Nested

NestedR Documentation

Nested

Description

Nest a Schema inside a field

Super classes

staypuft::FieldABC -> staypuft::Field -> Nested

Methods

Public methods

Inherited methods

Method new()

Create a new Nested object

Usage
Nested$new(
  nested,
  default = miss_ing,
  exclude = NULL,
  only = NULL,
  many = FALSE,
  unknown = "raise",
  ...
)
Arguments
nested

The Schema class or class name (character) to nest, or "self" to nest the Schema within itself

exclude

A list or tuple of fields to exclude

only

A list or tuple of fields to marshal. If NULL, all fields are marshalled. This parameter takes precedence over exclude.

many

Whether the field is a collection of objects.

unknown

Whether to exclude, include, or raise an error for unknown fields in the data. Use "raise", "exclude", or "include"


Method schema()

Usage
Nested$schema()

Method serialize_()

Usage
Nested$serialize_(value, nested_obj, attr = NULL, obj = NULL)

Method test_list()

Usage
Nested$test_list(self, value)

Method load_()

Usage
Nested$load_(value, data = NULL, partial = FALSE)

Method deserialize_()

Usage
Nested$deserialize_(value, attr = NULL, data = NULL, partial = FALSE)

Method clone()

The objects of this class are cloneable with this method.

Usage
Nested$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

artist_schema <- Schema$new("ArtistSchema",
  name = fields$character()
)
x <- Nested$new(artist_schema)
x
x$nested
x$deserialize_(value = list(name = 6)) # good
if (interactive()) x$deserialize_(value = list(foobar = 6)) # bad

ropensci/staypuft documentation built on Sept. 9, 2022, 4:35 p.m.