问题描述
我正在编写REST API的Swagger文档(方法调用后)。我无法弄清楚如何使用Swagger在结果中写入“ userNode”,“父母”,“祖父母”和“孩子”。
我的REST API响应如下所示:-
{
"status" : "success","result" : {
"userNode" : {
"siblings" : [{
"user" : {
"userId" : "12345","name" : "S T Johnson","location" : "Koera",},"childCount" : 0
}],"person" : {
"user" : {
"userId" : "7383","name" : "Samuel","location" : "north Koera","childCount" : 6
}
},"parent" : {
"siblings" : [ {
"user" : {
"userId" : "6752","name" : "Abu Salem","location" : "Saint Jones","childCount" : 8
}],"person" : {
"user" : {
"userId" : "1922","name" : "Peter","location" : "Carrebean","childCount" : 10
}
},"grandparent" : {
"siblings" : [ ],"person" : {
"user" : {
"userId" : "9001","name" : "Mohan Kapoor","location" : "Kenya","childCount" : 2
}
},"children" : [ {
"user" : {
"userId" : "102","name" : "Abhraham","location" : "America","childCount" : 0
},{
"user" : {
"userId" : "101","name" : "John","location" : "South Africa","childCount" : 0
} ]
},"responseTimeStamp" : "1602134518273","message" : ""
}
如果我扭曲响应对象,则如下所示。
我试图创建Swagger,但是一切都搞砸了:-
"my_response": {
"type": "object","properties": {
"status": {
"type": "string"
},"result": {
"type": "object","properties": {
"userNode": {
"type": "object","properties" : {
"siblings" : [
{
"user": {
"type": "object","properties": {
"userId" : {"type": "string"},"name": {"type": "string"},"location": {"type": "string"}
}
如果您能帮助我修复它,我将不胜感激。
欢呼
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)