[BUG] @RequestMapping annotation not allowed on @FeignClient interfaces
Created by: cTAbdIsi
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Code generation with plugin failed with error @RequestMapping annotation not allowed on @FeignClient interfaces
after update to 6.1.0
openapi-generator version
6.1.0
Generation Details
This is our configuration for the maven plugin:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-maven-plugin.version}</version>
<configuration>
<configOptions>
<dateLibrary>java8</dateLibrary>
<disableHtmlEscaping>true</disableHtmlEscaping>
<hateoas>false</hateoas>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>models</sourceFolder>
<useTags>true</useTags>
</configOptions>
<generateModels>true</generateModels>
<generatorName>spring</generatorName>
<library>spring-cloud</library>
<skipIfSpecIsUnchanged>true</skipIfSpecIsUnchanged>
</configuration>
<executions>
<execution>
<id>generate-api</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<apiPackage>${project.groupId}.${project.artifactId}.api.v1</apiPackage>
<inputSpec>${project.basedir}/docs/openapi.yaml</inputSpec>
<modelPackage>${project.groupId}.${project.artifactId}.api.v1.model</modelPackage>
<modelNameSuffix>ApiV1</modelNameSuffix>
</configuration>
</execution>
</executions>
</plugin>
In openapi-generator version < 6.1.0, the plugin generate following code:
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "Test")
public interface TestApi {
...
}
This is the result after updating to 6.1.0+.
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "Test")
@RequestMapping("${openapi.localServices.base-path:/test/v1}")
public interface TestApi {
We use this interface to setup the feign clients like this:
@FeignClient(name = "test",
url = "${sdu.test.url:}",
configuration = {TestApiConfig.class, ApiClientConfig.class})
public interface TestApiClient extends TestApi {
}