I have a Spring Boot 2.7 project that uses the swagger-codegen-maven-plugin version 2.4.1 that generates the model for me.
I need the date format to follow ISO-8601 format which is yyyy-MM-dd'T'HH:mm:ssZ, ie 2019-05-31T23:59:59Z.
But I am getting the format as 2019-05-31T23:59:59+00:00.
I have the following piece of yaml spec for swagger 2.0.
definitions:
CommandResponse:
properties:
requestTime:
type: string
format: date-time
The documentations I read for swagger is that format: date-time should give the ISO format with the Zulu suffix. However, I am not getting the Z but rater +00:00
Is there some configuration I am missing? What do I need to do to get the date format with the Zulu suffix?
I read this was a default but tuns out my spring boot 2.7 project requires explicit config using
spring.jackson.date-format: yyyy-MM-dd'T'HH:mm:ss'Z'.Also remember for testing, if you're not spinning up the full application context, the MappingJackson2HttpMessageConverter needs to be supplied to the MockMvc.