dabapps / django-rest-framework-serialization-spec

DEPRECATED, see https://github.com/dabapps/django-readers instead
MIT License
11 stars 0 forks source link

If you accidentally include the same tag twice you may get a 404 which may confuse #9

Closed pmg103 closed 4 years ago

pmg103 commented 5 years ago
    serialization_spec = [
        {'product_versions': [
            'id',
            {'product': [
                'name',
            ]},
        ]},
        {'product_versions': [
            'id',
        ]},
        # ...

Will result in this error:

'product_versions' lookup was already seen with a different queryset. You may need to adjust the ordering of your lookups.

being thrown inside this line in GenericAPIView .get_object():

        obj = get_object_or_404(queryset, **filter_kwargs)

https://github.com/encode/django-rest-framework/blob/0407a0df8a16fdac94bbd08d49143a74a88001cd/rest_framework/generics.py#L96

which will give a 404 and silently consume the exception :/

pmg103 commented 4 years ago

I think this may be resolved now because specs are merged/normalised