@Path("/test")
public class testResource
{
@GET
@PermitAll
@Produces(MediaType.APPLICATION_JSON)
@Path("/helloWorld")
public Response helloWorld(@QueryParam("id") Integer id,@QueryParam("name") String name)
{
String responseString = "id="+id+" name="+name;
return Response.status(Status.OK).entity(responseString).build();
}<context-param>
<param-name>resteasy.resources</param-name>
<param-value> com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON, de.test.resources </param-value>
</context-param>
But unfortunately the changes according to this tutorial did not work. I downloaded the swagger resteasy sample project and added some changes according to this sample. For example, I have added the Bootstrap class.<servlet> <servlet-name>Jersey2Config</servlet-name> <servlet-class>com.wordnik.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class> <init-param> <param-name>api.version</param-name> <param-value>1.0.0</param-value> </init-param> <init-param> <param-name>swagger.api.basepath</param-name> <param-value>http://localhost:8080/backend/rest</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet>
Now, calling the URL "http://localhost:8080/backend/" (because in the the jboss-web.xml the context root is set to backend) there is the message "Can't read swagger JSON from http://localhost:8080/backend/rest/swagger.json".
I don't get how the process of the generation works and I did not find a detailed documentation of this. I don't know where the swagger.json is generated and how. I can't find the generated swagger.json file in the built target directory (also in the sample). I do not understand how I can get the annotations to my UI running on the wildfly.
Can anybody help me? I would be very grateful.
--
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ron,
<?xml version="1.0"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>test Web Application</display-name>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<context-param>
<!-- max size of the upload request -->
<param-name>maxSize</param-name>
<param-value>3145728</param-value>
</context-param>
<context-param>
<!-- max size of any uploaded file -->
<param-name>maxFileSize</param-name>
<param-value>1024000</param-value>
</context-param>
<context-param>
<param-name>resteasy.providers</param-name>
<param-value>
io.swagger.jaxrs.listing.ApiListingResource, io.swagger.jaxrs.listing.SwaggerSerializers,
de.test.test.backend.service.Test1Service </param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>de.test.test.backend.service.InitApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DefaultJaxrsConfig</servlet-name>
<servlet-class>io.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<init-param>
<param-name>api.version</param-name>
<param-value>1.0.0</param-value>
</init-param>
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>http://localhost:8080/backend</param-value>
</init-param>
<init-param>
<param-name>swagger.filter</param-name>
<param-value>de.test.test.backend.service.ApiAuthorizationFilterImpl</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<filter>
<filter-name>ApiOriginFilter</filter-name>
<filter-class>de.test.test.backend.service.ApiOriginFilter</filter-class>
</filter>
<servlet>
<servlet-name>Bootstrap</servlet-name>
<servlet-class>de.test.test.backend.service.Bootstrap</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<filter-mapping>
<filter-name>ApiOriginFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<security-constraint>
<display-name>REST SSL</display-name>
<web-resource-collection>
<web-resource-name>REST Secure URLs</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
</security-constraint>
</web-app><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <modelVersion>4.0.0</modelVersion> <artifactId>test-backend</artifactId> <packaging>war</packaging> <name>test Backend Webapp</name> <url>http://maven.apache.org</url>
<parent> <groupId>de.test.test</groupId> <artifactId>test-master</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent>
<dependencies> <!-- own dependencies --> <dependency> <groupId>de.test.test</groupId> <artifactId>test-native</artifactId> </dependency> <!-- ... --> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-multipart-provider</artifactId> </dependency> <!-- Import the CDI API, we use provided scope as the API is included in JBoss WildFly --> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <scope>provided</scope> </dependency> <!-- Import the Common Annotations API (JSR-250), we use provided scope as the API is included in JBoss WildFly --> <dependency> <groupId>org.jboss.spec.javax.annotation</groupId> <artifactId>jboss-annotations-api_1.2_spec</artifactId> <scope>provided</scope> </dependency> <!-- Import the Servlet API, we use provided scope as the API is included in JBoss WildFly --> <dependency> <groupId>org.jboss.spec.javax.servlet</groupId> <artifactId>jboss-servlet-api_3.1_spec</artifactId> <scope>provided</scope> </dependency> <!-- Import the JPA API, we use provided scope as the API is included in JBoss WildFly --> <dependency> <groupId>org.jboss.spec.javax.transaction</groupId> <artifactId>jboss-transaction-api_1.2_spec</artifactId> <scope>provided</scope> </dependency> <!-- Import the EJB API, we use provided scope as the API is included in JBoss WildFly --> <dependency> <groupId>org.jboss.spec.javax.ejb</groupId> <artifactId>jboss-ejb-api_3.2_spec</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jaxrs</artifactId> <version>1.5.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> </plugin> <plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <configuration> <skip>false</skip> <match-pattern>${project.artifactId}-.*</match-pattern> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>make-a-jar</id> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <executions> <execution> <phase>install</phase> <goals> <goal>install-file</goal> </goals> <configuration> <packaging>jar</packaging> <artifactId>${project.artifactId}</artifactId> <groupId>${project.groupId}</groupId> <version>${project.version}</version> <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file> </configuration> </execution> </executions> </plugin> <plugin> <groupId>com.googlecode.maven-download-plugin</groupId> <artifactId>download-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <id>swagger-ui</id> <goals> <goal>wget</goal> </goals> <configuration> <unpack>true</unpack> <outputDirectory>${project.build.directory}</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>target/${project.artifactId}-${project.version}</outputDirectory> <resources> <resource> <directory>${project.build.directory}/swagger-ui-master/dist </directory> <filtering>true</filtering> <excludes> <exclude>index.html</exclude> </excludes> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build></project>--
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ron,
Missing required property: paths
{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "" }, "host": "localhost:8080", "basePath": "/backend", "tags": [ { "name": "test" } ], "schemes": [ "http" ]}package de.test.test.backend.service;
import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.Produces;import javax.ws.rs.core.Response;
import io.swagger.annotations.Api;import io.swagger.annotations.ApiOperation;
@Path("/test")@Api(value = "/test", description = "Operations from test DLL")@Produces({ "application/json", "application/xml" })public class testService {
@GET @Path("/WH_calculate") @ApiOperation(value = "WH_calculate", notes = "WH_calculate.") public Response WH_calculate() { return null; // TODO }
} <context-param> <param-name>resteasy.providers</param-name> <param-value> io.swagger.jaxrs.listing.ApiListingResource, io.swagger.jaxrs.listing.SwaggerSerializers, de.test.test.backend.service.testService </param-value> </context-param>package de.test.test.backend.service;
import java.util.HashSet;import java.util.Set;
import javax.ws.rs.core.Application;
import io.swagger.jaxrs.config.BeanConfig;
public class InitApplication extends Application {
public InitApplication() { BeanConfig beanConfig = new BeanConfig(); beanConfig.setVersion("1.0.2"); beanConfig.setSchemes(new String[] { "http" }); beanConfig.setHost("localhost:8080"); beanConfig.setBasePath("/backend/rest"); beanConfig.setResourcePackage("de.test.test.backend.service"); beanConfig.setScan(true); }
@Override public Set<Class<?>> getClasses() { HashSet<Class<?>> set = new HashSet<Class<?>>();
set.add(testService.class); set.add(io.swagger.jaxrs.listing.ApiListingResource.class); set.add(io.swagger.jaxrs.listing.SwaggerSerializers.class); return set; }}io.swagger.jaxrs.config.DefaultJaxrsConfig servlet from your web.xml. You've implemented two configuration methods instead of one.--
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.