Empty response from Swagger

347 views
Skip to first unread message

Itay

unread,
Apr 21, 2015, 11:16:33 AM4/21/15
to swagger-sw...@googlegroups.com
Hi,

I am trying to integrate swagger with a REST API, using java 1.7 and swagger springmvc 0.8.8
The spring and swagger contexts are defined in about the same way in another project (which is working fine with swagger), but for some reason, when trying to browse the documentations in these addresses (for example):
I only get an empty response like so:
{ }

What could be the cause for that problem? I would gladly add any specification that could help understand the problem.

Thanks in advance!

Itay

unread,
Apr 21, 2015, 11:30:49 AM4/21/15
to swagger-sw...@googlegroups.com
Some info samples from the logs, that as far as I can tell show that it should work:

17:17:37.845 [main] INFO  RequestMappingHandlerMapping: Mapped "{[/endpoint],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<com.company.api.Response> com.company.api.Controller.Method(javax.servlet.http.HttpServletRequest,java.lang.String) throws java.io.IOException 
17:17:37.852 [main] INFO  RequestMappingHandlerMapping: Mapped "{[/api-docs],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.wordnik.swagger.model.ResourceListing> com.mangofactory.swagger.controllers.DefaultSwaggerController.getResourceListing(java.lang.String) 
17:17:37.853 [main] INFO  RequestMappingHandlerMapping: Mapped "{[/api-docs/{swaggerGroup}/{apiDeclaration}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.wordnik.swagger.model.ApiListing> com.mangofactory.swagger.controllers.DefaultSwaggerController.getApiListing(java.lang.String,java.lang.String)
...
17:17:39.820 [main] INFO  ApiListingReferenceScanner: Request mapping: MethodName belongs to groups: [[ResourceGroup{groupName='swagger-group'}]]  
17:17:39.820 [main] INFO  ApiListingReferenceScanner: Adding resource to group:ResourceGroup{groupName='swagger-group'} with description:Description for handler method:MethodName 
17:17:39.820 [main] INFO  ApiListingReferenceScanner: RequestMappingInfo did not match any include patterns: | {[],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]} 
17:17:39.821 [main] INFO  ApiListingReferenceScanner: RequestMappingInfo did not match any include patterns: | {[/api-docs],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]} 
17:17:39.821 [main] INFO  ApiListingReferenceScanner: RequestMappingInfo did not match any include patterns: | {[/api-docs/{swaggerGroup}/{apiDeclaration}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]} 
...
17:17:39.824 [main] INFO  ApiListingReferenceScanner: Created resource listing Path: /swagger/swagger-group Description: description Position: 0 
17:17:39.845 [main] INFO  SwaggerApiResourceListing: Added a resource listing with (1) api resources:  
17:17:39.845 [main] INFO  SwaggerApiResourceListing:   Description at location: /api-docs/swagger-group
17:17:39.845 [main] WARN  SwaggerPluginAdapter: SwaggerSpringMvcPlugin have already been initialized!  

Ron Ratovsky

unread,
Apr 21, 2015, 11:33:28 AM4/21/15
to swagger-sw...@googlegroups.com
Hi Itay,

swagger-springmvc (now springfox) is a community contribution and we don't know it well enough to provide support for it.
Also, you seem to use a fairly old version of it.

I'd recommend checking out the latest version from https://github.com/springfox/springfox which also allows you to generate Swagger 2.0 definitions (I think there's a migration guide there).
If you still have problems, please open an issue directly on their repository.

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



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Itay

unread,
Apr 21, 2015, 11:51:41 AM4/21/15
to swagger-sw...@googlegroups.com
Will do, thanks a lot!
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Dilip Krishnan

unread,
Apr 21, 2015, 8:59:09 PM4/21/15
to swagger-sw...@googlegroups.com
Looks like your include pattern is incorrect. If you just copied the example its very likely its getting ignored because the regex isnt matching your path. Could you post your SwaggerSpringMvcPlugin configuration?

Additionally please upgrade to the latest released version (1.0.2). Keep in mind that we're going to be releasing 2.0 pretty soon.

Cheers,
Dilip

Itay

unread,
Apr 22, 2015, 2:28:39 PM4/22/15
to swagger-sw...@googlegroups.com
I upgraded to springfox as Ron suggested and now everything's going way more smoothly, thanks!
Reply all
Reply to author
Forward
0 new messages