向JSON模式招摇过市
我正在寻找一种方法,将在swagger中定义的模式转换为JSON模式 例如,我大摇大摆地说:向JSON模式招摇过市,json,swagger,jsonschema,Json,Swagger,Jsonschema,我正在寻找一种方法,将在swagger中定义的模式转换为JSON模式 例如,我大摇大摆地说: "definitions" : { "response" : { "properties" : { "responseContent" : { "$ref" : "#/definitions/objectResponse" } } }, "objectResponse
"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"
}
目前,我找到了一个解决方案:
- 基于招摇过市(例如使用apimatic.io)生成响应
- 使用jsonschema.net转换响应