I tried to add additional information about my Swagger documentation, but I have some problems with the @ApiPropertyModel annotation in a specific one.
No matter what I'm trying to do, it just doesn't work. The plugin correctly generates Swagger.json , all @ApiOperation annotations work for REST resources, but for part of the model it only examines the properties of the model classes and does not look at the annotations above them.
Here's how the plugin is configured:
<plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.5</version> <configuration> <apiSources> <apiSource> <locations> <location>com.example.rest.resources</location> <location>com.example.rest.model</location> </locations> <swaggerDirectory>${project.build.directory}/generated-sources</swaggerDirectory> <basePath>/path/to/the/api</basePath> <info> <title>My RESTful API Documentation</title> <version>${project.version}</version> </info> </apiSource> </apiSources> </configuration> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>
If I have, for example:
@ApiModelProperty(example = "test example") public String test;
It will generate the test property, but will not create any example or any other property that I created in this annotation. The same thing happens when used in a getter, so I think this is not a problem.
Am I doing something wrong? In addition, I looked at the Kongchen project example, and I could not see anything special to make it work.
java annotations swagger
Magno nascimento
source share