Q: swagger in play framework

68 views
Skip to first unread message

af...@softimize.co.il

unread,
Apr 22, 2015, 3:51:59 AM4/22/15
to swagger-sw...@googlegroups.com
Hi,
i am develop play framework project and i want to include swagger into it.
one of my routes look like this :
DELETE  /file/*filename                         @fileServer.controller.FileController.deleteFile(filename: String)

i am trying to set swagger annotations to test this route.
*filename = any uri that place after /file/ (example:  /file/testfile   or  /file/folder/testfile and so on..)
when i added the swagger annotations:
@Api(value = "/file", description = "File system operations")
public class FileController extends Controller

@ApiOperation(httpMethod = "DELETE", value = "Delete file")
@ApiResponses(value = {
@ApiResponse(code = OK, message = "Success"),
@ApiResponse(code = NOT_FOUND, message = "File not found")})
@ApiImplicitParams(value = {
@ApiImplicitParam(value = SecurityUtils.CREDENTIAL_KEY, required = true, dataType = "String", name = SecurityUtils.CREDENTIAL_KEY, paramType = "query"),
@ApiImplicitParam(value = "filename", required = true, dataType = "String", name = "filename", paramType = "path")})
@ValidateRequest
public Promise<Result> deleteFile(String filename)

i am getting in swagger UI this:


/file/{filename<.+>
 and i cant edit the uri to test the method. (upload the image from swagger UI)

can some help me?
Afik
swagger.jpg

tony tam

unread,
Apr 22, 2015, 12:47:55 PM4/22/15
to swagger-sw...@googlegroups.com
Hi, you'll have to change your route to be something like this:

DELETE /file/:filename

Take a look at the sample here:

af...@softimize.co.il

unread,
Apr 26, 2015, 3:03:52 AM4/26/15
to swagger-sw...@googlegroups.com
Hi, thanks for the answer, but when i change the route i cant include all URI,
which i want to be able to set "http://localhost:9000/file/afik/test1" and route to the delete method.
:filename mean that if you add more then 1 "/" it is a different route.
i hope you understand my problem.

Afik

Ron Ratovsky

unread,
Apr 26, 2015, 4:51:09 AM4/26/15
to swagger-sw...@googlegroups.com
Swagger does not support a dynamic number of path parameters. At the moment, one parameter can correspond to one value.

--
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
-----------------------------------------
Reply all
Reply to author
Forward
0 new messages