简体   繁体   中英

Configuring Swagger with Play/Java-framework-2.5

I am trying to configure Swagger with my Play-2.5 project.

I followed this tutorial and it worked, but only for the older version of Play and not working with Play-2.5. As the project has migrated into Play-2.5, we had to remove the swagger configuration.

Firstly, the issue seemed to be with static controller vs non static controller in Play-2.5, but I ended up with proving myself wrong. I am facing this error

      type ApiHelpController is not a member of package controllers 
      GET         /api-docs                controllers.ApiHelpController.getResources

If any one knows any link for Swagger configuration with Play-2.5 for Java , please guide.

PS: there are tutorials available for Scala not for java .

Try this repo:

https://github.com/CreditCardsCom/swagger-play

I created this as a temporary workaround until we get support for Play 2.5 in the official swagger-play repo.

I have only used the Play-Swagger project from Zalando . There is a lot of documentation and the repo is kept up-to-date.

If you want a quick start you can take a look at their Activator Template - just run it and you will get the Swagger generated documentation (Swagger UI is already included). From there you can start tweaking it (look for the conf/echo.yaml file).

The problem is, the com.wordnik swagger-play2(What your tutorial is using as a library) breaks with Play 2.4 and up. You can try this which uses a different one (io.swagger). I have used this and it works well with 2.4. But it also breaks with 2.5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM