astrosat / django-astrosat-core

Common backend library for Astrosat projects' core functionality
GNU General Public License v3.0
0 stars 0 forks source link

feat(backend): added swagger_fake decorator #44

Closed allynt closed 3 years ago

allynt commented 3 years ago

Added a decorator that can be applied to views to prevent swagger errors during schema generation.

Certain views rely on logged-in users and/or actual kwargs being passed to the views; those aren't provided during swagger schema generation and so errors will occur.

There is already code in several apps to stop further processing in those views (as per https://github.com/axnsan12/drf-yasg/issues/333#issuecomment-474883875). But doing it via a central decorator will remove loads of code duplication.

allynt commented 3 years ago

There are bits like this

https://github.com/astrosat/django-astrosat-users/blob/0d86fb431947cbc660953afa37cc3b138c487867/astrosat_users/views/views_customers.py#L51-L65

scattered throughout loads of our code. They will all be able to be removed by using this decorator.