I have a backend application (Java 8) and an Angular frontend. Now, I added a file upload using multipart/formdata. We use openapi to generate the api code. Here's the part of the code used to generate it:
"post": {
...
"consumes" : [
"multipart/form-data"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "updateFile",
"in": "formData",
"type": "file",
"required": true,
}
],
...
}
And the frontend prepares the file as such:
const formData = new FormData();
formData.append('updateFile', updateFile);
This actually works quite well and provides us a Part
-Object. Unfortunately the machine this code will run on in production is quite weak and the uploaded file will be too large to be handled in the memory of it (~130mb). So, I need a workaround for this. I think accessing the incoming stream would be an elegant way to write the file to some temp directory "on-the-fly" and I've come across code samples doing exactly that. I can't figure out how to configure my endpoint to provide a stream instead of the "finished" Part
-Object.
Unfortunately this project uses a quite old openapi version 2.