I am trying to send a json response with spray-routing I am getting this error after invoking on complete
Error:(45, 29) type mismatch;
found : _2.Entities.EventsSearchResponse where val _2: eyein.eventful.eventful
required: _3.Entities.EventsSearchResponse where val _3: eyein.eventful.eventful
api.jsonize(value)
^
api.jsonize
is just a wrapper for marshal
Using it in the orginal api file prints the json as string with no problems.
I am mostly interested in the the error there is obviously some typing problem but I am not sure where to begin
this is the route
val myRoute =
path("event" / IntNumber / IntNumber) {(from,to) =>
get {
respondWithMediaType(`application/json`) {
onSuccess(api.GetEventsByDate(from.toString,to.toString)){ value =>
complete{
api.jsonize(value)
}
}
}
}
}
jsonize signature
def jsonize(eventList : Entities.EventsSearchResponse)
Scala considers the types of inner classes to be path-dependent, and does not always infer path-dependent types the way you'd expect. Try giving it an explicitly path-dependent type:
onSuccess(api.GetEventsByDate(...): Future[api.Entities.EventsSearchResponse]) {
value: api.Entities.EventsSearchResponse => ...
}
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.