Hello,

I've been investigating usage of Colander for validating our JSON API,
but found the following issue — I can't express the optional fields
with colander schemas. What I mean is:

 - I need to validate some mapping.
 - Mapping may have or may not have X key.
 - If it has X — it should be validated according schema.
 - If it hasn't X — we just don't bother and not provide any default instead.

I propose the addition of ``optional`` attribute to SchemaNode class,
that attribute will indicate how to process node from container's
point of view, for example Mapping type should not bother about such
nodes in case values for them are not exist.

I've attached small patch with test case to this mail, but cosider it
just proof of concept for my idea.

-- 
Andrey Popp

phone: +7 985 201 15 73
e-mail: 8may...@gmail.com

Attachment: optional_schema_node.patch
Description: Binary data

_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to