Skip to content

Commit 46af347

Browse files
committed
use Literal @pcrespov
1 parent 75e100f commit 46af347

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=too-many-positional-arguments
22
from collections.abc import Callable
3-
from typing import Annotated, Final, TypeAlias
3+
from typing import Annotated, Final, Literal
44

55
import jsonschema
66
from fastapi import APIRouter, Depends, Header, Request, status
@@ -34,7 +34,6 @@
3434
from models_library.projects_nodes_io import NodeID
3535
from models_library.projects_state import RunningState
3636
from models_library.users import UserID
37-
from pydantic import StringConstraints
3837
from servicelib.fastapi.dependencies import get_reverse_url_mapper
3938
from simcore_service_api_server._service_jobs import JobService
4039

@@ -60,8 +59,6 @@
6059
# pylint: disable=too-many-arguments
6160
# pylint: disable=cyclic-import
6261

63-
NullString: TypeAlias = Annotated[str, StringConstraints(pattern="^null$")]
64-
6562
function_router = APIRouter()
6663

6764
_COMMON_FUNCTION_ERROR_RESPONSES: Final[dict] = {
@@ -378,8 +375,8 @@ async def run_function( # noqa: PLR0913
378375
product_name: Annotated[str, Depends(get_product_name)],
379376
solver_service: Annotated[SolverService, Depends(get_solver_service)],
380377
job_service: Annotated[JobService, Depends(get_job_service)],
381-
x_simcore_parent_project_uuid: Annotated[ProjectID | NullString, Header()],
382-
x_simcore_parent_node_id: Annotated[NodeID | NullString, Header()],
378+
x_simcore_parent_project_uuid: Annotated[ProjectID | Literal["null"], Header()],
379+
x_simcore_parent_node_id: Annotated[NodeID | Literal["null"], Header()],
383380
) -> RegisteredFunctionJob:
384381

385382
parent_project_uuid = (
@@ -577,8 +574,8 @@ async def map_function( # noqa: PLR0913
577574
product_name: Annotated[str, Depends(get_product_name)],
578575
solver_service: Annotated[SolverService, Depends(get_solver_service)],
579576
job_service: Annotated[JobService, Depends(get_job_service)],
580-
x_simcore_parent_project_uuid: Annotated[ProjectID | NullString, Header()],
581-
x_simcore_parent_node_id: Annotated[NodeID | NullString, Header()],
577+
x_simcore_parent_project_uuid: Annotated[ProjectID | Literal["null"], Header()],
578+
x_simcore_parent_node_id: Annotated[NodeID | Literal["null"], Header()],
582579
) -> RegisteredFunctionJobCollection:
583580
function_jobs = []
584581
function_jobs = [

0 commit comments

Comments
 (0)