swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Which fails when trying to load the API via OpenFeign...
Caused by: java.lang.IllegalStateException: Method getObjectMapper not annotated with HTTP method type (ex. GET, POST)
at feign.Util.checkState(Util.java:130) ~[feign-core-10.4.0.jar:na]
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:99) ~[feign-core-10.4.0.jar:na]
at org.springframework.cloud.openfeign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:188) ~[spring-cloud-openfeign-core-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:66) ~[feign-core-10.4.0.jar:na]
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:154) ~[feign-core-10.4.0.jar:na]
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:52) ~[feign-core-10.4.0.jar:na]
at feign.Feign$Builder.target(Feign.java:251) ~[feign-core-10.4.0.jar:na]
Suggest a fix/enhancement
defaultInterfaces=true should be the default when <library>spring-cloud</library> is used.
Fix api.mustache to not include the following when using <library>spring-cloud</library>
Description
default
methods.<library>spring-cloud</library>
is to generatedefault
methods.defaultInterfaces=false
, if you havejava8=true
, there is still left over crud from thedefaultInterfaces
support.Swagger-codegen version
swagger-codegen-maven-plugin/3.0.20
Steps to reproduce
Note: other standard configuration options have been omitted..
results in the generated code:
being added to every API class.
Which fails when trying to load the API via OpenFeign...
Suggest a fix/enhancement
defaultInterfaces=true
should be the default when<library>spring-cloud</library>
is used.api.mustache
to not include the following when using<library>spring-cloud</library>