Skip to content

Commit db55e79

Browse files
committed
fix openapi spec test
1 parent d614e7e commit db55e79

File tree

3 files changed

+131
-13
lines changed

3 files changed

+131
-13
lines changed

api/specs/web-server/_storage.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66

77
from typing import TypeAlias
8+
from uuid import UUID
89

910
from fastapi import APIRouter, Query, status
1011
from models_library.generics import Envelope
1112
from models_library.projects_nodes_io import LocationID
1213
from models_library.storage_schemas import (
1314
AsyncJobGet,
15+
AsyncJobResult,
1416
AsyncJobStatus,
1517
DataExportPost,
1618
FileLocation,
@@ -174,19 +176,36 @@ async def is_completed_upload_file(
174176

175177
# data export
176178
@router.post(
177-
"/storage/export-data",
179+
"/storage/locations/{location_id}/export-data",
178180
response_model=Envelope[AsyncJobGet],
179181
name="storage_export_data",
180182
description="Export data",
181183
)
182-
async def export_data(data_export: DataExportPost):
184+
async def export_data(data_export: DataExportPost, location_id: LocationID):
183185
"""Trigger data export. Returns async job id for getting status and results"""
184186

185187

186188
@router.get(
187-
"/storage/async-jobs/status",
189+
"/storage/async-jobs/{job_id}/status",
188190
response_model=Envelope[AsyncJobStatus],
189191
name="storage_async_job_status",
190192
)
191-
async def get_async_job_status(task_id: AsyncJobGet):
193+
async def get_async_job_status(task_id: AsyncJobGet, job_id: UUID):
194+
"""Get async job status"""
195+
196+
197+
@router.post(
198+
"/storage/async-jobs/{job_id}:abort",
199+
name="abort_async_job",
200+
)
201+
async def abort_async_job(task_id: AsyncJobGet, job_id: UUID):
202+
"""Get async job status"""
203+
204+
205+
@router.get(
206+
"/storage/async-jobs/{job_id}/result",
207+
response_model=Envelope[AsyncJobResult],
208+
name="get_async_job_result",
209+
)
210+
async def get_async_job_result(task_id: AsyncJobGet, job_id: UUID):
192211
"""Get async job status"""

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 104 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6351,46 +6351,116 @@ paths:
63516351
application/json:
63526352
schema:
63536353
$ref: '#/components/schemas/Envelope_FileUploadCompleteFutureResponse_'
6354-
/v0/storage/export-data:
6354+
/v0/storage/locations/{location_id}/export-data:
63556355
post:
63566356
tags:
63576357
- storage
63586358
summary: Storage Export Data
63596359
description: Export data
63606360
operationId: export_data
6361+
parameters:
6362+
- name: location_id
6363+
in: path
6364+
required: true
6365+
schema:
6366+
type: integer
6367+
title: Location Id
63616368
requestBody:
6369+
required: true
63626370
content:
63636371
application/json:
63646372
schema:
63656373
$ref: '#/components/schemas/DataExportPost'
6366-
required: true
63676374
responses:
63686375
'200':
63696376
description: Successful Response
63706377
content:
63716378
application/json:
63726379
schema:
63736380
$ref: '#/components/schemas/Envelope_AsyncJobGet_'
6374-
/v0/storage/async-jobs/status:
6381+
/v0/storage/async-jobs/{job_id}/status:
63756382
get:
63766383
tags:
63776384
- storage
63786385
summary: Storage Async Job Status
63796386
description: Get async job status
63806387
operationId: get_async_job_status
6388+
parameters:
6389+
- name: job_id
6390+
in: path
6391+
required: true
6392+
schema:
6393+
type: string
6394+
format: uuid
6395+
title: Job Id
63816396
requestBody:
6397+
required: true
63826398
content:
63836399
application/json:
63846400
schema:
63856401
$ref: '#/components/schemas/AsyncJobGet'
6386-
required: true
63876402
responses:
63886403
'200':
63896404
description: Successful Response
63906405
content:
63916406
application/json:
63926407
schema:
63936408
$ref: '#/components/schemas/Envelope_AsyncJobStatus_'
6409+
/v0/storage/async-jobs/{job_id}:abort:
6410+
post:
6411+
tags:
6412+
- storage
6413+
summary: Abort Async Job
6414+
description: Get async job status
6415+
operationId: abort_async_job
6416+
parameters:
6417+
- name: job_id
6418+
in: path
6419+
required: true
6420+
schema:
6421+
type: string
6422+
format: uuid
6423+
title: Job Id
6424+
requestBody:
6425+
required: true
6426+
content:
6427+
application/json:
6428+
schema:
6429+
$ref: '#/components/schemas/AsyncJobGet'
6430+
responses:
6431+
'200':
6432+
description: Successful Response
6433+
content:
6434+
application/json:
6435+
schema: {}
6436+
/v0/storage/async-jobs/{job_id}/result:
6437+
get:
6438+
tags:
6439+
- storage
6440+
summary: Get Async Job Result
6441+
description: Get async job status
6442+
operationId: get_async_job_result
6443+
parameters:
6444+
- name: job_id
6445+
in: path
6446+
required: true
6447+
schema:
6448+
type: string
6449+
format: uuid
6450+
title: Job Id
6451+
requestBody:
6452+
required: true
6453+
content:
6454+
application/json:
6455+
schema:
6456+
$ref: '#/components/schemas/AsyncJobGet'
6457+
responses:
6458+
'200':
6459+
description: Successful Response
6460+
content:
6461+
application/json:
6462+
schema:
6463+
$ref: '#/components/schemas/Envelope_AsyncJobResult_'
63946464
/v0/trash:empty:
63956465
post:
63966466
tags:
@@ -7681,6 +7751,23 @@ components:
76817751
required:
76827752
- job_id
76837753
title: AsyncJobGet
7754+
AsyncJobResult:
7755+
properties:
7756+
result:
7757+
anyOf:
7758+
- {}
7759+
- type: 'null'
7760+
title: Result
7761+
error:
7762+
anyOf:
7763+
- {}
7764+
- type: 'null'
7765+
title: Error
7766+
type: object
7767+
required:
7768+
- result
7769+
- error
7770+
title: AsyncJobResult
76847771
AsyncJobStatus:
76857772
properties:
76867773
job_id:
@@ -8503,6 +8590,19 @@ components:
85038590
title: Error
85048591
type: object
85058592
title: Envelope[AsyncJobGet]
8593+
Envelope_AsyncJobResult_:
8594+
properties:
8595+
data:
8596+
anyOf:
8597+
- $ref: '#/components/schemas/AsyncJobResult'
8598+
- type: 'null'
8599+
error:
8600+
anyOf:
8601+
- {}
8602+
- type: 'null'
8603+
title: Error
8604+
type: object
8605+
title: Envelope[AsyncJobResult]
85068606
Envelope_AsyncJobStatus_:
85078607
properties:
85088608
data:

services/web/server/src/simcore_service_webserver/storage/_handlers.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,7 @@ class _PathParams(BaseModel):
380380

381381

382382
@routes.post(
383-
_storage_locations_prefix + "/{location_id}/export-data",
384-
name="storage_export_data",
383+
_storage_locations_prefix + "/{location_id}/export-data", name="export_data"
385384
)
386385
@login_required
387386
@permission_required("storage.files.*")
@@ -413,7 +412,7 @@ class _PathParams(BaseModel):
413412

414413
@routes.get(
415414
_storage_prefix + "/async-jobs/{job_id}/status",
416-
name="storage_async_job_status",
415+
name="get_async_job_status",
417416
)
418417
@login_required
419418
@permission_required("storage.files.*")
@@ -435,7 +434,7 @@ async def get_async_job_status(request: web.Request) -> web.Response:
435434

436435
@routes.post(
437436
_storage_prefix + "/async-jobs/{job_id}:abort",
438-
name="storage_async_job_abort",
437+
name="abort_async_job",
439438
)
440439
@login_required
441440
@permission_required("storage.files.*")
@@ -457,7 +456,7 @@ async def abort_async_job(request: web.Request) -> web.Response:
457456

458457
@routes.get(
459458
_storage_prefix + "/async-jobs/{job_id}/result",
460-
name="storage_async_job_result",
459+
name="get_async_job_result",
461460
)
462461
@login_required
463462
@permission_required("storage.files.*")

0 commit comments

Comments
 (0)