我正在寻找一种方法将swagger中定义的模式转换为JSON-Schema。
例如,在我的招摇中,我有:
"definitions" : {
"response" : {
"properties" : {
"responseContent" : {
"$ref" : "#/definitions/objectResponse"
}
}
},
"objectResponse" : {
"description" : "response",
"properties" : {
"idResponse" : {
"type" : "string",
"description" : "Response",
"minLength" : 0,
"maxLength" : 255
}
}
}
}
我想:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {},
"id": "http://example.com/example.json",
"properties": {
"responseContent": {
"id": "/properties/responseContent",
"properties": {
"idResponse": {
"id": "/properties/responseContent/properties/idResponse",
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
目前,我找到了解决方案:
但是通过这个过程,我失去了限制,我依赖外部工具。
感谢您的帮助。
PS:我对API世界有点新意,不要犹豫深刻解释我很好奇墩