-
Notifications
You must be signed in to change notification settings - Fork 398
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
Play server interpreter impl #291
Conversation
override def headers: Seq[(String, String)] = request.headers.headers | ||
override def queryParameter(name: String): Seq[String] = request.queryString.get(name).toSeq.flatten | ||
override def queryParameters: Map[String, Seq[String]] = request.queryString | ||
override def bodyStream: Any = ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to get a body stream here? I found that there is even an Accumulator.source
but every accumulator evaluates to a Future
. How to just get a Source[Byte, _]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure that Play framework does not support input body streaming. How should we handle this case, what do we want to return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for a clarification. As discussed with @adamw we will throw an exception here.
server/play-server/src/main/scala/tapir/server/play/OutputToPlayResponse.scala
Outdated
Show resolved
Hide resolved
Multipart.handleFilePartAsTemporaryFile(serverOptions.temporaryFileCreator) | ||
) | ||
bodyParser.apply(request).run().flatMap { | ||
case Left(value) => Future.failed(new RuntimeException(s"TODO handle it $value")) // what to do here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this happens while handling multipart/form-data
? Should we use some other BodyParser
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zZKato any idea how to fix this? From my investigation it seems that play does some magic behind the scenes, before throwing it into multipartFormData body parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghostbuster91 I think the problem here is that you handle the whole request as a FilePart even though we also have to consider DataParts (afaik).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll investigate a bit further
I have implemented the Tapir output to Play response part for MultipartFormData, can i have write permissions on this branch? (It is a bit of a hacky implementation but it is the same as PlayServer does it with its BodyWriteable for MultipartFormData) |
I am not sure how to give you permission to only this branch, I don't think that there is such an option. AFAIK you can update your fork, so you will have this branch. And then open a new pull request. That way both of us will have a write permissions. |
I created a PR that merges the commits into this branch from the forked repo #314 |
Implemented mapping from output to multipart form data
# Conflicts: # project/Versions.scala # server/tests/src/main/scala/sttp/tapir/server/tests/ServerTests.scala
created PR to merge master into this branch to keep this up2date, there are still 3 tests failing that i will take a look at -> #372 |
Play server interpreter impl
Awesome, merged :) Thanks! |
@zZKato do you think the current state is mergeable? Or are you maybe planning to do some more work on this? Would be great to have at least a basic implementation in the sources :) |
@adamw hi Adam, I don't think its mergable yet, i still think it needs a little work, however i have been super busy at work and didn't really take time to take another look at this. After my current work project is done I will take another look. I'm sorry for the delays |
…preter_impl # Conflicts: # build.sbt # project/Versions.scala # server/tests/src/main/scala/sttp/tapir/server/tests/ServerTests.scala
@adamw @ghostbuster91 I paired on the last bit of this with a colleague of mine and I believe the implementation is now complete, there is a PR from the fork to this branch which has all the changes (we also pulled in master again) PR -> #502 |
The last part was a bit tricky, we ran into a couple of issues:
|
This reverts commit b4ca594
fix multipart form data implementation and broken tests
Released in 0.12.28. Thanks! :) |
Issues that need to be resolved:
This closes #65