I'm trying to generate Swagger documentation from Java code and one of my nested model properties is a HashMap. The generated example for it is as follows:
"additionalProp1": {
"customObject": {}
},
"additionalProp2": {
"customObject": {}
},
"additionalProp3": {
"customObject": {}
}
What I need it to look like is:
"objectName": {
"customObject": {}
}
In other words, I need to tell them what the additionalProp String should be and preferably not have it repeated three times. Is there any way to do this using Swagger Annotations? I'd prefer not to hardcode a full example since the CustomObject has a number of properties itself and is still in flux. Is it possible to maybe do something along the lines of
@ApiModelProperty(example = "objectName:{package.CustomObject}")
(except something that actually works)?
I have tried playing with the @ApiModelProperty
in this and other ways but so far unsuccessfully.
@ApiModelProperty
public HashMap<String, CustomObject> getObjectMap(){
return objectMap;
}
I am using the 1.5.18 Swagger jars. So far I've only been able to find similar problems solved using direct yaml or json manipulation.