Home > Back-end >  Swagger2 into and if is nested inside, how to use annotations to display on UI hierarchical structur
Swagger2 into and if is nested inside, how to use annotations to display on UI hierarchical structur

Time:11-22

As title, at the time of online API documentation is generated by swagger,
 @ ApiModelProperty (value="https://bbs.csdn.net/topics/customer number", the required=true) 
Private String customerNo;

@ ApiModelProperty (value="customer name" https://bbs.csdn.net/topics/
private String name;

@ ApiModelProperty (value="card information" https://bbs.csdn.net/topics/
Private CardInfo CardInfo;


The bank card information, how to write notes, to show the effect on the UI interface?
 {
"CustomerNo" : ", "
"Name" : ", "
"CardInfo" : {
"CardID" : ", "
"CardName" : "","
}
}


Not like now
 {
"CustomerNo" : ", "
"Name" : ", "
"CardID" : ", "
"CardName" : "","
}

CodePudding user response:

I have done a long time to this, also very tired

CodePudding user response:

An object around an object to
@ Data
Public class UserInfoForm {

@ ApiModelProperty (" name ")
private String name;
@ ApiModelProperty (" gender female} {1: male, 2: ")
Private Integer gender;

@ ApiModelProperty (" birthday ")
Private Date birthday;

@ ApiModelProperty (" type ")
Private String bloodType.

@ ApiModelProperty (" animal sign (zodiac) ")
Private String chineseZodiac;

@ ApiModelProperty (" constellation ")
Private String constellation;

@ ApiModelProperty (" professional ")
Private String profession;

@ ApiModelProperty (" working hours ")
Private String workTime.

@ ApiModelProperty (" marital status {1: confidentiality, 2: married, 3: unmarried} ")
Private Integer marriageStatus;

@ ApiModelProperty (" number of children ")
Private Integer offspringCount;
@ ApiModelProperty (" information ")
Private UserBodyInfoForm UserBodyInfoForm;
}



{
"Birthday" : ", "
"BloodType" : ", "
"ChineseZodiac" : ", "
"Constellation" : ", "
"Gender" : 0,
"MarriageStatus" : 0,
"Name" : ", "
"OffspringCount" : 0,
"Profession" : ", "
"UserBodyInfoForm" : {
"ChestCircumference" : 0,
"CreateTime" : ", "
"HighHip" : 0,
"Hipline" : 0,
"Id" : 0,
"LeftLeg" : 0,
"RightLeg" : 0,
"Shank" : 0,
"StandardWeight" : 0,
"Stature" : 0,
"TargetWeight" : 0,
"UpdateTime" : ", "
"UserId" : 0,
"Waistline" : 0,
"Weight" : 0
},
"WorkTime" : ""
}

CodePudding user response:

Submitted an object contains an object parameter, but these parameters are just part of the property, other properties do not need to, how to deal with? The same model in different requests into the attributes can be different

CodePudding user response:

Mainly in order to be lazy, write a ViewModel is what thing, of course this is digression
You can use an object contains an object, but be careful not to nested
  • Related