How to skip @DateTimeFormat annotation in open-api-generator plugin

902 Views Asked by At

I am trying to generate interface from yaml file using open api generator plugin. However while generating the interface an additional annotation @DateTimeFormatter is getting added for date field. Can someone help how to skip adding this DateTimeFormatter annotation in date field.

Using 6.0.1 open api version

1

There are 1 best solutions below

0
TacheDeChoco On

A possible (but quite heavy) solution would be to customize the mustache template that is used to generate such field (dateTimeParam.mustache)

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/JavaSpring/dateTimeParam.mustache

You can configure Maven to use extra template(s) using:

<templateDirectory>${project.basedir}/openapi/templates</templateDirectory>

You can find an example here.