class SiCDSConfig(Schema): required = { 'superkey': t_uni, 'store': store_from_url, } optional = { 'host': str, 'port': withdefault(int, ''), 'keys': withdefault(many(t_uni), []), 'loggers': withdefault(many(logger_from_url), [StdOutLogger()]), }
class IDRequest(Schema): ''' >>> req = {"key":"some_key","contentItems":[ ... {"id":"d87fds7f6s87f6sd78fsdf","difcollections":[ ... {"name":"collection1","difs":[ ... {"type":"some-type1","value":"some-value-1"}, ... {"type":"some-type1","value":"some-value-2"} ... ] ... }, ... {"name":"collection2","difs":[ ... {"type":"some-type1","value":"some-value-1"}, ... {"type":"some-type1","value":"some-value-2"} ... ] ... }] ... }] ... } >>> req = IDRequest(req) >>> req <IDRequest ...> >>> req.key u'some_key' >>> IDRequest({'fields': 'missing'}) Traceback (most recent call last): ... RequiredField: ... ''' required = {'key': t_uni, 'contentItems': many(ContentItem, atleast=1)}
class IDResponse(Schema): required = {'key': t_uni, 'results': many(IDResult, atleast=1)}
class ContentItem(Schema): required = {'id': t_uni, 'difcollections': many(DifCollection, atleast=1)}
class DifCollection(Schema): required = {'name': t_uni, 'difs': many(Dif, atleast=1)}