I have Spring RESTfull application and I want to generate an API for it. I use a gradle configuration from there https://github.com/Casturan/swagger-gradle-example/blob/master/build.gradle to generate code. But there is problem it uses models defined in definitions: while I want it to use my models from shared module. I found that I need to use importMapping but when I try to apply this command in my build.gradle I am getting an error:
importMappings = [
'board_container': 'board_container=com.workingbit.share.domain.impl.BoardContainer'
]
> Could not set unknown property 'importMappings' for task ':myproject:generateApi' of type org.gradle.api.DefaultTask.
So question how to use importMapping and how to connect it with my model in yaml?
I haven't tried it but looking at the code of
CodegenConfiguratormodifying thegenerateApitask like this in thebuild.gradlemight work:The
CodegenConfiguratoris being called at the second line in thebuild.gradleyou linked to in your question and it has a few methods to configureimportMappings. You can have a look here (if this doesn't work try with thesetImportMappings).