swagger-play icon indicating copy to clipboard operation
swagger-play copied to clipboard

type ApiHelpController is not a member of package controllers

Open webron opened this issue 8 years ago • 13 comments

From @damianbl on March 8, 2016 15:13

When using "io.swagger" %% "swagger-play2" % "1.5.1" I get the strange error:

type ApiHelpController is not a member of package controllers

This is how I define it in the routes file:

GET /api-docs controllers.ApiHelpController.getResources

I can find the ApiHelpController in the controllers package.

Copied from original issue: swagger-api/swagger-core#1704

webron avatar Mar 08 '16 16:03 webron

@webron Which router do you use in your build.sbt?

In Play 2.4 the routing was changed from static to DI. Maybe this helps you: https://www.playframework.com/documentation/2.4.x/ScalaRouting#Dependency-Injection

frne avatar Mar 10 '16 13:03 frne

@frne - I didn't open the ticket, I transferred the ticket here for @damianbl (as noted in the comment itself).

webron avatar Mar 10 '16 16:03 webron

Does it work only for a specific router?

damianbl avatar Mar 15 '16 12:03 damianbl

@damianbl The helper controller works with the play 2.4 default injected router. If you want to use the static router, you must implement the controller on your own (as an object)...

frne avatar Mar 16 '16 08:03 frne

@frne that's clear. Thank you. However, I use the default injected routed.

damianbl avatar Mar 16 '16 08:03 damianbl

@damianbl Have you registered the Play/Guice module in your application.conf?

play.modules.enabled = ${play.modules.enabled} [
  play.modules.swagger.SwaggerModule
]

frne avatar Mar 18 '16 14:03 frne

Yes, I have. I have done it according to the documentation

damianbl avatar Apr 06 '16 08:04 damianbl

I face the same problem , how we can fixed this please?

skanel avatar Jul 15 '16 04:07 skanel

@skanel I'm still on 1.3.12 and it works. I'm back to the upgrade to 1.5.1 in a few weeks so I'll probably face the problem again and post the solution.

damianbl avatar Jul 18 '16 08:07 damianbl

Makes sure to have routesGenerator := InjectedRoutesGenerator in your Play/SBT build

cchantep avatar Aug 22 '17 23:08 cchantep

@cchantep, I have it alredy.

damianbl avatar Aug 23 '17 07:08 damianbl

Any update on this bug ?

piyushdaftary avatar Mar 24 '18 22:03 piyushdaftary

It works for me now with 1.5.3. What exact issue do you have @piyushdaftary ?

damianbl avatar Mar 25 '18 20:03 damianbl