Closed
Description
Though json
doesn't treat namedtuple
instances as objects, simplejson
does. It would be useful to be able to validate object graphs with namedtuple
instances like dict
instances.
The main complication here is that Validator
's is_type
and DEFAULT_TYPES
and very subclass-oriented, and detecting a namedtuple
is a matter of duck-typing (hasattr(instance.__class__, '_fields')
or the less-restrictive hasattr(instance, '_asdict')
). From there I'm not quite sure where to make the change to traverse object items.
Thanks for your consideration.
Metadata
Metadata
Assignees
Labels
No labels