Issues with DateTime ISO fields
还没有人认领这个 Issue。
评估
调研方向
首先检查 gql/renderer_dataclasses.py 第 153–160 行附近的代码,尤其是 nullable DateTime 字段如何处理 suffix,以及何时选择 DATETIME_FIELD。使用 DateTime 结果重现 gql_run 查询,并验证生成的 dataclass 能够在不出现所报告的 TypeError 的情况下反序列化返回的 ISO 值。
由索引模型根据 Issue 内容生成。
描述
when i run gql_run and the renderer_dataclasses.py encounters a DateTime field it generates a field:
var_name: datetime = None
when I run a query that returns a datetime object I get the following error:
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 220, in _decode_generic
res = _get_type_cons(type_)(xs)
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 260, in <genexpr>
for x in xs)
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 165, in _decode_dataclass
infer_missing)
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 179, in _decode_dataclass
dt = datetime.fromtimestamp(field_value, tz=tz)
TypeError: an integer is required (got type str)
I think this is because in:
https://github.com/graphql-python/gql-next/blob/5c81e58862c8df3a335b81bb2f77a0fab2c50570/gql/renderer_dataclasses.py#L153-L160
suffix is being overwritten if the field is nullable and DATETIME_FIELD isn't being used.
- 主要语言
- Python
- 星标
- 78
- 派生
- 6
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
graphql-python/gql-next 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
graphql-python/gql-next#30 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 38/100
graphql-python/gql-next#28 ·
-
难度 5/5 一周以上 新手友好度 25/100
graphql-python/gql-next#27 ·
-
难度 3/5 1-2 天 新手友好度 35/100
graphql-python/gql-next#25 · 3 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 20/100
graphql-python/gql-next#22 · 1 条评论 ·
查看 graphql-python/gql-next 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-2 天 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 7 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
lmstudio-ai/mlx-engine#376 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
pyiron/bagofholding#166 ·