Keys starting with capitals are not transformed as described in documentation
还没有人认领这个 Issue。
评估
调研方向
未指定源文件或测试。首先针对 decoder 的键处理实现运行 Livebook reproduction,然后查找现有的 atom 键测试。当使用 keys: :atoms 转换的大写键与 String.to_atom/1 的行为一致,并且有一个覆盖 ID 的回归测试时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
The issue can be demonstrated by following Livebook (see source for copy):
TOML atoms issue
Mix.install([
{:toml, "~> 0.7.0"}
])
Section
According to the documentation:
You can pass the following options to configure the decoder behavior:
:keys- controls how keys in the document are decoded. Possible values are:
:atoms- converts keys to atoms withString.to_atom/1
So in my opinion, it should be equivalent to keys: &String.to_atom/1
toml_content = """
[foo]
name = "bar"
ID = "baz"
"""
result1 = Toml.decode!(toml_content, keys: :atoms)
%{foo: %{:name => "bar", ID => "baz"}}
Note the map key is ID, which means atom :"Elixir.ID". But when I use String.to_atom/1:
result2 = Toml.decode!(toml_content, keys: &String.to_atom/1)
%{foo: %{name: "bar", ID: "baz"}}
Note ID:, which means the key is atom :"ID". This behaviour is what I would expect after reading the documentation. The results are not equivalent, obviously.
result1 == result2
false
- 主要语言
- Elixir
- 星标
- 206
- 派生
- 33
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitwalker/toml-elixir 的其他 Issue
-
mix test fails on OTP 28 / Elixir 1.18 (ssl_verify_fun + deprecated eval_quoted)可能已有人在做 @nshkrdotcom 于 321 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
bitwalker/toml-elixir#46 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
bitwalker/toml-elixir#39 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 43/100
bitwalker/toml-elixir#38 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 42/100
bitwalker/toml-elixir#37 · 1 条评论 ·
-
When called from distillery as a provider, config isn't actually merged an instead is overrwritten for any app in the TOML config.可能已有人在做 @idyll 于 2373 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
bitwalker/toml-elixir#26 · 2 条评论 · 2 个 reaction ·
查看 bitwalker/toml-elixir 的全部 Issue
相似的 Issue
-
Heavy legs 1.12–1.17: compiler corpus goldens not regenerated for #4770可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
intellij-elixir/intellij-elixir#4782 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
hexlet-codebattle/codebattle#2376 ·
-
level 2 wocs
难度 1/5 1 小时以内 新手友好度 90/100
phravins/QuantumBilling#51 ·
-
fix(ocr): compile the Tesseract-free pipeline with Tokio runtime可能已有人在做 @Goldziher 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
carverauto/serviceradar#6898 ·
维护者通常 1 天内回复