TGViewer
Находки в опенсорсе: Python Находки в опенсорсе: Python @opensource_findings_python · 1.06K subscribers
Post #347 160
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Improve testing of complex type-forms (#1460)


We test quite a lot of type forms in our tests. But, we never test code like:

type UserBody = Body[User]

class MyController(...):
def post(self, parsed_body: UserBody) -> str: ...

This must define the correct component parser for Body. The same should be tested with UserBody: TypeAlias = Body[User]

For all the serializers.

One more thing: union type with ResponseSpecMetadata.

class MyController(...):
def get(self) -> Annotated[UserModel, ResponseSpecMetadata(headers={'X-Id': HeaderSpec()})] | str: ...

I think that there can be bugs in this code, see unwrap_annotation in litestar on how we can properly unwrap all annotations and get the metadata.

Please, add tests first. Then fix bugs if present. Feel free to discuss the design if needed.


#feature #help_wanted #opensource_september #django_modern_rest
sent via relator
More from @opensource_findings_python
  1. Sep 22, 2026🚀 New issue to faststream-community/zMQTT by @borisalekseev 📝 Mark flaky Artemis test xf…
  2. Sep 17, 2026Помните про https://github.com/ozeranskii/httptap? Я писал о нем давно еще - > тут. Наклеп…
  3. Sep 15, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 `test_custom_union_form…
  4. Sep 13, 2026🚀 New issue to wemake-services/django-modern-rest by @milssky 📝 Changes in benchmarking…
  5. Sep 13, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 Fix `operation_id` defa…
  6. Sep 13, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 Fix unused `security` f…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →