JSON 使用 raml2html 时架构引用 ($ref) 未扩展
JSON schema reference ($ref) not expanded when using raml2html
我正在使用 raml2html 从 JSON 模式生成 HTML 页面。但是我的 JSON 模式中使用的模式引用 ($ref) 没有按预期扩展,我不确定为什么。
我已按照 raml-jsonschema-expander 的说明操作,raml2html 用于扩展引用的工具。
我的引用 JSON 架构:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://raw.github.com/path/to/balances.json#",
...
...
"$ref": "balance.json#"
...
我引用的 JSON 架构 balance.json
,托管在 GitHub:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://raw.github.com/path/to/balance.json#",
...
问题似乎出在 GitHub 提供内容的方式,如 this SO question 中所述。
我最终在该存储库中设置了一个 gh-pages
分支,并将 JSON 架构文件存储在该分支中。现在引用的模式已正确获取和呈现。
我正在使用 raml2html 从 JSON 模式生成 HTML 页面。但是我的 JSON 模式中使用的模式引用 ($ref) 没有按预期扩展,我不确定为什么。
我已按照 raml-jsonschema-expander 的说明操作,raml2html 用于扩展引用的工具。
我的引用 JSON 架构:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://raw.github.com/path/to/balances.json#",
...
...
"$ref": "balance.json#"
...
我引用的 JSON 架构 balance.json
,托管在 GitHub:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://raw.github.com/path/to/balance.json#",
...
问题似乎出在 GitHub 提供内容的方式,如 this SO question 中所述。
我最终在该存储库中设置了一个 gh-pages
分支,并将 JSON 架构文件存储在该分支中。现在引用的模式已正确获取和呈现。