How to display default value 0 on swagger-ui
Hi all, My result on swagger is:
{
"name": "string",
"wareHouseID": "Integer",
"company": "string",
"fullname": "string",
"address": "string",
"parentID": "Integer"
}
but I need "wareHouseID": 0, "parentID": 0. My question: How to set default values 0. My code:
private int wareHouseID;
private int parentID;
private String name;
private String fullname;
private String company;
private String address;
public Warehouse() {
}
@ApiModelProperty(position = 1,required = true)
public int getWareHouseID() {
return wareHouseID;
}
public void setWareHouseID(int wareHouseID) {
this.wareHouseID = wareHouseID;
}
@ApiModelProperty(position = 2,required = true)
public int getParentID() {
return parentID;
}
Thanks all.
Hi @zonorion. I assume you're referring to the model view in swagger-ui. The view is split into two - the Model which gives you a similar output as you've pasted here, and the Model Schema. The Model simply shows the fields with their types, the default value plays no part in that. It's the Model Schema view that would show you the default value, should you set it. If you don't set those, they would default to 0 anyways.
Maybe i used old swagger version? I used wornik not io :)
It is an old version, but that shouldn't affect what you see in the ui. Make sure you use the latest ui as well.
Hi @webron, i use io.swagger but swager-ui result Can't read swagger JSON from http://localhost:8080/sunrise/api/api-docs Tell me how to fix it? Thanks
Tks @webron 4 support, i solve my problem