Skip to content

Commit baf7bc1

Browse files
committed
Merge branch '201-experiment-with-upgrading-openapi-generator' of github.com:bisgaard-itis/osparc-simcore-clients into 201-experiment-with-upgrading-openapi-generator
2 parents 5d37230 + 866fa8a commit baf7bc1

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

clients/python/src/osparc/_api_solvers_api.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
from tempfile import NamedTemporaryFile
3030
from pathlib import Path
3131
from pydantic import validate_call
32-
from pydantic import Field, StrictStr
33-
from typing import Annotated
32+
from pydantic import StrictStr
3433

3534

3635
class SolversApi(_SolversApi):
@@ -122,8 +121,8 @@ def create_job(
122121

123122
def get_job_output_logfile(
124123
self,
125-
solver_key: Annotated[str, Field(strict=True)],
126-
version: Annotated[str, Field(strict=True)],
124+
solver_key: str,
125+
version: str,
127126
job_id: StrictStr,
128127
**kwargs,
129128
):
@@ -137,8 +136,8 @@ def get_job_output_logfile(
137136

138137
def get_job_outputs(
139138
self,
140-
solver_key: Annotated[str, Field(strict=True)],
141-
version: Annotated[str, Field(strict=True)],
139+
solver_key: str,
140+
version: str,
142141
job_id: StrictStr,
143142
**kwargs,
144143
) -> JobOutputs:

clients/python/src/osparc/_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from osparc_client import JobMetadata as _JobMetadata
44
from osparc_client import JobMetadataUpdate as _JobMetadataUpdate
55
from .models import File
6-
from typing import Dict, Union, List
6+
from typing import Dict, Union, List, Optional
77
from pydantic import BaseModel, StrictStr, Field
88

99

@@ -30,7 +30,7 @@ class JobOutputs(BaseModel):
3030
class JobMetadata(BaseModel):
3131
job_id: StrictStr
3232
metadata: Dict[str, Union[bool, float, int, str, None]]
33-
url: str | None
33+
url: Optional[str]
3434

3535

3636
assert set(_JobMetadata.model_fields.keys()) == set(JobMetadata.model_fields.keys())

clients/python/test/test_osparc/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import json
1515
from tempfile import NamedTemporaryFile
1616
from pathlib import Path
17-
from typing import Any, TypeVar, NamedTuple, Final, cast
17+
from typing import Any, TypeVar, NamedTuple, Final, cast, Dict, Type, Set
1818
from urllib.parse import urlparse
1919
from parse import parse, with_pattern
2020

@@ -29,7 +29,7 @@ def cfg(faker: Faker) -> osparc.Configuration:
2929

3030

3131
@pytest.fixture
32-
def osparc_openapi_specs() -> Generator[dict[str, Any], None, None]:
32+
def osparc_openapi_specs() -> Generator[Dict[str, Any], None, None]:
3333
with NamedTemporaryFile(suffix=".json") as file:
3434
file = Path(file.name)
3535
file.write_text(json.dumps(osparc.openapi()))
@@ -67,7 +67,7 @@ class ServerPath(NamedTuple):
6767

6868

6969
@pytest.fixture
70-
def all_server_paths(osparc_openapi_specs: dict[str, Any]) -> set[ServerPath]:
70+
def all_server_paths(osparc_openapi_specs: Dict[str, Any]) -> Set[ServerPath]:
7171
server_paths = set()
7272
for path in osparc_openapi_specs["paths"]:
7373
for method in osparc_openapi_specs["paths"][path]:
@@ -89,9 +89,9 @@ def all_server_paths(osparc_openapi_specs: dict[str, Any]) -> set[ServerPath]:
8989

9090
@pytest.fixture
9191
def create_osparc_response_model(
92-
osparc_openapi_specs: dict[str, Any],
93-
) -> Callable[[type[T]], T]:
94-
def _create_model(model_type: type[T]) -> T:
92+
osparc_openapi_specs: Dict[str, Any],
93+
) -> Callable[[Type[T]], T]:
94+
def _create_model(model_type: Type[T]) -> T:
9595
schemas = osparc_openapi_specs.get("components", {}).get("schemas", {})
9696
example_data = schemas.get(model_type.__name__, {}).get("example")
9797
error_msg = "Could not extract example data for"
@@ -105,8 +105,8 @@ def _create_model(model_type: type[T]) -> T:
105105
@pytest.fixture
106106
def create_server_mock(
107107
mocker: MockerFixture,
108-
osparc_openapi_specs: dict[str, Any],
109-
all_server_paths: set[ServerPath],
108+
osparc_openapi_specs: Dict[str, Any],
109+
all_server_paths: Set[ServerPath],
110110
create_osparc_response_model: Callable[[str], BaseModel],
111111
) -> Callable[[int], None]:
112112
def _mock_server(_status: int) -> None:

0 commit comments

Comments
 (0)