I know how to make array of string data in swagger like this:
"photoUrls" : {
"type":"array",
"items":{
"type":"string"
}
}
It will show output like this:
"photoUrls":[
"string"
]
How to make output like this?:
"photoUrls":[]
You can specify an empty array []
as an example
for your array schema. This will override the default examples values generated by Swagger UI.
"photoUrls" : {
"type":"array",
"items":{
"type":"string"
},
"example": []
}
Ron's answer is more user-friendly for your users. Consider using some real-world example
values instead:
"photoUrls" : {
"type":"array",
"items":{
"type":"string",
"example": "http://example.com/images/pet.png"
},
}