def __init__(self):
        super().__init__()

        self.args.add_formatter('skip', _formatters.PositiveInt())
        self.args.add_formatter('limit', _formatters.PositiveInt(default=10, maximum=100))
        self.args.add_formatter('refs', _formatters.JSONArray(), False)
        self.args.add_formatter('exclude', _formatters.JSONArray(), False)
Example #2
0
    def __init__(self):
        super().__init__()

        self.args.add_formatter('uids', formatters.JSONArray())
        self.args.add_formatter('exclude', formatters.JSONArray())
        self.args.add_formatter('search', formatters.Str())
        self.args.add_formatter('q', formatters.Str())  # Alias for 'search'
        self.args.add_formatter('skip', formatters.PositiveInt())
        self.args.add_formatter('limit', formatters.PositiveInt(10, 100))
Example #3
0
    def __init__(self):
        super().__init__()

        self.args.add_formatter('model', formatters.JSONArray())
        self.args.add_formatter('sort_by', formatters.Str(max_len=32))
        self.args.add_formatter('limit', formatters.PositiveInt(10, 100))
        self.args.add_formatter('entity_title_args', formatters.JSONObject())
        self.args.add_formatter('exclude', formatters.JSONArray())
        self.args.add_formatter('depth_indent', formatters.Str('-'))

        self.args.add_formatter('sort_order', formatters.Str(lower=True))
        self.args.add_formatter('sort_order', formatters.Transform(1, {'asc': 1, 'desc': -1}))
        self.args.add_formatter('sort_order', formatters.Int(1, -1, 1))
        self.args.add_formatter('sort_order', formatters.Enum(1, (-1, 1)))
Example #4
0
    def __init__(self):
        super().__init__()
        self.args.add_formatter('birth_date', formatters.DateTime())
        self.args.add_formatter('urls', formatters.JSONArray())
        self.args.add_formatter('is_public', formatters.Bool())

        self.args.add_validation('email', validation.rule.Email())
        self.args.add_validation('gender',
                                 validation.rule.Enum(values=('m', 'f')))
Example #5
0
    def __init__(self):
        super().__init__()

        self.args.add_formatter('rows', formatters.JSONArray())