|
1 | 1 | # pylint: disable=too-many-positional-arguments |
2 | 2 | from collections.abc import Callable |
3 | | -from typing import Annotated, Final, TypeAlias |
| 3 | +from typing import Annotated, Final, Literal |
4 | 4 |
|
5 | 5 | import jsonschema |
6 | 6 | from fastapi import APIRouter, Depends, Header, Request, status |
|
34 | 34 | from models_library.projects_nodes_io import NodeID |
35 | 35 | from models_library.projects_state import RunningState |
36 | 36 | from models_library.users import UserID |
37 | | -from pydantic import StringConstraints |
38 | 37 | from servicelib.fastapi.dependencies import get_reverse_url_mapper |
39 | 38 | from simcore_service_api_server._service_jobs import JobService |
40 | 39 |
|
|
60 | 59 | # pylint: disable=too-many-arguments |
61 | 60 | # pylint: disable=cyclic-import |
62 | 61 |
|
63 | | -NullString: TypeAlias = Annotated[str, StringConstraints(pattern="^null$")] |
64 | | - |
65 | 62 | function_router = APIRouter() |
66 | 63 |
|
67 | 64 | _COMMON_FUNCTION_ERROR_RESPONSES: Final[dict] = { |
@@ -378,8 +375,8 @@ async def run_function( # noqa: PLR0913 |
378 | 375 | product_name: Annotated[str, Depends(get_product_name)], |
379 | 376 | solver_service: Annotated[SolverService, Depends(get_solver_service)], |
380 | 377 | 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()], |
383 | 380 | ) -> RegisteredFunctionJob: |
384 | 381 |
|
385 | 382 | parent_project_uuid = ( |
@@ -577,8 +574,8 @@ async def map_function( # noqa: PLR0913 |
577 | 574 | product_name: Annotated[str, Depends(get_product_name)], |
578 | 575 | solver_service: Annotated[SolverService, Depends(get_solver_service)], |
579 | 576 | 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()], |
582 | 579 | ) -> RegisteredFunctionJobCollection: |
583 | 580 | function_jobs = [] |
584 | 581 | function_jobs = [ |
|
0 commit comments