Находки в опенсорсе: Python
1.06K subscribers
5 photos
348 links
Легкие задачки в опенсорсе из мира Python

Чат: @opensource_findings_chat
Download Telegram
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Improve `re_path` default parameter schema (#1439)


Currently we default to str as schema for all patterns in re_path. However, this is not the only thing we can do. We can also copy the pattern itself to the schema. Example:

re_path(r'^v(?P<version>\d+)/$', VersionController.as_view())  # schema: {type: string}

We can copy the pattern as well:

# re_path (?P<version>\d+)
- name: version
in: path
schema: {type: string, pattern: '^\d+$'}

This way users would have more info about what is expected.
See

django-modern-rest/dmr/openapi/generators/component_parsers.py

Lines 136 to 152 in 87a02f5

for current schema generation.


#feature #good_first_issue #help_wanted #openapi #opensource_september #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Support `SlugConverter` and `PathConverter` from Django in path parameters (#1441)


Currently we only support int and uuid converters from django:

django-modern-rest/dmr/openapi/generators/component_parsers.py

Lines 36 to 41 in 87a02f5

However, there are two more that we can support:

• path, we can add {"description": "Can contain slashes"} to the schema
• slug, we can add the pattern from SlugConverter

This needs to be tested. Probably we can also change the storage API. I am not sure how currently represent in for all possible providers. Probably we can store prepared schemas for types that exist.


#feature #good_first_issue #help_wanted #openapi #opensource_september #django_modern_rest
sent via relator