Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7009

Swagger feature ignore interfaces under OSGi

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 3.1.7
    • Fix Version/s: None
    • Component/s: JAX-RS
    • Labels:
      None
    • Environment:

      Karaf 4.0.5

    • Estimated Complexity:
      Unknown

      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:

      SampleResource.java
      package org.code_house.swagger.example.api;
      
      @Api
      @Path("/test")
      public interface SampleResource {
      
          @GET
          @ApiOperation("Something to do")
          String getSomething();
      }
      
      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";
          }
      }
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ldywicki Łukasz Dywicki
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: