Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13488
Closed
Open
Issue created Sep 21, 2022 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[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 {
}
Steps to reproduce
Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking