Skip to content
Julian Berman edited this page Dec 31, 2013 · 7 revisions

Keywords are what I'll call the new keys, barring a better term (they're the analog of validators in JSON Schema, but for our purposes they don't do any validation).

Here are some ideas for potential keywords:

Annotate

Purpose

Names a property in the return value.

Example

seep.deserialize(
    {"info" : {"id" : "abc123"}},
    {"properties" : {"info" : {"annotate" : "Car", {"properties" : {"id" : {"annotate" : "license"}}}},
)

Output

{"Car" : {"license" : "abc123"}}

Coerce

Purpose

Coerces a property's value into a different (Python) type upon deserialization.

Example

seep.deserialize(
    {"today" : "01/01/2013"},
    {"properties" : {"today" : {"coerce" : "ddmmyyyy"}}},
    coercions={"ddmmyyyy" : lambda date : datetime.strptime(date, "%d/%m/%y").date},
)

Output

{"today" : datetime.datetime(2013, 01, 01)}

Extract

Pulls up a value from a container.

Example

seep.deserialize(
    {"now" : 123},
    {"properties" : {"now" : {"extract" : True}}},
)

Output

123

Messages

check_refs