|
164 | 164 | controller: DownloadSelectedDocumentsAction::class, |
165 | 165 | openapi: new Operation( |
166 | 166 | summary: 'Download selected documents as a ZIP file.', |
| 167 | + description: 'Streams a ZIP archive generated on-the-fly. The ZIP file includes folders and files selected.', |
167 | 168 | requestBody: new RequestBody( |
| 169 | + description: 'List of document IDs to include in the ZIP file', |
168 | 170 | content: new ArrayObject([ |
169 | 171 | 'application/json' => [ |
170 | 172 | 'schema' => [ |
|
175 | 177 | 'items' => ['type' => 'integer'], |
176 | 178 | ], |
177 | 179 | ], |
| 180 | + 'required' => ['ids'], |
178 | 181 | ], |
179 | 182 | ], |
180 | 183 | ]), |
| 184 | + required: true, |
181 | 185 | ), |
182 | 186 | responses: [ |
183 | 187 | 201 => new Response( |
| 188 | + description: 'The ZIP file is being streamed to the client', |
184 | 189 | content: new ArrayObject([ |
185 | 190 | DownloadSelectedDocumentsAction::CONTENT_TYPE => [ |
186 | 191 | 'schema' => [ |
187 | 192 | 'type' => 'string', |
188 | 193 | 'format' => 'binary', |
| 194 | + 'description' => 'Streamed ZIP file', |
| 195 | + ], |
| 196 | + ], |
| 197 | + ]), |
| 198 | + headers: new ArrayObject([ |
| 199 | + 'Content-Type' => [ |
| 200 | + 'description' => 'MIME type identifying the streamed file', |
| 201 | + 'schema' => [ |
| 202 | + 'type' => 'string', |
| 203 | + 'example' => DownloadSelectedDocumentsAction::CONTENT_TYPE, |
| 204 | + ], |
| 205 | + ], |
| 206 | + 'Content-Disposition' => [ |
| 207 | + 'description' => 'Indicates that the response is meant to be downloaded as a file', |
| 208 | + 'schema' => [ |
| 209 | + 'type' => 'string', |
| 210 | + 'example' => 'attachment; filename="selected_documents.zip"', |
189 | 211 | ], |
190 | 212 | ], |
191 | 213 | ]), |
192 | 214 | ), |
193 | 215 | ] |
194 | 216 | ), |
195 | 217 | security: "is_granted('ROLE_USER')", |
196 | | - outputFormats: ['zip' => 'application/zip'], |
| 218 | + outputFormats: ['zip' => DownloadSelectedDocumentsAction::CONTENT_TYPE], |
197 | 219 | ), |
198 | 220 | new GetCollection( |
199 | 221 | openapi: new Operation( |
|
0 commit comments