I use SpringFox and Swagger UI for API documentation.
I have a DTO in which there is a property which is of type Long. It's not populated 99% of time so I want to demonstrate this fact in documentation by setting the property value to null
. So I want this JSON in examples section
{
/* ... */
"legacyId": null
}
I've already tried
@ApiModelProperty(value = "legacyId", example = null)
public Long getLegacyId() {
return legacyId;
}
But I got a warning "Attribute value must be constant". What else I can do ?