Skip to content
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

Cannot Unmarshall Seq[String] Outside #4307

Closed
AlexWeinstein92 opened this issue Sep 11, 2023 · 1 comment
Closed

Cannot Unmarshall Seq[String] Outside #4307

AlexWeinstein92 opened this issue Sep 11, 2023 · 1 comment

Comments

@AlexWeinstein92
Copy link

AlexWeinstein92 commented Sep 11, 2023

I have a route that successfully uses complete after onSuccess to transform a Seq[GeneratedMessage] to Seq[String].

                onSuccess(
                  handler.func(...)
                ) { dataSeq =>
                  complete(
                    dataSeq.map(_.customPrint)
                  )
                }

However when I move the route to a function designed to replicate the route in its & other places, I get an IDE error saying Cannot resolve overloaded method 'complete'. I also get compiler error saying

found   : Seq[String]
[error]  required: akka.http.scaladsl.marshalling.ToResponseMarshallable

I'm not really sure what else to provide here... originally I was inside other Routes inside a trait which extends ErrorAccumulatingCirceSupport with StrictLogging. Now I am in a simple object. But I don't think expect of those things would have anything to do with this... the function that turns the GeneratedMessage into String is passed in now as a parameter to a def in the object I created, but all it does is call a custom helper function on GeneratedMessage that I wasn't able to call inside my def due to type erasure...

                onSuccess(
                  handlerFunc(...)
                ) { dataSeq =>
                  complete(
                    dataSeq.map(completeFunc)
                  )
                }

where completeFunc is a paramater passed in as {data => data.customPrint} and handlerFunc is also a parameter passed in as handler.func.

Essentially I built the function in the file it was originally in and the copy-pasted to a common object that I can use in other places. It was working fine within the original file. Now, it doesn't seem to want to transform my Seq[String] to toResponseMarshallable.

@johanandren
Copy link
Member

Not sure what is the problem here but sounds like it could be more of a question than an actual bug or feature request, so please run it through the forums at https://discuss.akka.io and see if someone can help your. If it turns out to be an actual bug we'll re-open this issue.

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

2 participants