I am using Openapi generator(5.4.0), with spring (generator name) and gradle, I am trying to add an import to a generated model.
For the particular field in the api spec, I have added:
x-field-extra-annotation: "@com.fasterxml.jackson.annotation.JsonFormat ...."
This works, however I dont want to fully qualify it, and have the com.fasterxml.jackson.annotation.JsonFormat import added.
I tried adding typeMappings to genratedCode task, but that doesn't work.
importMappings = [
'JsonFormat' : 'com.fasterxml.jackson.annotation.JsonFormat'
]
Update: I can add model.mustache template to project, and add the import. ie
{{#useBeanValidation}}
...
import com.fasterxml.jackson.annotation.JsonFormat;
...
{{/useBeanValidation}}
Any ideas? Better ways. Thanks.