Initial solution:
After some investigation I came to realize that there is no support in swagger-codegen 2.2.3 for generating URI parameter as part of the client API function.
But there is an option in swagger-codegen-maven-plugin configuration of
"templateDirectory - directory with mustache templates", for giving a path to a folder including mustache templates, which will take the templates in that folder and override the existing with the same name.
example:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<id>my-project-api-client-kit</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.build.directory}/my-project-api.yaml</inputSpec>
<language>java</language>
<configOptions>
<dateLibrary>java8</dateLibrary>
<sourceFolder>src/main/java</sourceFolder>
</configOptions>
<modelPackage>my.project.ck.resources.models</modelPackage>
<apiPackage>my.project.ck.resources.interfaces</apiPackage>
<library>feign</library>
<templateDirectory>/myTemplateFolder/</templateDirectory>
</configuration>
</execution>
</executions>
</plugin>
And inside the custom templates folder, put your own api.mustache file with the additional "URI basePath" parameter:
...
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}(URI basePath, {{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
...
Note:
Swagger provides a lot of templates for a variety of uses, make sure to take and modify the correct api.mustache template file according to which you are using.
in the above example I modified (and override) the java.libraries.feign/api.mustache file because this is the file my plugin is configured too (as in the example).