Search code examples
spring-bootswagger-2.0springfox

In my Swagger2 documentation of Spring Boot I get Timestamp fields documentation as a JSON object


I have a fields as createdDT as java.sql.Timestamp type which is shown as below in my swagger documentation. Can anyone help me to have this field in the format as yyyy-mm-dd or the format can be customized.

I am using springfox-swagger-ui 2.8.0 and springfox-swagger2 2.8.0.

Thanks in advance.

createdDt": {
            "date": 0,
            "day": 0,
            "hours": 0,
            "minutes": 0,
            "month": 0,
            "nanos": 0,
            "seconds": 0,
            "time": 0,
            "timezoneOffset": 0,
            "year": 0
          },



Solution

  • Yes, please use directModelSubstitute(Timestamp.class, Long.class) so that Timestamp appears as Long in the Swagger documentation. See this complete answer: Swagger - timestamp weird representation