feat(config): basis for simplified value setting

Previously we would set static structures manully, using complex cases
and utility functions. Now we setup the foundation to allow setting
a generic `json::value::Value` instead, which can later be deserialized
into the target structure.

Related to #111
This commit is contained in:
Sebastian Thiel
2015-05-12 11:05:59 +02:00
parent a66f1ad728
commit a2dd71451d
3 changed files with 28 additions and 81 deletions

View File

@@ -55,15 +55,13 @@ ${struct};
markers = schema_markers(s, c, transitive=True)
# We always need Serialization support, as others might want to serialize the response, even though we will
# only deserialize it.
traits = ['Clone', 'Debug', 'Serialize']
# And since we don't know what others want to do, we implement Deserialize as well by default ...
traits = ['Clone', 'Debug', 'Serialize', 'Deserialize']
# default only works for structs, and 'variant' will be an enum
if 'variant' not in s:
traits.insert(0, 'Default')
if RESPONSE_MARKER_TRAIT in markers:
traits.append('Deserialize')
nt_markers = schema_markers(s, c, transitive=False)
allow_optionals = is_schema_with_optionals(nt_markers)