Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

fix #43 - Parameter types handling #57

Merged
merged 2 commits into from
Feb 16, 2016
Merged

Conversation

frantuma
Copy link
Member

@frantuma frantuma commented Feb 8, 2016

fix #43
ref swagger-api/swagger-core#1635
ref swagger-api/swagger-scala-module#17

Solution for issues reported in #43; Depends on swagger-core PR swagger-api/swagger-core#1635 and swagger-scala-module swagger-api/swagger-scala-module#17 to provide a consistent fix for #43 and related.

swagger-core and swagger-scala-module dependencies versions need to be updated accordingly. merge sequence would be:

  1. merge dataType class loading issue in managed containers such as play framework swagger-core#1635
  2. merge Class loading issue in play framework swagger-scala-module#17
  3. bump swagger-core and swagger-scala-module versions
  4. update swagger-core and swagger-scala-module versions in build.sbt / merge PR

Note that ApiImplicitParam are always added to set of existing inferred params (defined in route).

@fehguy
Copy link
Contributor

fehguy commented Feb 9, 2016

Thanks @frantuma

  • swagger-core 1.5.8-SNAPSHOT has been pushed to sonatype snapshots
  • swagger-scala-module 1.0.2-SNAPSHOT has been pushed to sonatype snapshots

Can you please see that this is working correctly with those versions?

@sarinderv
Copy link

The fix has not resolved my issue ... below are the details:

-- build.sbt --

libraryDependencies += "io.swagger" % "swagger-core" % "1.5.8-SNAPSHOT"
libraryDependencies += "io.swagger" %% "swagger-scala-module" % "1.0.2-SNAPSHOT"
libraryDependencies += "io.swagger" %% "swagger-play2" % "1.5.1"
libraryDependencies += "org.webjars" % "swagger-ui" % "2.1.8-M1"

-- sbt log output --

[info] Resolving io.swagger#swagger-core;1.5.8-SNAPSHOT ...
[info] Resolving io.swagger#swagger-core;1.5.8-SNAPSHOT ...
[info]  found io.swagger#swagger-core;1.5.8-SNAPSHOT in sbt-chain
[info] Resolving com.fasterxml.jackson.datatype#jackson-datatype-joda;2.4.5 ...
[info]  found com.fasterxml.jackson.datatype#jackson-datatype-joda;2.4.5 in sbt-chain
[info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-yaml;2.4.5 ...
[info]  found com.fasterxml.jackson.dataformat#jackson-dataformat-yaml;2.4.5 in sbt-chain
[info] Resolving io.swagger#swagger-models;1.5.8-SNAPSHOT ...
[info] Resolving io.swagger#swagger-models;1.5.8-SNAPSHOT ...
[info]  found io.swagger#swagger-models;1.5.8-SNAPSHOT in sbt-chain
[info] Resolving io.swagger#swagger-annotations;1.5.8-SNAPSHOT ...
[info] Resolving io.swagger#swagger-annotations;1.5.8-SNAPSHOT ...
[info]  found io.swagger#swagger-annotations;1.5.8-SNAPSHOT in sbt-chain
[info] Resolving io.swagger#swagger-scala-module_2.11;1.0.2-SNAPSHOT ...
[info] Resolving io.swagger#swagger-scala-module_2.11;1.0.2-SNAPSHOT ...
[info]  found io.swagger#swagger-scala-module_2.11;1.0.2-SNAPSHOT in sbt-chain
[info] Resolving io.swagger#swagger-play2_2.11;1.5.1 ...
[info]  found io.swagger#swagger-play2_2.11;1.5.1 in sbt-chain
[info] Resolving org.webjars#swagger-ui;2.1.8-M1 ...
[info]  found org.webjars#swagger-ui;2.1.8-M1 in sbt-chain
[info]  io.swagger#swagger-annotations;1.5.8-SNAPSHOT from sbt-chain in [compile, runtime, test, compile-internal, runtime-internal, test-internal]
[info]  io.swagger#swagger-core;1.5.8-SNAPSHOT from sbt-chain in [compile, runtime, test, compile-internal, runtime-internal, test-internal]
[info]  io.swagger#swagger-models;1.5.8-SNAPSHOT from sbt-chain in [compile, runtime, test, compile-internal, runtime-internal, test-internal]
[info]  io.swagger#swagger-play2_2.11;1.5.1 from sbt-chain in [compile, runtime, test, compile-internal, runtime-internal, test-internal]
[info]  io.swagger#swagger-scala-module_2.11;1.0.2-SNAPSHOT from sbt-chain in [compile, runtime, test, compile-internal, runtime-internal, test-internal]
[info]  io.swagger#swagger-core;1.5.6 by [io.swagger#swagger-core;1.5.8-SNAPSHOT] in [compile-internal, compile, test, runtime-internal, test-internal, runtime]
[info]  io.swagger#swagger-scala-module_2.11;1.0.0 by [io.swagger#swagger-scala-module_2.11;1.0.2-SNAPSHOT] in [compile-internal, compile, test, runtime-internal, test-internal, runtime]

-- app log output --

11:05:00.711 [application-akka.actor.default-dispatcher-4] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
11:05:00.729 [ForkJoinPool-1-worker-1] INFO  swagger - Swagger - starting initialisation...
11:05:00.885 [ForkJoinPool-1-worker-1] INFO  swagger - ControllerScanner - looking for controllers with API annotation
11:05:00.888 [ForkJoinPool-1-worker-1] INFO  swagger - Found API controller:  controllers.TimePeriodController
11:05:01.293 [New I/O worker #1] ERROR application - 

! @6p448c61i - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:

1) Error injecting constructor, java.lang.IllegalArgumentException: Unrecognized Type: [null]
  at play.modules.swagger.SwaggerPluginImpl.<init>(SwaggerPlugin.scala:33)
  while locating play.modules.swagger.SwaggerPluginImpl
  at play.modules.swagger.SwaggerModule.bindings(SwaggerModule.scala:11):
Binding(interface play.modules.swagger.SwaggerPlugin to ConstructionTarget(class play.modules.swagger.SwaggerPluginImpl) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
  while locating play.modules.swagger.SwaggerPlugin

-- routes --

GET    /admin/api/time-period        controllers.TimePeriodController.get(year: play.libs.F.Option[java.lang.Integer])

-- TimePeriodController.java --

@io.swagger.annotations.Api
public class TimePeriodController { ... 

@frantuma
Copy link
Member Author

@fehguy it seems to work ok; I have committed updated deps version (1.5.8-SNAPSHOT, 1.0.2-SNAPSHOT).

@sarinderv Did you build this PR and use that in your test? If not, please build or wait until merge.

fehguy added a commit to swagger-api/swagger-samples that referenced this pull request Feb 12, 2016
fehguy added a commit that referenced this pull request Feb 16, 2016
fix #43 - Parameter types handling
@fehguy fehguy merged commit 5d1402b into swagger-api:master Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error injecting constructor with Unrecognized Type: [null]
3 participants