RFC: Use annotations for parsing arguments
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
先查看 webargs-starlette 中的 proof of concept,然后检查 AsyncParser 和 core.Parser,以及 marshmallow Schema.TYPE_MAPPING 如何构造字段。完成标准是为相关 parser 调整基于注解的 use_annotations 方法,使请求参数能够根据视图函数的注解进行解析。
由索引模型根据 Issue 内容生成。
描述
Add a decorator that will parse request arguments from the view function's type annotations.
I've built a working proof of concept of this idea in webargs-starlette.
@app.route("/")
@use_annotations(locations=("query",))
async def index(request, name: str = "World"):
return JSONResponse({"Hello": name})
A marshmallow Schema is generated from the annotations using Schema.TYPE_MAPPING to construct fields.
The code for use_annotations mostly isn't tied to Starlette and could be adapted for AsyncParser (and core.Parser when we drop Python 2 support).
- 主要语言
- Python
- 星标
- 1.4k
- 派生
- 171
- 平均合并
- 8 小时 47 分钟
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
marshmallow-code/webargs 的其他 Issue
-
Multi-value tornado headers are fetched with `get()` rather than `get_list()`可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
marshmallow-code/webargs#1109 · 1 条评论 ·
维护者通常 1 天内回复
-
Improve Falcon parser可能已有人在做 @vytas7 于 112 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 35/100
marshmallow-code/webargs#1079 · 7 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 20/100
marshmallow-code/webargs#1046 ·
维护者通常 1 天内回复
-
docs
难度 4/5 3-5 天 新手友好度 35/100
marshmallow-code/webargs#644 · 5 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
question
难度 3/5 1-2 天 新手友好度 35/100
marshmallow-code/webargs#549 · 15 条评论 ·
维护者通常 1 天内回复
查看 marshmallow-code/webargs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
btclib-org/btclib#3062 ·
维护者通常 1 天内回复
-
area:evals area:infra enhancement
难度 2/5 1-3 小时 新手友好度 74/100
jse-avl/support-bot#4 · 1 条评论 ·
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 85/100
qte77/agentic-job-offer-to-application-kit#487 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
btclib-org/btclib-wallet#801 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 1/5 1-3 小时 新手友好度 94/100