Skip to content

Get error when I set fields as tuples instead of lists #271

Description

@theosotr

I have the following piece of code.

from cerberus import Validator


schema = {
    'my_field': {
        'type': 'list',
        'schema': {'type': 'string'}
    }
}

validator = Validator(schema)

data = {'my_field': ('foo', 'bar')}

validator.validate(data)

I get the following exception:
TypeError: 'tuple' object does not support item assignment

When I set my_field as list works fine. However, I would like cerberus to support tuple objects as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions