Ordered fields for Add-Ons
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading addons/models.py and tracing how Add-On config.yaml parameters are loaded and stored, including the python-documentcloud library path mentioned in the issue. Check whether ordering is lost during JSONField storage or later serialization; done means identifying a supported way to preserve field order through to the front end.
由索引模型根据 Issue 内容生成。
描述
Disclose brought up the fact that fields aren't ordered in Add-Ons, which is something we have noted before and is a not ideal.
From my understanding, the front-end loads the JSON parameters that are pulled from addons/models.py from the originating config.yaml file for the Add-On.
Currently in our addons/models.py and in our python-documentcloud library we use the standard pyyaml (import yaml).
The YAML spec doesn't traditionally support ordering- but it also doesn't prohibit it. It gets loaded into a dict, which before Python 3.7, was unordered. Python >= 3.7, dicts maintain order.
In Python 3.7+, the dict we get from running yaml.safe_load returns a dictionary with order preserved.
https://medium.com/@reorx/tips-that-may-save-you-from-the-hell-of-pyyaml-572cde7e1d6f
This is also noted in this discussion on PyYaml's official issues here:
https://github.com/yaml/pyyaml/issues/110#issuecomment-500882817
For a sanity check, I even tested safe_load on PII detector's config.yaml file locally and confirmed that order, even within properties, was preserved:
I think the issue here is JSON not maintaining order in parameters
parameters = models.JSONField(
("parameters"),
default=dict,
help_text=("The user supplied parameters to run the add-on with"),
)
Is there some other way we could preserve order?
- 主要语言
- Python
- 星标
- 55
- 派生
- 10
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 22
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MuckRock/documentcloud 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 62/100
MuckRock/documentcloud#537 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 50/100
MuckRock/documentcloud#539 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 67/100
MuckRock/documentcloud#534 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 66/100
MuckRock/documentcloud#531 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
MuckRock/documentcloud#521 ·
维护者通常 1 天内回复
查看 MuckRock/documentcloud 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
comp/desktop P3 type/feature
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-agent#154285 ·
维护者通常 1 天内回复
-
docs: qualify copied and custom kubectl debug policy notes可能已有人在做 @nym01 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
kubescape/cel-admission-library#166 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
SACGF/variantgrid#2804 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] HTTP lifecycle dispatch treats a NO_PROXY-only environment as corporate egress and skips the resolve-and-pinned session可能已有人在做 @bodapatisaikrishna 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复