我正在使用openApi maven 插件为 REST api 生成 java 请求/响应。
该请求有一个 DateTime 属性,当我运行生成器时,我得到了表示为 java.time.OffsetDateTime 的属性的 DateTime 属性。问题是我需要将属性表示为 java.time.Instant。
这是请求的 openApi 规范:
"DocumentDto" : {
"type" : "object",
"properties" : {
"uuid" : {
"type" : "string",
"format" : "uuid"
},
"creationDate" : {
"type" : "string",
"format" : "date-time"
}
}
}
Run Code Online (Sandbox Code Playgroud)
生成的java请求:
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-05-21T13:07:21.639+02:00[Europe/Zurich]")
public class DocumentDto {
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
private UUID uuid;
public static final String SERIALIZED_NAME_TEST = …
Run Code Online (Sandbox Code Playgroud)