Я пытаюсь сгенерировать файл YAML и JSON с подходом, основанным на коде, только с ApiModel. Я хочу, чтобы swagger-maven-plugin генерировал только это. У меня нет веб-сервисов. Но это ничего не дает в качестве вывода. Когда я добавляю веб-сервис, он правильно создает файлы.
@ApiModel(value="BatchModel", description="Batch model for the documentation")
public class BatchD {
private Long batchId;
private String reference;
private List<BatchStateD> batchStateList;
public BatchD() {
batchStateList = new ArrayList<>();
}
@ApiModelProperty(required = true, value = "The identification number of the batch.")
@JsonProperty("id")
@NotNull
public Long getBatchId() {
return batchId;
}
public void setBatchId(Long batchId) {
this.batchId = batchId;
}
@ApiModelProperty(required = true, value = "The reference number of batch")
@JsonProperty("reference")
@NotNull
public String getReference() {
return reference;
}
<build>
<plugins>
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<configuration>
<outputFileName>openapi</outputFileName>
<outputPath>${project.build.directory}/generatedtest</outputPath>
<outputFormat>JSONANDYAML</outputFormat>
<prettyPrint>TRUE</prettyPrint>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>