softwaremill / softwaremill/tapir
[Feature request] cleanup fileBody after successful response
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.5k
- Forks
- 468
- Avg merge
- 5h 37m
- Merged PRs (30d)
- 34
Description
Hi :)
Like we discussed on Tapir gitter it would be desirable for some use cases to have a way to cleanup/remove file provided as response body to an endpoint that declare out as fileBody, e.g. export endpoint that create temporary file that is no longer needed after an endpoint returned response.
Currently the only way that I managed to implement e2e is either:
- returning stream that will cleanup file on finish https://github.com/softwaremill/adopt-tapir/blob/main/backend/src/main/scala/com/softwaremill/adopttapir/starter/api/StarterApi.scala#L46
- convert file to byteStream and remove it in an endpoint logic explicitly
.out(byteBufferBody and header("Content-Type", "text/csv"))
More context in this gitter thread: https://gitter.im/softwaremill/tapir?at=629dc6c4c61b987d33e59c2e
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the fileBody response path with the linked adopt-tapir StarterApi.scala example, and review how the endpoint's out("fileBody") response is handled. The change is complete when a temporary file can be removed after a successful response without requiring callers to convert it to a byte stream or manage cleanup explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100