在 Abap 中对 json 模式使用 $ref
Using $ref for jsonschema in Abao
有人可以帮助解决 abao 中的模式引用吗?如何使用 --schemas 选项?这是简单的要点 https://gist.github.com/SeanSilke/e5a2f7673ad4aa2aa43ba800c9aec31b
我尝试 运行 "abao api.raml --schemas fref.json" 但出现错误“Missing/unresolved JSON schema $refs (fref.json) in schema”。
顺便说一句,服务器被 osprey-mock-service 模拟了。
您需要将 id 字段添加到您的 JSON 架构中。
运行 使用:abao api.raml --server http://localhost:3000 --schemas=./*.json
示例文件:
api.raml
#%RAML 0.8
title: simple API
baseUri: http://localhost:3000
/song:
get:
responses:
200:
body:
application/json:
schema: !include schema.json
example: |
{
"songId": "e29b",
"songTitle": "The song",
"albumId": "18310"
}
fref.json
{
"id": "fref.json",
"type": "string"
}
schema.json
{
"$schema": "http://json-schema.org/draft-03/schema",
"id": "schema.json",
"type": "object",
"properties":{
"songId": {"$ref": "fref.json"}
},
"required": ["songId", "albumId", "songTitle"]
}
有人可以帮助解决 abao 中的模式引用吗?如何使用 --schemas 选项?这是简单的要点 https://gist.github.com/SeanSilke/e5a2f7673ad4aa2aa43ba800c9aec31b
我尝试 运行 "abao api.raml --schemas fref.json" 但出现错误“Missing/unresolved JSON schema $refs (fref.json) in schema”。
顺便说一句,服务器被 osprey-mock-service 模拟了。
您需要将 id 字段添加到您的 JSON 架构中。
运行 使用:abao api.raml --server http://localhost:3000 --schemas=./*.json
示例文件:
api.raml
#%RAML 0.8
title: simple API
baseUri: http://localhost:3000
/song:
get:
responses:
200:
body:
application/json:
schema: !include schema.json
example: |
{
"songId": "e29b",
"songTitle": "The song",
"albumId": "18310"
}
fref.json
{
"id": "fref.json",
"type": "string"
}
schema.json
{
"$schema": "http://json-schema.org/draft-03/schema",
"id": "schema.json",
"type": "object",
"properties":{
"songId": {"$ref": "fref.json"}
},
"required": ["songId", "albumId", "songTitle"]
}