3

I have wildfly swarm service with basic REST and I want configure swagger ui with it. At the moment it is started as jar

here is main file

Container container = new Container();
        SwaggerWebAppFraction fraction = new SwaggerWebAppFraction();
        //fraction.addWebContent(System.getProperty("swarm.swagger.ui.resources"));
        //fraction.addWebContent("/");
       // fraction.addWebContent("swagger-webapp-ui.war" + Container.VERSION);
        container.fraction(fraction);

        final JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);

        deployment.addResource(Main.class);

        deployment.addResource(TimeResource.class);

        deployment.addResource(CORSFilter.class);
        deployment.addResource(JAXRSConfiguration.class);

        // Enable the swagger bits
        final SwaggerArchive archive = deployment.as(SwaggerArchive.class);

        // Tell swagger where our resources are
        archive.setResourcePackages("org");

        //archive.setTitle("Swagger Demo");
        container.start();

        container.deploy(deployment);

When I access http://localhost:8080/swagger I see only this kind of output

{"swagger":"2.0","info":{},"basePath":"/","tags":[{"name":"time"}],"paths":{"/time/now":{"get":{"tags":["time"],"summary":"Get the current time","description":"Returns the time as a string","operationId":"get","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"string"}}}}}}}

just json! http://localhost:8080/swagger-ui unreachable

How to properly configure or start wildfly swarm with swagger ui? where is a mistake?

Armen Arzumanyan
  • 1,939
  • 3
  • 30
  • 56
  • Is the project available somewhere that it can be tried? Bit hard to tell from this information – Ken Sep 27 '16 at 20:24
  • I would suggest you use the wildfly swagger ui micro profile (http://wildfly-swarm.io/download/swagger-ui-swarm). When running on my machine it has an effective memory footprint of <50mb – Lasrik Jun 06 '17 at 11:38
  • swagger and swagger-ui are 2 different things. You can configure your swagger and expose the swagger.json (in your case: http://localhost:8080/swagger). Swagger-ui, You can include this into your project through Maven https://wildfly-swarm.gitbooks.io/wildfly-swarm-users-guide/server/swagger_ui.html (include in your pom), or use the static swagger-ui files (html, js, etc) and create a swagger-ui webapp yourself. – bram000 Mar 28 '18 at 11:08

0 Answers0