Hi Ron,

I tried to integrate swagger But its not generating swagger.json
I added maven dependency, servlet in web.xml and @API annotation in one 
service.

On Friday, 2 October 2015 05:17:59 UTC+5:30, Ron wrote:
>
> Hi there!
>
> Welcome to Swagger.
>
> The first step would be to upgrade to the latest version which is 1.5.3 
> (notice, not 1.5.3-M1). This also carries a name space change to the 
> artifact and the package names.
> Simply replace com.wordnik.swagger with io.swagger for the packages and 
> com.wordnik to io.swagger for the artifact groupId.
>
> If that doesn't resolve the issue, please share your Application class (
> com.abc.def.content.service.ContentService).
>
> On Thu, Oct 1, 2015 at 12:59 PM, <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>
>> I've created a very simple REST service using Java and Tomcat, and it is 
>> working fine. But when I load up Swagger-UI, and pass in "
>> http://localhost:8080/Content-Server/service/content/hello";, I get an 
>> error: *Uncaught TypeError: Cannot read property 'definitions' of null*. 
>> CORS isn't the issue I believe as I've fixed that.
>>
>> Here are some of my files (the important parts of them):
>> @Path("/content")
>> @Api(value="/content", description="Manage content")
>> public class Content {
>>     
>>     private final static Logger LOGGER = Logger.getLogger(Content.class.
>> getName());
>>     
>>     @GET
>>     @Path("/hello")
>>     @Produces(MediaType.APPLICATION_JSON)
>>     @ApiOperation(value="default", httpMethod="GET")
>>     public JSONObject hello() {
>>         JSONObject json = new JSONObject();
>>         try {
>>             json.put("hello", "world");
>>         } catch (JSONException e) {
>>             // TODO Auto-generated catch block
>>             e.printStackTrace();
>>         }
>>         return json;
>>     }
>> }
>> Content.java
>>
>> <web-app>
>>     <display-name>Content Stuff</display-name>
>>     <servlet>
>>         <servlet-name>rest</servlet-name>
>>         <servlet-class>
>> org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
>>         <init-param>
>>             <param-name>javax.ws.rs.Application</param-name>
>>             <param-value>com.abc.def.content.service.ContentService
>> </param-value>
>>         </init-param>
>>         <load-on-startup>1</load-on-startup>
>>     </servlet>
>>         
>>     <servlet>
>>         <servlet-name>DefaultJaxrsConfig</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>/service</param-value>
>>         </init-param>
>>         <load-on-startup>2</load-on-startup>
>>     </servlet>
>>     
>>     <servlet-mapping>
>>         <servlet-name>rest</servlet-name>
>>         <url-pattern>/service/*</url-pattern>
>>     </servlet-mapping>
>> </web-app>
>> web.xml
>>
>> <dependencies>
>>       <dependency>
>>           <groupId>com.wordnik</groupId>
>>           <artifactId>swagger-jaxrs</artifactId>
>>           <version>1.5.3-M1</version>
>>       </dependency>
>> </dependencies>
>> pom.xml
>>
>> I'm very new at Swagger (and Java REST services) but I'd appreciate any 
>> help. Thanks!
>>
>> -- 
>> 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] <javascript:>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> -----------------------------------------
> http://swagger.io
> https://twitter.com/SwaggerApi
> -----------------------------------------
>

-- 
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