blueprints: fix for #9430
Details
Closes #9430
This PR introduces a workaround for this issue in djano-rest-framework:
https://github.com/encode/django-rest-framework/discussions/9065
It replaces 'asdict' in dataclasses with a copied implementation that ensures that ReturnList is not constructed. This code shows the issue directly and the need to use a separate 'asdict' function:
from rest_framework.utils.serializer_helpers import ReturnList
from dataclasses import dataclass, asdict
@dataclass
class F:
x: ReturnList
asdict(F(ReturnList(serializer=None)))
Checklist
- [x] Local tests pass (
ak test authentik/) - [x] The code has been formatted (
make lint-fix)
Deploy Preview for authentik-storybook canceled.
| Name | Link |
|---|---|
| Latest commit | bbf69962d28b4872fcf9b8de3a530d6f1752f926 |
| Latest deploy log | https://app.netlify.com/sites/authentik-storybook/deploys/6659b06eeda1e100083fd28e |
Deploy Preview for authentik-docs canceled.
| Name | Link |
|---|---|
| Latest commit | bbf69962d28b4872fcf9b8de3a530d6f1752f926 |
| Latest deploy log | https://app.netlify.com/sites/authentik-docs/deploys/6659b06e538dcd00082c4a8c |
Thanks for your contribution! I'm not that familiar with this part of the codebase, so I'll let Jens offer a proper review, but could we add a testcase for this as well?
Codecov Report
:x: Patch coverage is 76.66667% with 7 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 92.61%. Comparing base (1cac149) to head (bbf6996).
:warning: Report is 4159 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| authentik/blueprints/v1/common.py | 76.66% | 7 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #9930 +/- ##
==========================================
- Coverage 92.63% 92.61% -0.02%
==========================================
Files 710 710
Lines 34767 34794 +27
==========================================
+ Hits 32205 32225 +20
- Misses 2562 2569 +7
| Flag | Coverage Δ | |
|---|---|---|
| e2e | 49.63% <16.66%> (-0.04%) |
:arrow_down: |
| integration | 25.49% <16.66%> (-0.02%) |
:arrow_down: |
| unit | 90.08% <76.66%> (-0.02%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@rissson thanks! I'll look into setting up tests and fix that lint error I seem to have missed. Might be Monday though...
hi is this still on the table? I just ran into this today trying to dump my authentik blueprints.
Hi, any updates?