Skip to content

Commit 375c87f

Browse files
committed
Internal: API: Improve documentation about the '/api/documents/download-selected' endpoint
1 parent 003ccb2 commit 375c87f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/CourseBundle/Entity/CDocument.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@
164164
controller: DownloadSelectedDocumentsAction::class,
165165
openapi: new Operation(
166166
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.',
167168
requestBody: new RequestBody(
169+
description: 'List of document IDs to include in the ZIP file',
168170
content: new ArrayObject([
169171
'application/json' => [
170172
'schema' => [
@@ -175,25 +177,45 @@
175177
'items' => ['type' => 'integer'],
176178
],
177179
],
180+
'required' => ['ids'],
178181
],
179182
],
180183
]),
184+
required: true,
181185
),
182186
responses: [
183187
201 => new Response(
188+
description: 'The ZIP file is being streamed to the client',
184189
content: new ArrayObject([
185190
DownloadSelectedDocumentsAction::CONTENT_TYPE => [
186191
'schema' => [
187192
'type' => 'string',
188193
'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"',
189211
],
190212
],
191213
]),
192214
),
193215
]
194216
),
195217
security: "is_granted('ROLE_USER')",
196-
outputFormats: ['zip' => 'application/zip'],
218+
outputFormats: ['zip' => DownloadSelectedDocumentsAction::CONTENT_TYPE],
197219
),
198220
new GetCollection(
199221
openapi: new Operation(

0 commit comments

Comments
 (0)