Django 序列化程序,但适用于任何 python 应用程序
Django serialisers but for any python application
我已经从开发 Django 应用程序转移到使用 'connexion' 的 Flask 应用程序。
我非常想念 Django 休息框架序列化程序。有没有我可以在不安装 Django 的情况下使用的其他东西?
谢谢
使用Marshmallow!
Django's doc 说:
The django-rest-marshmallow package provides an alternative implementation for serializers, using the python marshmallow library. It exposes the same API as the REST framework serializers, and can be used as a drop-in replacement in some use-cases.
既然你标记了你的问题 flask-restful
,我应该补充一点 flask-restful
和它的分支 flask-restplus
都是构建 REST API 和 [=44] 的好框架=] 甚至文档生成等功能。他们有自己的编组和参数解析方法。有人建议 here and there 他们转移到 Marshmallow 和基于 Marshmallow 的 webargs 来完成这些任务,但截至今天,这仍然在 TODO 列表中。
或者,您可以选择依赖 Marshmallow 生态系统。
- Marshmallow用于序列化/反序列化
- webargs (Marshmallow inside) 用于参数解析
- apispec API 文档
您仍然缺少一个很好的集成层。 flask-apispec 旨在成为这个集成层。可惜不够成熟,最近好像有点activity
编辑:flask-smorest 是 marshmallow/webargs/apispec 之上的一个额外层,它使棉花糖堆叠达到与 flask-resful/restplus 相同的水平,虽然更新而不是 stable/mature .
免责声明:marshmallow/webargs/apispec/flask-smorest 维护者。
我已经从开发 Django 应用程序转移到使用 'connexion' 的 Flask 应用程序。
我非常想念 Django 休息框架序列化程序。有没有我可以在不安装 Django 的情况下使用的其他东西?
谢谢
使用Marshmallow!
Django's doc 说:
The django-rest-marshmallow package provides an alternative implementation for serializers, using the python marshmallow library. It exposes the same API as the REST framework serializers, and can be used as a drop-in replacement in some use-cases.
既然你标记了你的问题 flask-restful
,我应该补充一点 flask-restful
和它的分支 flask-restplus
都是构建 REST API 和 [=44] 的好框架=] 甚至文档生成等功能。他们有自己的编组和参数解析方法。有人建议 here and there 他们转移到 Marshmallow 和基于 Marshmallow 的 webargs 来完成这些任务,但截至今天,这仍然在 TODO 列表中。
或者,您可以选择依赖 Marshmallow 生态系统。
- Marshmallow用于序列化/反序列化
- webargs (Marshmallow inside) 用于参数解析
- apispec API 文档
您仍然缺少一个很好的集成层。 flask-apispec 旨在成为这个集成层。可惜不够成熟,最近好像有点activity
编辑:flask-smorest 是 marshmallow/webargs/apispec 之上的一个额外层,它使棉花糖堆叠达到与 flask-resful/restplus 相同的水平,虽然更新而不是 stable/mature .
免责声明:marshmallow/webargs/apispec/flask-smorest 维护者。