Skip to content

Support Play 2.5 #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
camuthig opened this issue Jul 19, 2016 · 9 comments
Open

Support Play 2.5 #55

camuthig opened this issue Jul 19, 2016 · 9 comments

Comments

@camuthig
Copy link
Contributor

The current documented play-json version is causing errors with Play 2.5 applications.

java.lang.NoSuchMethodError: play.api.libs.functional.syntax.package$.functionalCanBuildApplicative(Lplay/api/libs/functional/Applicative;)Lplay/api/libs/functional/FunctionalCanBuild;
at org.zalando.jsonapi.json.playjson.PlayJsonJsonapiFormat$class.rootObjectFormat(PlayJsonJsonapiFormat.scala:18)
at org.zalando.jsonapi.json.playjson.PlayJsonJsonapiSupport$.rootObjectFormat$lzycompute(PlayJsonJsonapiSupport.scala:19)
at org.zalando.jsonapi.json.playjson.PlayJsonJsonapiSupport$.rootObjectFormat(PlayJsonJsonapiSupport.scala:19)

@zmeda
Copy link
Contributor

zmeda commented Jul 19, 2016

Is this issue now "solved" by using proper dependencies and updated README?

@camuthig
Copy link
Contributor Author

Just based on the changes in the documentation, this error still occurs on Play 2.5 apps. I was able to correct this problem locally (haven't yet pushed this change to my fork yet) by updating the scala-jsonapi build.sbt to use an up to date play-json depdendency:

"com.typesafe.play" %% "play-json" % "2.5.4" % "provided",

However, I am not certain this is a backwards safe change, so it would lead me to think a major release increase would be needed.

Another solution I thought of, still not necessarily backwards compatible from 0.5.0 , would be to break up the project to be more modular. Instead of depending on scala-jsonapi, consumers could depend on play-scala-jsonapi or spray-scala-jsonapi. Each of these would in turn rely on scala-jsonapi for the bulk of the logic and really just provide wrappers around the actual JSON support. This could give two major improvements from my point of view:

  1. It allows each support module to be upgraded independently based on changes in the external packages.
  2. It allows for projects like play-scala-jsonapi to explicitly bring in Spray based packages that Play developers normally wouldn't think to include, fixing some of the documentation confusion as well.

@nehalium
Copy link

Can you override the dependency by adding this to project/plugins.sbt in your project?

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.5.4" % "provided"

@zmeda
Copy link
Contributor

zmeda commented Jul 30, 2016

I was also thinking of splitting this into more modular pieces, namely:

  • scala-jsonapi-core - which would only have domain model definition and upstream transformation (reader and writer definition, etc.)
  • scala-jsonapi-spray - which would use core underneath (ofc) and all necessary spray-json and spray.io (marshallers and unmarshallers) needed
  • scala-jsonapi-play - same as above just for play
  • scala-jsonapi-akkahttp - spray-json + akkahttp (un)marshallers

I tried to achieve this by having one repo (one project as it is now) and just using provided library dependencies. We could create submodules and package them into separate library while still maintaining one single repo. If you think separating the repos makes more sense I'd love to hear more about that.

Please give feedback.

@camuthig
Copy link
Contributor Author

Sorry for the very slow response. I was kinda dragged away from this.

@nehalium I tried adding the line to my plugins.sbt and just get a dependency issue (Unresolved dependency). Adding it directly to my build.sbt though did not throw any build errors, but also still did not solve the underlying problem.

@tianhao-au
Copy link

Does it support Play framework 2.5 or not? I thought already supported :-)

@frne
Copy link

frne commented Jan 31, 2017

@camuthig AFAIK, it is almost impossible to support multiple play-versions when depending on play libs, cause they have bc breaks between major versions (epoch.major.minor)...

swagger-play e.g. did a subtree split and is copying code for each play version. Or you could bump up major version for play 2.5 (depends on versioning scheme).

One solution, as @zmeda mentioned, would be to split play glue-code into a separate project and sync versioning with play-framework...

@wsargent
Copy link

wsargent commented Feb 22, 2017

@frne fyi, Play's versioning scheme is epoch.major.minor -- Play 2.5 is binary incompatible with Play 2.4.

@frne
Copy link

frne commented Feb 23, 2017

@wsargent Thx for clarification. That's what I meant...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants