Can't figure this seemingly easy problem out

Using Wildfly 10, have a basic REST CRUD webapp with a /hello endpoint for 
testing, which works fine.

Set up Swagger per Swagger Core RESTEasy 2.X Project Setup 1.5 
<https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-RESTEasy-2.X-Project-Setup-1.5>

and got to the point of the 'empty' swagger.json :

{
swagger: "2.0",
info: {},
version: "0.0.3",
title: "HelloWorld2Api"
host: "http://localhost:8080";,
basePath: "/HelloWorld2/rest",
schemes: [] "http"
}

my setup:


in pom.xml:

<dependency>
   <groupId>io.swagger</groupId>
   <artifactId>swagger-jaxrs</artifactId>
    <version>1.5.0</version>
</dependency>

in jboss-web.xml
<context-root>HelloWorld2</context-root>


Here are the annotations on my test resource:
@Path("hello")
@Api(value="hello")
@Produces({"application/json", "application/xml"})
public class HelloREST { ... }


Here's the extended Application:

@ApplicationPath("rest")
public class ApplicationConfig extends Application {


    /**
     * Custom constructor for Swagger
     */
    public ApplicationConfig() {
        BeanConfig beanConfig = new BeanConfig();
        beanConfig.setTitle("HelloWorld2Api");
        beanConfig.setVersion("0.0.3");
        beanConfig.setSchemes(new String[]{"http"});
        beanConfig.setHost("http://localhost:8080";);
        beanConfig.setBasePath("/HelloWorld2/rest");
        beanConfig.setScan(true);    
        beanConfig.setResourcePackage("io.swagger.resources");
      //  beanConfig.setResourcePackage("helloworld2.rest");
        beanConfig.setPrettyPrint(true);
    }


    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> resources = new java.util.HashSet<>();
        
        resources.add(helloworld2.rest.HelloREST.class);
        
        resources.add(io.swagger.jaxrs.listing.ApiListingResource.class);
        resources.add(io.swagger.jaxrs.listing.SwaggerSerializers.class);
        
        return resources;
    }


}


If the above commented out line:     
  //  beanConfig.setResourcePackage("helloworld2.rest")

is used instead of
  beanConfig.setResourcePackage("io.swagger.resources");

then the swagger.json returns
Context Path:
/HelloWorld2

Servlet Path:
/rest

Path Info:
/swagger.json

Query String:
null
Stack Trace
org.jboss.resteasy.spi.UnhandledException: java.lang.
ArrayIndexOutOfBoundsException: 1


I've tried all sorts of permutations of configurations, paths, using xml 
descriptors and not, but can't find the problem. I would very much prefer 
to use the non-Spring beanConfig technique.  Where's my mistake?


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to