Beispiel #1
0
class IDynamicFields(Interface):
    fields = fields.PatchField(
        schema.Dict(
            key_type=schema.Text(),
            value_type=schema.Object(schema=IFieldType),
            required=True,
            max_length=1000,
        ))
Beispiel #2
0
class ITestSchema(Interface):

    text = schema.TextLine(required=False)
    integer = schema.Int(required=False)
    floating = schema.Float(required=False)
    list_of_text = schema.List(value_type=schema.TextLine(), required=False)
    tuple_of_text = schema.Tuple(value_type=schema.TextLine(), required=False)
    set_of_text = schema.Set(value_type=schema.TextLine(), required=False)
    frozenset_of_text = schema.FrozenSet(value_type=schema.TextLine(),
                                         required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)
    date = schema.Date(required=False)
    time = schema.Time(required=False)

    patch_list = fields.PatchField(
        schema.List(value_type=schema.Dict(key_type=schema.Text(),
                                           value_type=schema.Text()),
                    required=False))
    patch_dict = fields.PatchField(schema.Dict(key_type=schema.Text(),
                                               value_type=schema.Text()),
                                   required=False)

    bucket_list = fields.BucketListField(bucket_len=10,
                                         required=False,
                                         value_type=schema.Dict(
                                             key_type=schema.Text(),
                                             value_type=schema.Text()))

    datetime_bucket_list = fields.BucketListField(bucket_len=10,
                                                  required=False,
                                                  value_type=schema.Datetime())

    nested_patch = fields.PatchField(
        schema.Dict(required=False,
                    key_type=schema.Text(),
                    value_type=fields.PatchField(
                        schema.List(value_type=schema.Object(
                            schema=INestFieldSchema)))))
Beispiel #3
0
class ITestSchema(Interface):

    text = schema.TextLine(required=False)
    integer = schema.Int(required=False)
    floating = schema.Float(required=False)
    list_of_text = schema.List(value_type=schema.TextLine(), required=False)
    tuple_of_text = schema.Tuple(value_type=schema.TextLine(), required=False)
    set_of_text = schema.Set(value_type=schema.TextLine(), required=False)
    frozenset_of_text = schema.FrozenSet(value_type=schema.TextLine(),
                                         required=False)
    dict_value = schema.Dict(key_type=schema.TextLine(),
                             value_type=schema.TextLine(),
                             required=False)
    datetime = schema.Datetime(required=False)
    date = schema.Date(required=False)
    time = schema.Time(required=False)

    patch_list = fields.PatchField(
        schema.List(value_type=schema.Dict(key_type=schema.Text(),
                                           value_type=schema.Text()),
                    required=False))
    patch_list_int = fields.PatchField(
        schema.List(value_type=schema.Int(), required=False))
    patch_dict = fields.PatchField(schema.Dict(key_type=schema.Text(),
                                               value_type=schema.Text()),
                                   required=False)

    patch_int = fields.PatchField(schema.Int(default=22), required=False)

    patch_int_no_default = fields.PatchField(schema.Int(), required=False)

    bucket_list = fields.BucketListField(
        bucket_len=10,
        required=False,
        value_type=schema.Dict(key_type=schema.Text(),
                               value_type=schema.Text()),
    )

    datetime_bucket_list = fields.BucketListField(bucket_len=10,
                                                  required=False,
                                                  value_type=schema.Datetime())

    union_field = schema.UnionField(schema.Datetime(),
                                    schema.Int(),
                                    required=False)
    union_field_obj = schema.UnionField(schema.Object(IObjectA),
                                        schema.Object(schema=IObjectB),
                                        required=False)

    nested_patch = fields.PatchField(
        schema.Dict(
            required=False,
            key_type=schema.Text(),
            value_type=fields.PatchField(
                schema.List(value_type=schema.Object(
                    schema=INestFieldSchema))),
        ))

    dict_of_obj = schema.Dict(
        required=False,
        key_type=schema.Text(),
        value_type=schema.Object(schema=INestFieldSchema))

    patch_dict_of_obj = fields.PatchField(
        schema.Dict(required=False,
                    key_type=schema.Text(),
                    value_type=schema.Object(schema=INestFieldSchema)))

    patch_tuple = fields.PatchField(
        schema.Tuple(required=False,
                     value_type=schema.Text(schema=INestFieldSchema)))

    bucket_dict = fields.BucketDictField(bucket_len=10,
                                         required=False,
                                         key_type=schema.Text(),
                                         value_type=schema.Text())
Beispiel #4
0
class INestFieldSchema(Interface):
    foo = schema.Text(required=False)
    bar = schema.Int(required=False)
    foobar_list = schema.List(required=False, value_type=schema.Text())
    nested_int = fields.PatchField(schema.Int(required=False))
Beispiel #5
0
class IDynamicFields(Interface):
    fields = fields.PatchField(
        schema.Dict(key_type=schema.Text(),
                    value_type=schema.Object(schema=IFieldType)))