TGViewer
Находки в опенсорсе: Python Находки в опенсорсе: Python @opensource_findings_python · 1.06K subscribers
Post #205 722
🚀 New issue to wemake-services/django-modern-rest by @milssky
📝 Improving XML processing in `XMLParser` for correct validation of Pydantic models (#541)


The current implementation of XMLParser in django_test_app (and the example in the documentation) leads to massive validation errors (400 Bad Request) during automated testing via Schemathesis. The problem is caused by two factors:

1. Extra nesting (Root Element): xmltodict.parse always returns a dictionary where the data is nested in the key corresponding to the name of the root tag. Pydantic models (for example, _RequestModel) expects the data to be "flat", which is why validation crashes with the field required error for all fields, since they are wrapped in the tag name.
2. Type mismatch for empty tags: XML does not have built-in types. Empty tags () are parsed by xmltodict as None. If the Pydantic model expects str, it causes an error validation, although in the context of XML, an empty tag is often equivalent to an empty string.

Most likely, this bug ( #499 ) is related to this, but the problem may be complex.


#enhancement #help_wanted #django_modern_rest
sent via relator
More from @opensource_findings_python
  1. Sep 24, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 Flaky `test_empty_valid…
  2. Sep 24, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 `CookieJWT[A]syncAuth`…
  3. Sep 23, 2026🚀 New issue to ag2ai/faststream by @IvanKirpichnikov 📝 Feature: Implementation of the `A…
  4. Sep 22, 2026🚀 New issue to faststream-community/zMQTT by @borisalekseev 📝 Mark flaky Artemis test xf…
  5. Sep 17, 2026Помните про https://github.com/ozeranskii/httptap? Я писал о нем давно еще - > тут. Наклеп…
  6. Sep 15, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 `test_custom_union_form…
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 →