@JsonFormat Annotation for field of Type java.time.Instant are Ignored
FlorianKaemmerer opened this issue · 0 comments
FlorianKaemmerer commented
I'm having trouble generating a correct swagger file from an Object that contains fields of type java.time.Instant
.
Example Object:
public class GenerationStatus {
@JsonProperty
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssZ", timezone = "Europe/Berlin")
private Instant generationDate;
Snipped of generated swagger.yaml
definitions:
ReportGenerationStatus:
type: "object"
properties:
generationDate:
type: "integer"
format: "int64"
I would expect something like:
definitions:
ReportGenerationStatus:
type: "object"
properties:
generationDate:
type: "string"
format: "date-time"
My Plugin configuration is as follows:
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>${swagger-maven-plugin.version}</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>example.com.controller</locations>
<schemes>https</schemes>
<host>localhost:8080</host>
<basePath>/v2/api-docs</basePath>
<info>
<title>Generation Status API</title>
<version>v1</version>
<description>This API gives the status of the generation.</description>
</info>
<swaggerDirectory>${swagger-documentation-directory}</swaggerDirectory>
<swaggerFileName>swagger</swaggerFileName>
<outputFormats>yaml</outputFormats>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
Am I missing something?