← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 10296.b.1.c.3 · 生成模型:未记录

引用定位契约组件

理解等级:中级

OpenAPI 的 $ref 用 URI 找目标对象。同文档引用只有 # 后的片段,跨文档引用再加相对或绝对路径。根文件可按路径引用子文档,子文档再引用共享参数、响应和 schema。命名和目录须清晰,还要确认下游工具能解析外部引用。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Automating API Delivery APIOps with OpenAPI》《第 08 章 API 制品的源代码阶段治理》(8.13 Reusing API objects: Multifile API definitions;来源项目 book-source,extracted/Automating API Delivery APIOps with OpenAPI/_epub-src/OEBPS/Text/chapter-8.xhtml#p242) - 结论依据:原文解释父文档、外部子文档、文档路径及 JSON Pointer 的引用关系。 - 原始内容:Using reference objects to internal components helps, but the resulting API definition file may still be quite large. To further optimize the file size, objects can be moved out of the API definition file into external fragments or child documents. The resulting multifile API definition document consists of a parent document with references to the child documents.