I see that there is a date
format for strings in OpenAPI, and that by using dateLibrary=java8
we can generate LocalDate
fields by using openapi-generator
.
But is there any way of producing LocalTime
fields? There is no time
format in OpenAPI and the date-time
one produces OffsetDateTime
.
EDIT: It's hard offering a reproducible example since the question is about something I can't do, but some illustrative example would be that I want something along the lines of:
A schema specification:
Visit:
type: object
parameters:
visitor:
type: string
timeOfVisit:
type: string
format: time
But obviously the time
format is not present in the OpenAPI specification. The generated code should be something like
public class Visit {
private String visitor;
private LocalTime timeOfVisit;
// Getters, setters, etc
}
There must surely be some way for openapi-generator
to produce this output, isn't it? I've found that there are some import-mappings
that map LocalTime
to org.joda.time.*
so there seems to be a way of having it produce LocalTime
types, but I haven't found it
OffsetDateTime
and callmyOffsetDateTime.toLocalTime()
. – Mammalogydate-time
in the OpenAPI specification would communicate that it allows any combination of date and time, while it actually only works with time. I guess my wording wasn't very good, because what I'd like is to have a time parameter in my API and also in the generated code. (Maybe using a regex pattern for the string is my only choice?) – Hungry