Keep $ref dereference when writing the update files
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript
调研方向
Start by reviewing openapi-format's current dereference, formatting, and file-writing flow, then read the linked json-refs example for resolveRefs and updateRefs. Done should mean formatted OpenAPI documents preserve their $ref values and propagate changes back to the referenced files.
由索引模型根据 Issue 内容生成。
描述
Currently, openapi-format dereferences the OpenAPI documents to do its formatting, sorting, ... and write a dereferenced result.
Investigate the option to leverage: https://www.npmjs.com/package/json-refs to format the OpenAPI documents and update the $ref values in different files.
const jsonRefs = require('json-refs');
const json = {
"foo": {
"$ref": "#/bar"
},
"bar": {
"baz": "qux"
}
};
const options = {
filter: ['relative', 'remote'],
loaderOptions: {
processContent: (res, callback) => callback(undefined, res.text)
}
};
jsonRefs.resolveRefs(json, options).then(
(results) => {
// make changes to the resolved object
results.resolved.bar.baz = "newValue";
// write the changes to the $ref locations
jsonRefs.updateRefs(results.refs, results.resolved).then(
(updated) => console.log(updated),
(err) => console.log(err)
);
},
(err) => console.log(err)
);
- 主要语言
- JavaScript
- 星标
- 177
- 派生
- 30
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
thim81/openapi-format 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
thim81/openapi-format#238 · 1 条评论 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 76/100
thim81/openapi-format#239 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 25/100
thim81/openapi-format#237 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 35/100
thim81/openapi-format#232 · 3 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
thim81/openapi-format#196 · 3 条评论 ·
查看 thim81/openapi-format 的全部 Issue
相似的 Issue
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
stac-utils/stac-fields#42 ·
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
channels:add check:passed
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 2 天内回复