[
https://issues.apache.org/jira/browse/CXF-7009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Łukasz Dywicki updated CXF-7009:
--------------------------------
Description:
When more advanced structuring in project is used cxf swagger intergration
fails to generate proper swagger service descriptor (while it still works for
wadl).
For example:
{code:lang=java|title=SampleResource.java}
package org.code_house.swagger.example.api;
@Api
@Path("/test")
public interface SampleResource {
@GET
@ApiOperation("Something to do")
String getSomething();
}
{code}
{code:lang=java|title=DefaultSampleResource.java}
package org.code_house.swagger.example.core.internal;
import org.code_house.swagger.example.api.SampleResource;
public class DefaultSampleResource implements SampleResource {
public String getSomething() {
return "aaa";
}
}
{code}
Works properly, however there is no way to get Swagger2 feature picking this
up. From my analysis it seems that default package calculation uses just
package names of resources defined in class (impl classes) and ignores
implemented interfaces.
Passing to Swagger2Feature an valid package name which contains interfaces is
not working as well because it resources are not visible from implementation
bundle. This is side effect of the Swagger resource scanning logic where it
query classloader for resources. This gets forwarded to CXF's
BundleDelegatingClassLoader and then to bundle which is not aware of any
resources from packages different than it's own.
was:
When more advanced structuring in project is used cxf swagger intergration
fails to generate proper swagger service descriptor (while it still works for
wadl).
For example:
{code:lang=java|title=SampleResource.java}
package org.code_house.swagger.example.api;
@Api
@Path("/test")
public interface SampleResource {
@GET
@ApiOperation("Something to do")
String getSomething();
}
{code}
{code:lang=java|title=DefaultSampleResource.java}
package org.code_house.swagger.example.core.internal;
import org.code_house.swagger.example.api.SampleResource;
public class DefaultSampleResource implements SampleResource {
public String getSomething() {
return "aaa";
}
}
{code}
Works properly, however there is no way to get Swagger2 feature picking this
up. From my analysis it seems that default package calculation uses just
package names of resources defined in class (impl classes) and ignores
implemented interfaces.
Passing a valid package name which contains interfaces is not working as well
because it resources are not visible from implementation bundle. This is side
effect of the Swagger resource scanning logic where it query classloader for
resources. This gets forwarded to CXF's BundleDelegatingClassLoader and then to
bundle which is not aware of any resources from packages different than it's
own.
> Swagger feature ignore interfaces under OSGi
> --------------------------------------------
>
> Key: CXF-7009
> URL: https://issues.apache.org/jira/browse/CXF-7009
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.1.7
> Environment: Karaf 4.0.5
> Reporter: Łukasz Dywicki
>
> When more advanced structuring in project is used cxf swagger intergration
> fails to generate proper swagger service descriptor (while it still works for
> wadl).
> For example:
> {code:lang=java|title=SampleResource.java}
> package org.code_house.swagger.example.api;
> @Api
> @Path("/test")
> public interface SampleResource {
> @GET
> @ApiOperation("Something to do")
> String getSomething();
> }
> {code}
> {code:lang=java|title=DefaultSampleResource.java}
> package org.code_house.swagger.example.core.internal;
> import org.code_house.swagger.example.api.SampleResource;
> public class DefaultSampleResource implements SampleResource {
> public String getSomething() {
> return "aaa";
> }
> }
> {code}
> Works properly, however there is no way to get Swagger2 feature picking this
> up. From my analysis it seems that default package calculation uses just
> package names of resources defined in class (impl classes) and ignores
> implemented interfaces.
> Passing to Swagger2Feature an valid package name which contains interfaces is
> not working as well because it resources are not visible from implementation
> bundle. This is side effect of the Swagger resource scanning logic where it
> query classloader for resources. This gets forwarded to CXF's
> BundleDelegatingClassLoader and then to bundle which is not aware of any
> resources from packages different than it's own.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)