class Dog(Pet):
    """A representation of a dog"""
    packSize = fields.Integer(
        required=True,
        description='the size of the pack the dog is from',
        validate=[
            Range(min=0, max=None, min_inclusive=True, max_inclusive=True)
        ])
class Dog(Pet):
    """A representation of a dog"""
    packSize = fields.Integer(
        required=True,
        description='the size of the pack the dog is from',
        missing=lambda: 0,
        validate=[
            Range(min=0, max=None, exclusive_min=False, exclusive_max=False)
        ])
Example #3
0
 class Query(Schema):
     animal_type = fields.String(
         validate=[Regexp(regex=re.compile('^[a-zA-Z0-9]*$'))])
     limit = fields.Integer(missing=lambda: 100,
                            validate=[
                                Range(min=0,
                                      max=None,
                                      exclusive_min=False,
                                      exclusive_max=False)
                            ])
Example #4
0
 class Body(Schema):
     value = Date()
     addend = fields.Integer(required=True,
                             validate=[
                                 Range(min=1,
                                       max=None,
                                       exclusive_min=False,
                                       exclusive_max=False)
                             ])
     unit = fields.String(
         missing=lambda: 'days',
         validate=[OneOf(choices=['days', 'minutes'], labels=[])])
class Maximum_validation(Schema):
    n0 = fields.Number(validate=[Range(min=None, max=100, exclusive_min=False, exclusive_max=False)])
    n1 = fields.Number(validate=[Range(min=None, max=100, exclusive_min=False, exclusive_max=True)])
    n2 = fields.Number(validate=[Range(min=None, max=100, exclusive_min=False, exclusive_max=False)])
    m0 = fields.Number(validate=[Range(min=100, max=None, exclusive_min=False, exclusive_max=False)])
    m1 = fields.Number(validate=[Range(min=100, max=None, exclusive_min=True, exclusive_max=False)])
    m2 = fields.Number(validate=[Range(min=100, max=None, exclusive_min=False, exclusive_max=False)])
Example #6
0
class X(Schema):
    n0 = fields.Number(validate=[
        Range(min=None, max=100, min_inclusive=True, max_inclusive=True)
    ])
    n1 = fields.Number(validate=[
        Range(min=None, max=100, min_inclusive=True, max_inclusive=False)
    ])
    n2 = fields.Number(validate=[
        Range(min=None, max=100, min_inclusive=True, max_inclusive=True)
    ])
    m0 = fields.Number(validate=[
        Range(min=100, max=None, min_inclusive=True, max_inclusive=True)
    ])
    m1 = fields.Number(validate=[
        Range(min=100, max=None, min_inclusive=False, max_inclusive=True)
    ])
    m2 = fields.Number(validate=[
        Range(min=100, max=None, min_inclusive=True, max_inclusive=True)
    ])
Example #7
0
    def _makeOne(self, *args, **kwargs):
        from swagger_marshmallow_codegen.validate import Range

        return Range(*args, **kwargs)
Example #8
0
from swagger_marshmallow_codegen.validate import ItemsRange
from swagger_marshmallow_codegen.validate import Range
Range(min=1, max=10)
ItemsRange(min=1, max=10)