Remove ITERABLE type validating.#160
Remove ITERABLE type validating.#160Exahilosys wants to merge 1 commit intokeleshev:masterfrom Exahilosys:patch-1
Conversation
There's no need to automatically type check ITERABLE flavours when this can be done by the user. The reason this is needed is because, for example, the default JSON encoder accepts both tuples and lists as array types. Creating a schema with either of them will result in the validation failing if the other is passed instead.
|
Hmm, I'm not sure what you mean. Doesn't iterable accept both lists and tuples? I'm confused as to the reasoning behind the removal. |
|
Consider the following data: data = tuple(range(1))And the following schema: Validating raises the following error: schema.SchemaUnexpectedTypeError: (0,) should be instance of 'list'As All while allowing to further abstractify or even bypass such validation: Using This request arose when I tried to validate either |
There's no need to automatically type check ITERABLE flavours when this can be done by the user.
The reason this is needed is because different iterables can often be treated the same way.
For example, the default JSON encoder accepts both tuples and lists as array types.
Creating a schema with either of them will result in the validation failing if the other is passed instead.