예제 #1
0
 class Schema:
     foo = types.StringType(required=True)
     bar = types.StringType(required=True)
     baz = types.StringType(required=True)
     count = types.IntType()
     child = compound.DictType(types.StringType)
     things = compound.ListType(types.BaseType)
     when = types.DateTimeType()
     created = DynamoTimestampType()
예제 #2
0
class SchematicsFieldsModel(BaseModel):
    # base fields
    type_string = types.StringType()
    type_int = types.IntType()
    type_uuid = types.UUIDType()
    type_IPv4 = types.IPv4Type()
    type_url = types.URLType()
    type_email = types.EmailType()
    type_number = types.NumberType(int, "integer")
    type_int = types.IntType()
    type_long = types.LongType()
    type_float = types.FloatType()
    type_decimal = types.DecimalType()
    type_md5 = types.MD5Type()
    type_sha1 = types.SHA1Type()
    type_boolean = types.BooleanType()
    type_date = types.DateType()
    type_datetime = types.DateTimeType()
    type_geopoint = types.GeoPointType()
    # type_multilingualstring = types.MultilingualStringType(default_locale='localized_value')

    # compound fields
    type_list = compound.ListType(types.StringType)
    type_dict = compound.DictType(
        types.IntType)  # dict values can be only integers
    type_list_of_dict = compound.ListType(compound.DictType,
                                          compound_field=types.StringType)
    type_dict_of_list = compound.DictType(compound.ListType,
                                          compound_field=types.IntType)
    type_model = compound.ModelType(NestedModel)
    type_list_model = compound.ListType(compound.ModelType(NestedModel))

    # reference fields
    type_ref_simplemodel = ModelReferenceType(SimpleModel)
    type_ref_usermodel = ModelReferenceType(User)

    class Options:
        # namespace = 'st'
        collection = 'st'
        serialize_when_none = False
예제 #3
0
 class Schema:
     foo = types.StringType(required=True)
     bar = types.StringType(required=True)
     baz = types.StringType()
     count = types.IntType()
     child = compound.DictType(types.StringType)
예제 #4
0
class SimpleSubModel(SimpleModel):
    extra = compound.DictType(types.StringType)

    class Options:
        namespace = 'simple_sub'