You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I'm facing compile errors on the server-side while trying to integrate Autowire within my existing Spray code that uses uPickle for serialization.
Here's my UPickleJsonSupport trait mixed into my Spray HttpService:
And my Spray route definition (rest of the code omitted for brevity):
defapiRoute= post {
path("api"/Segments) { s =>
extract(_.request.entity.asString) { e =>
complete {
AutowireServer.route[Api](ApiImpl)(
autowire.Core.Request(
s,
upickle.json.read(e).asInstanceOf[Js.Obj].value.toMap
)
)
}
}
}
}
With this code, I've got a sh*tload of compile errors (all related to this problem), ending with these:
...
[error] both value derive$macro$173 of type => upickle.default.Writer[upickle.Js.Value]
[error] and value derive$macro$175 of type => upickle.default.Writer[upickle.Js.Value]
[error] match expected type upickle.default.Writer[upickle.Js.Value]
[error] /Users/toto/someproject/jvm/src/main/scala/some/pkg/RouteProvider.scala:38: diverging implicit expansion for type upickle.default.Writer[T1]
[error] starting with macro method macroW in trait LowPriX
[error] AutowireServer.route[Api](ApiImpl)(
[error] ^
[error] 13 errors found
My current knowledge of scala (which is rather poor) does not allow me to find the root cause of the problem. Looks like a clash between implicits generated by the macros ???
Now, the problem may come from uPickle rather than Autowire but since uPickle was working before I added Autowire, I create the ticket here ;)
In the meantime, I will simply generate Spray's HttpEntity myself (thus skipping the Marshaller) by adding this transformation on the router result .map(v => HttpEntity(jsonContentType, upickle.json.write(v))) but I guess (and hope) it should be possible to combine both libs.
Thanks for your help.
The text was updated successfully, but these errors were encountered:
I'm getting a somewhat similar error in my Play application:
ambiguous implicit values:
both value derive$macro$30 of type => upickle.default.Writer[shared.IssueState]
and value derive$macro$37 of type => upickle.default.Writer[shared.SideState]
match expected type upickle.default.Writer[T1]
In /Users/alexhall/Dropbox/scala/debate/server/app/controllers/Application.scala:22
19 val requestText = request.body.asText.get
20 val requestJson = upickle.json.read(requestText).asInstanceOf[Js.Obj].value.toMap
21 val coreRequest: Core.Request[Value] = autowire.Core.Request(parts.split("/"), requestJson).asInstanceOf[Core.Request[Value]]
22 val future: Future[String] = AutowireServer.route[SharedApi](ApiImpl)(coreRequest).map(upickle.json.write(_))
23 val resultString: String = future.value.get.get
24 Ok(resultString)
25 }
Hi there, I'm facing compile errors on the server-side while trying to integrate Autowire within my existing Spray code that uses uPickle for serialization.
Here's my
UPickleJsonSupport
trait mixed into my Spray HttpService:Ok, this is for the integration with Spray marshalling and this works fine until I throw Autowire into the mix:
Here's my
AutowireServer
:And my Spray route definition (rest of the code omitted for brevity):
With this code, I've got a sh*tload of compile errors (all related to this problem), ending with these:
My current knowledge of scala (which is rather poor) does not allow me to find the root cause of the problem. Looks like a clash between implicits generated by the macros ???
Now, the problem may come from uPickle rather than Autowire but since uPickle was working before I added Autowire, I create the ticket here ;)
In the meantime, I will simply generate Spray's HttpEntity myself (thus skipping the Marshaller) by adding this transformation on the router result
.map(v => HttpEntity(jsonContentType, upickle.json.write(v)))
but I guess (and hope) it should be possible to combine both libs.Thanks for your help.
The text was updated successfully, but these errors were encountered: