【发布时间】:2019-11-22 20:47:32
【问题描述】:
什么是 OpenAPI (https://www.openapis.org/) v3 的 JSON 架构参考?
例如,如果我想将一些模式定义为 JSON,我可以这样做:
{
"$schema": "http://json-schema.org/schema#",
// rest of the document will need to conform to the referenced schema
}
如何以类似的方式引用 OpenAPI 3? 我的意思是,我可以这样写:
{
"$schema": "http://<some-url-for-openapi-v3>",
}
并且通过这种方式强制文档符合模式并允许一些高级 JSON 编辑器在编辑期间提供自动完成功能?
这个 some-url-for-openapi-v3 是什么?
v2 和 v3 的示例位于: https://github.com/OAI/OpenAPI-Specification/tree/master/examples 但是在写作的时候 v2 只有 yaml 示例,并且没有一个(json 或 yaml)有类似架构引用的东西。
有没有可能实现?
【问题讨论】:
标签: jsonschema openapi