-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] @RequestMapping annotation not allowed on @FeignClient interfaces #13488
Comments
The related change is probably #10573 where |
@RomainPruvostMHH and @welshm could you please habe look and revert this change? |
I can try to take a look at this today or tomorrow |
@welshm i commented the issue in der merged PR modules/openapi-generator/src/main/resources/JavaSpring/api.mustache Not sure if we have a condition, that we know that we use Feign on this time and can add @RequestMapping just if we don't use Feign. |
I think we have a condition to check (because it exists in other |
Ah nice, then i think it's an easy fix. Maybe i can look into it tomorrow |
@welshm found no condition. Thought Tested it with
|
Please, fix this bug, because Spring Framework expects annotation Here is code sample from Spring source code : public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMapping
implements MatchableHandlerMapping, EmbeddedValueResolverAware {
/**
* {@inheritDoc}
* <p>Expects a handler to have either a type-level @{@link Controller}
* annotation or a type-level @{@link RequestMapping} annotation.
*/
@Override
protected boolean isHandler(Class<?> beanType) {
return (AnnotatedElementUtils.hasAnnotation(beanType, Controller.class) ||
AnnotatedElementUtils.hasAnnotation(beanType, RequestMapping.class));
}
} |
Are you suggesting that the annotation should be on the controller implementation as opposed to the interface? Can you take a look at the output from #13546 and see if that is what you'd expect? That will remove the annotation from the interface, but does not re-add it to the controller. |
Hello, May I know when this fix would be released? Thank you! |
@vvinod1310 this is part of 6.2.1 |
Is anyone else encountering this bug when using the Kotlin-Spring generator with library spring-cloud? We're using openapi-generator version: 6.6.0 Our generated interface:
The generated FeignClient:
Then when running our application we encounter the same exception: Think the fix made in this pull request should also be implemented in the Kotlin-Spring generator right? Or am I missing something? |
I created a MR to fix this issue also for the Kotlin-Spring generator, hopefully someone can have a look? |
Bug Report Checklist
Description
Code generation with plugin failed with error
@RequestMapping annotation not allowed on @FeignClient interfaces
after update to 6.1.0openapi-generator version
6.1.0
Generation Details
This is our configuration for the maven plugin:
In openapi-generator version < 6.1.0, the plugin generate following code:
This is the result after updating to 6.1.0+.
We use this interface to setup the feign clients like this:
Steps to reproduce
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: