在使用Kotlin的microprofile / Quarkus项目中,数据类的变量类型为Instant。
@Schema(name = "Vehicle",description = "POJO that represents a vehicle at a specific time.")
data class VehicleDTO(
var time: Instant = Instant.EPOCH
)
问题在于所生成的openapi架构不能表示Instant值的实际传输方式。
该模式如下所示,而只是用这样的字符串表示:2015-06-02T21:34:33.616Z.
Instant:
type: object
properties:
nanos:
format: int32
type: integer
seconds:
format: int64
type: integer
epochSecond:
format: int64
type: integer
nano:
format: int32
type: integer
我已经尝试对数据类进行注释,以使用实现字符串和类型字符串,但是它不会改变任何内容。
@Schema(name = "Vehicle",description = "POJO that represents a vehicle at a specific time.")
data class VehicleDTO(
@Schema(implementation = String::class,type = SchemaType.STRING)
var time: Instant = Instant.EPOCH
)