Skip to content

Commit 1726889

Browse files
committed
only allow string value null
1 parent 73f95a3 commit 1726889

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

services/api-server/openapi.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7597,7 +7597,8 @@
75977597
"format": "uuid"
75987598
},
75997599
{
7600-
"type": "null"
7600+
"type": "string",
7601+
"pattern": "^null$"
76017602
}
76027603
],
76037604
"title": "X-Simcore-Parent-Project-Uuid"
@@ -7614,7 +7615,8 @@
76147615
"format": "uuid"
76157616
},
76167617
{
7617-
"type": "null"
7618+
"type": "string",
7619+
"pattern": "^null$"
76187620
}
76197621
],
76207622
"title": "X-Simcore-Parent-Node-Id"
@@ -7726,6 +7728,10 @@
77267728
"type": "string",
77277729
"format": "uuid"
77287730
},
7731+
{
7732+
"type": "string",
7733+
"pattern": "^null$"
7734+
},
77297735
{
77307736
"type": "null"
77317737
}
@@ -7744,7 +7750,8 @@
77447750
"format": "uuid"
77457751
},
77467752
{
7747-
"type": "null"
7753+
"type": "string",
7754+
"pattern": "^null$"
77487755
}
77497756
],
77507757
"title": "X-Simcore-Parent-Node-Id"

services/api-server/src/simcore_service_api_server/api/routes/functions_routes.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,20 @@ async def run_function( # noqa: PLR0913
377377
product_name: Annotated[str, Depends(get_product_name)],
378378
solver_service: Annotated[SolverService, Depends(get_solver_service)],
379379
job_service: Annotated[JobService, Depends(get_job_service)],
380-
x_simcore_parent_project_uuid: Annotated[ProjectID | NullString | None, Header()],
381-
x_simcore_parent_node_id: Annotated[NodeID | NullString | None, Header()],
380+
x_simcore_parent_project_uuid: Annotated[ProjectID | NullString, Header()],
381+
x_simcore_parent_node_id: Annotated[NodeID | NullString, Header()],
382382
) -> RegisteredFunctionJob:
383383

384-
if not isinstance(x_simcore_parent_project_uuid, ProjectID):
385-
x_simcore_parent_project_uuid = None
386-
if not isinstance(x_simcore_parent_node_id, NodeID):
387-
x_simcore_parent_node_id = None
384+
parent_project_uuid = (
385+
x_simcore_parent_project_uuid
386+
if isinstance(x_simcore_parent_project_uuid, ProjectID)
387+
else None
388+
)
389+
parent_node_id = (
390+
x_simcore_parent_node_id
391+
if isinstance(x_simcore_parent_node_id, NodeID)
392+
else None
393+
)
388394

389395
# Make sure the user is allowed to execute any function
390396
# (read/write right is checked in the other endpoint called in this method)
@@ -455,8 +461,8 @@ async def run_function( # noqa: PLR0913
455461
webserver_api=webserver_api,
456462
wb_api_rpc=wb_api_rpc,
457463
url_for=url_for,
458-
x_simcore_parent_project_uuid=x_simcore_parent_project_uuid,
459-
x_simcore_parent_node_id=x_simcore_parent_node_id,
464+
x_simcore_parent_project_uuid=parent_project_uuid,
465+
x_simcore_parent_node_id=parent_node_id,
460466
user_id=user_id,
461467
product_name=product_name,
462468
)
@@ -490,8 +496,8 @@ async def run_function( # noqa: PLR0913
490496
solver_service=solver_service,
491497
job_service=job_service,
492498
url_for=url_for,
493-
x_simcore_parent_project_uuid=x_simcore_parent_project_uuid,
494-
x_simcore_parent_node_id=x_simcore_parent_node_id,
499+
x_simcore_parent_project_uuid=parent_project_uuid,
500+
x_simcore_parent_node_id=parent_node_id,
495501
)
496502
await solvers_jobs.start_job(
497503
request=request,

0 commit comments

Comments
 (0)