Collection Example plugin for Springfox
What does it do
It allows you to have a correct example generated for all java.util.Collection
typed properties.
For example, this:
@ApiModelProperty(value ="my property description", example = "2019-12-20T12:00:00")
@NotNull
private List<LocalDateTime> dates;
Would generate this:
{
"properties": {
"autresDates": {
"type": "array",
"example": [
"2019-12-20T12:00:00"
],
"description": "my property description",
"items": {
"type": "string",
"format": "date-time"
}
}
}
}
Usage
Maven
Add this to your pom.xml
in the <dependencies>
<dependency>
<groupId>com.github.aaitmouloud</groupId>
<artifactId>springfox-collection-example-plugin</artifactId>
<version>3.0.0</version>
</dependency>
Gradle
Add this to your dependencies
in your build.gradle
implementation 'com.github.aaitmouloud:springfox-collection-example-plugin:3.0.0'
Spring
Just add the springfox.collection.example.plugins
package to your Spring context
For example, while using Spring Boot:
@ComponentScan({"springfox.collection.example.plugins"})
public class MyConfigurationClass {
}
Contributors
- @aaitmouloud
- @geld0r : PR #5