Skip to content

Commit 54483a2

Browse files
committed
refactor: update method names from_service_io to from_domain_model for clarity
1 parent f407644 commit 54483a2

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

packages/models-library/src/models_library/api_schemas_catalog/services_ports.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class ServicePortGet(BaseModel):
1717
key: str = Field(
1818
...,
19-
description="port identifier name",
19+
description="Port identifier name",
2020
pattern=PUBLIC_VARIABLE_NAME_RE,
2121
title="Key name",
2222
)
@@ -26,6 +26,7 @@ class ServicePortGet(BaseModel):
2626
None,
2727
description="jsonschema for the port's value. SEE https://json-schema.org/understanding-json-schema/",
2828
)
29+
2930
model_config = ConfigDict(
3031
json_schema_extra={
3132
"example": {
@@ -43,7 +44,7 @@ class ServicePortGet(BaseModel):
4344
)
4445

4546
@classmethod
46-
def from_service_io(
47+
def from_domain_model(
4748
cls,
4849
kind: PortKindStr,
4950
key: str,

packages/models-library/tests/test_api_schemas_catalog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_service_port_with_file():
2121
}
2222
)
2323

24-
port = ServicePortGet.from_service_io("input", "input_1", io).model_dump(
24+
port = ServicePortGet.from_domain_model("input", "input_1", io).model_dump(
2525
exclude_unset=True
2626
)
2727

@@ -49,7 +49,7 @@ def test_service_port_with_boolean():
4949
}
5050
)
5151

52-
port = ServicePortGet.from_service_io("input", "input_1", io).model_dump(
52+
port = ServicePortGet.from_domain_model("input", "input_1", io).model_dump(
5353
exclude_unset=True
5454
)
5555

services/catalog/src/simcore_service_catalog/api/rest/_services_ports.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,18 @@ async def list_service_ports(
3131

3232
if service.inputs:
3333
for name, input_port in service.inputs.items():
34-
ports.append(ServicePortGet.from_service_io("input", name, input_port))
34+
ports.append(
35+
ServicePortGet.from_domain_model(
36+
kind="input", key=name, port=input_port
37+
)
38+
)
3539

3640
if service.outputs:
3741
for name, output_port in service.outputs.items():
38-
ports.append(ServicePortGet.from_service_io("output", name, output_port))
42+
ports.append(
43+
ServicePortGet.from_domain_model(
44+
kind="output", key=name, port=output_port
45+
)
46+
)
3947

4048
return ports

0 commit comments

Comments
 (0)