swagger-maven-plugin
swagger-maven-plugin copied to clipboard
Document only annotated models and their annotated fields
Greetings,
I've started documenting my project with Swagger and wanted to make it, so that only models, which have the @ApiModel annotation enter the generated documentation. Furthermore, I do not want either non-annotated properties of the model to be included, nor fields from superclasses.
The thing is however, that, not only do non-annotated fields of superclasses get included, but also some random classes which have no annotations and absolutely nothing to do with the specified model.
@ApiModel
public class MyModel extends 3rdPartyClass {
. public String propertyIdoNotWantDocumented;
. @ApiModelProperty(...)
. public String propertyIWantDocumented;
}
The thing that happens is that both propertyIWantDocumented and propertyIdoNotWantDocumented enter the documentation, as well as all fields of 3rdPartyClass. And if 3rdPartyClass happens to have some Objects as fields, these objects also get documented.
By the looks of it, the JaxrsReader automatically includes all these classes in the documentation, even though they are not annotated.
This is really annoying imo, and I think that at least a property should be added for the documentation of only annotated classes and fields.
By the looks of it, the JaxrsReader automatically includes all these classes in the documentation, even though they are not annotated.
This is propably as designed. By default, this plugin should document the parameters how they are actually received by jax-rs.
However, there should (imo) be at least a setting to only check fields / methods / classes if they actually have swagger annotations.
Any update? I met the same issue, too many redundant models are created... Is there any way to solve this?