authentik icon indicating copy to clipboard operation
authentik copied to clipboard

blueprints: fix for #9430

Open JamesReynolds opened this issue 1 year ago • 5 comments

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)

JamesReynolds avatar May 31 '24 11:05 JamesReynolds

Deploy Preview for authentik-storybook canceled.

Name Link
Latest commit bbf69962d28b4872fcf9b8de3a530d6f1752f926
Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/6659b06eeda1e100083fd28e

netlify[bot] avatar May 31 '24 11:05 netlify[bot]

Deploy Preview for authentik-docs canceled.

Name Link
Latest commit bbf69962d28b4872fcf9b8de3a530d6f1752f926
Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/6659b06e538dcd00082c4a8c

netlify[bot] avatar May 31 '24 11:05 netlify[bot]

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?

rissson avatar May 31 '24 15:05 rissson

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.

codecov[bot] avatar May 31 '24 15:05 codecov[bot]

@rissson thanks! I'll look into setting up tests and fix that lint error I seem to have missed. Might be Monday though...

JamesReynolds avatar May 31 '24 16:05 JamesReynolds

hi is this still on the table? I just ran into this today trying to dump my authentik blueprints.

weikinhuang avatar Dec 22 '24 23:12 weikinhuang

Hi, any updates?

IAMSolaara avatar Aug 07 '25 06:08 IAMSolaara