mapry

Serialize and deserialize object graphs from/to JSONables.

class mapry.Array(values, minimum_size=None, maximum_size=None)

Represent a type of arrays.

class mapry.Boolean

Represent booleans.

class mapry.Class(name, plural, description, ref, id_pattern=None)

Represent a mapry class.

class mapry.Cpp

List settings for the generation of the C++ code.

class mapry.Date(fmt=None)

Represent a type of dates.

class mapry.Datetime(fmt=None)

Represent a type of time points.

class mapry.Duration

Represent a type of durations (ISO 8601 formatted).

class mapry.Embed(name, description, ref)

Represent an embeddable structure.

class mapry.Float(minimum=None, exclusive_minimum=False, maximum=None, exclusive_maximum=False)

Represent a type of floating-point numbers.

class mapry.Go

List settings for the generation of the Go code.

class mapry.Graph

Represent an object graph.

class mapry.Integer(minimum=None, exclusive_minimum=False, maximum=None, exclusive_maximum=False)

Represent a type of integer numbers.

class mapry.Map(values)

Represent a type of mappings string -> mapry value.

class mapry.Path(pattern=None)

Represent a type of paths in the file system.

class mapry.Property(ref, name, a_type, description, json, optional, composite)

Represent a property of a composite structure.

class mapry.Py

List settings for the generation of the Python code.

class mapry.Schema(graph, cpp, go, py)

Represent a schema of an object graph.

class mapry.String(pattern=None)

Represent a type of strings.

class mapry.Time(fmt=None)

Represent a type of times of the day.

class mapry.TimeZone

Represent a type of time zones (according to the IANA identifier).

class mapry.Type

Represent a type of mapry values.

mapry.iterate_over_types(graph)

Iterate over all the value types defined in a graph.

This includes the value types of arrays and maps as well as types of properties of classes and embeddable structures.

Parameters

graph (Graph) – mapry definition of the object graph

Return type

Iterable[Tuple[Type, str]]

Returns

iteration over the mapry type definitions and their reference paths

mapry.needs_type(a_type, query)

Search query recursively starting with a_type.

The search first checks if a_type is equal query. Otherwise, the search continues through value types, if it is an aggregated type (such as array or map) or through types of its properties, if it is a composite type (such as graph, embeddable structure or class).

Parameters
  • a_type (Type) – type to inspect

  • query (Type[Type]) – type to search for

Return type

bool

Returns

True if query found recursively in a_type

mapry.references(a_type)

Inspect recursively which classes are referenced by a_type.

Parameters

a_type (Union[Class, Embed]) – class or embeddable structure to inspect

Return type

List[Class]

Returns

list of referenced classes