Provide a helper to fully resolve $refs in a schema
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- json, python
调研方向
首先检查被引用仓库现有的 API,以及此 issue 中的示例 schema。完整的结果应提供一种遍历 schema 的方式,将内部 $refs inline,同时避免因自引用而导致的无限展开。
由索引模型根据 Issue 内容生成。
描述
I want to generate some documentation/description (probably some input forms) from a json schema that contains $refs. Is there a way in jsonschema to retrieve a json schema with $refs resolved and inlined, so I can iterate through the schema?
So from a schema like this:
{
"definitions": {
"some_object": {
"type": "object",
"title": "My definition",
"description": "Some description",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
}
},
"properties": {
"list_of_objects": {
"type": "array",
"title": "Some stuff",
"description": "List of stuff",
"items": {"$ref": "#/definitions/some_object"}
}
}
}
I want to have this structure in my Python object (notice that the {$ref:...} section is replaced by the actual definition):
{
"definitions": {
"some_object": {
"type": "object",
"title": "My definition",
"description": "Some description",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
}
},
"properties": {
"list_of_objects": {
"type": "array",
"title": "Some stuff",
"description": "List of stuff",
"items": {
"type": "object",
"title": "My definition",
"description": "Some description",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
}
}
}
}
I am aware that with self-referencing schemas this will lead to an infinite structure, but hopefully this is feasible with reasonable limitations (eg. excluding self-refs).
- 主要语言
- Python
- 星标
- 53
- 派生
- 27
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 8
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-jsonschema/referencing 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
python-jsonschema/referencing#366 ·
-
难度 4/5 3-5 天 新手友好度 35/100
python-jsonschema/referencing#257 ·
-
难度 5/5 一周以上 新手友好度 20/100
python-jsonschema/referencing#226 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 52/100
python-jsonschema/referencing#178 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
python-jsonschema/referencing#160 · 3 条评论 · 2 个 reaction ·
查看 python-jsonschema/referencing 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·