drf-typed-views:使用类型注释在Dango REST Framework中验证反序列化请求参数

时间:2021-04-30 14:47:47
【文件属性】:
文件名称:drf-typed-views:使用类型注释在Dango REST Framework中验证反序列化请求参数
文件大小:35KB
文件格式:ZIP
更新时间:2021-04-30 14:47:47
validation django-rest-framework annotations deserialization type Django REST框架-类型化视图 该项目扩展了以允许使用Python的类型注释来自动验证和转换视图参数。 这种模式使得代码更易于读写。 视图输入是单独声明的,而不是包含在所有包含的request对象中。 同时,您会得到更多的类型注释:它们可以代替重复的验证/消毒代码。 更多功能: 模型和模式是视图参数的兼容类型。 用它们注释您的POST / PUT函数,以自动验证传入的请求正文。 的不仅仅是类型更先进的验证: min_value / max_value换号 验证字符串格式: email , uuid和ipv4/6 ; 使用Python的本机Enum进行“选择”验证 快速示例: from rest_typed_views import typed_api_view @ typed_api_view ([ "GET" ]) def get_users ( registered_
【文件预览】:
drf-typed-views-master
----setup.py(1KB)
----.gitignore(91B)
----pypi_submit.py(89B)
----requirements.txt(381B)
----LICENSE.md(1KB)
----README.md(26KB)
----rest_typed_views()
--------__init__.py(589B)
--------param_settings.py(4KB)
--------validators()
--------params.py(4KB)
--------utils.py(3KB)
--------decorators.py(5KB)
----test_project()
--------urls.py(869B)
--------__init__.py(0B)
--------testapp()
--------wsgi.py(99B)
--------settings.py(4KB)
----manage.py(535B)

网友评论