estebistec / drf-compound-fields

Django-REST-framework serializer fields for compound types.
BSD 3-Clause "New" or "Revised" License
92 stars 12 forks source link

Fix ListOrItemField serializer validation #16

Closed estebistec closed 10 years ago

estebistec commented 10 years ago

This is a proposed fix for the issue reported in #15.

In ListOrItemField, implement initialize and field_from_native to ensure embedded serializers are validated

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.24%) when pulling 178e224e63ab2d73f90c9bdc296be4a0974f735a on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

kevin-brown commented 10 years ago

In the original ListOrItemField.from_native, data is being passed through if there is no item field and the data is a single value. This is no longer the case with ListOrItemField.field_from_native, and the original data is lost in the process. Maybe we should be calling super for that case?

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-2.0%) when pulling 601dda70eb5e55d54a9fdb5e2449305ea936a5ad on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-4.89%) when pulling 02ccdd62f1466bf6f898d5613df4cfc8798b81aa on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-4.89%) when pulling 7170ba35227a972f4a9c8c43f8b1d042f62d90aa on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

estebistec commented 10 years ago

I believe this is all of the changes I'm going to make here, and that it fixes #18 as well. I'll give this another day and if you hear no objections I'll merge it down. I'm feeling like the fields are much better normalized on the intended uses for validate and run_validators.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-4.73%) when pulling 896da5182e9ffd29824f40c61fcb9589f86ae01c on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-5.31%) when pulling 2a7030ea99f0af388eb3408835826195f989968c on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-5.31%) when pulling 05e0b9cad1a3473f307c294ff720ec7a4278c5ac on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

kevin-brown commented 10 years ago

Do you know if the tests from https://github.com/estebistec/drf-compound-fields/pull/18 pass when using this branch?

We should probably migrate them over if they do, so we don't need to worry about regressions.

estebistec commented 10 years ago

yes, I added all three of those tests to this branch already.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-5.31%) when pulling cef5af9cd676d9302db52ead26fa93f6ae143dd2 on list-or-item-validation into 90dbd2b7efada05ddb077d286c1eb7c49293849a on master.

estebistec commented 10 years ago

will be merging and releasing a version in a short while

estebistec commented 10 years ago

Merged locally with a rebase. GitHub would probably show it if I pushed the rebase, but I'm not a fan of re-writing shared branched. Closing.

estebistec commented 10 years ago

Fixed released in 0.2.2: https://pypi.python.org/pypi/drf-compound-fields/0.2.2