drf-yasg icon indicating copy to clipboard operation
drf-yasg copied to clipboard

Support new X | Y union syntax of Python 3.10 (PEP 604)

Open intgr opened this issue 2 years ago • 5 comments

This is used, for example, when inspecting the result type of SerializerMethodField.

intgr avatar Dec 10 '21 15:12 intgr

This isn't properly tested yet, I ran out of time today. Will during the weekend or next week.

intgr avatar Dec 10 '21 15:12 intgr

@intgr Did you test it back then properly after your initial comments?

creyD avatar Jul 20 '22 05:07 creyD

Heh this is awkward. I was actually using drf-spectacular, but submitted a PR for the wrong project. So I never finished this.

I have rebased and pushed my latest changes, but the tests are still failing, so someone else should finalize this.

intgr avatar Jul 20 '22 15:07 intgr

@intgr thanks for this, it's really helpful. The remaining tasks include adding some tests for a python3.10 environment that uses the union syntax and to add the version to the tox file. I'm going to add the help wanted and first issue labels to entice some contributors.

JoelLefkowitz avatar Jul 20 '22 16:07 JoelLefkowitz

I already added some tests, but they fail when running with Python 3.10. So some additional changes are needed to the logic. I don't know where it goes wrong.

intgr avatar Jul 20 '22 16:07 intgr