Nested | R Documentation |
Nest a Schema inside a field
staypuft::FieldABC
-> staypuft::Field
-> Nested
new()
Create a new Nested object
Nested$new( nested, default = miss_ing, exclude = NULL, only = NULL, many = FALSE, unknown = "raise", ... )
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"
schema()
Nested$schema()
serialize_()
Nested$serialize_(value, nested_obj, attr = NULL, obj = NULL)
test_list()
Nested$test_list(self, value)
load_()
Nested$load_(value, data = NULL, partial = FALSE)
deserialize_()
Nested$deserialize_(value, attr = NULL, data = NULL, partial = FALSE)
clone()
The objects of this class are cloneable with this method.
Nested$clone(deep = FALSE)
deep
Whether to make a deep clone.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.