Skip to content

Commit 32e391c

Browse files
committed
feat: added support for string parameter
1 parent f3b6256 commit 32e391c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

app/platforms/implementations/openeo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ def _get_type_from_schemas(self, schemas: dict) -> ParamTypeEnum:
307307
return ParamTypeEnum.BOUNDING_BOX
308308
elif type == "boolean":
309309
return ParamTypeEnum.BOOLEAN
310+
elif type == "string":
311+
return ParamTypeEnum.STRING
310312

311313
# If no matching schema found, raise an error
312314
raise ValueError(f"Unsupported parameter schemas: {schemas}")

app/schemas/parameters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ParamTypeEnum(str, Enum):
1010
DATE_INTERVAL = "date-interval"
1111
BOUNDING_BOX = "bounding-box"
1212
BOOLEAN = "boolean"
13+
STRING = "string"
1314

1415

1516
class ParamRequest(BaseModel):

tests/platforms/test_openeo_platform.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ async def test_authenticate_user_config_unsupported_method(
353353

354354
# ensure the exchange mock exists but is not awaited
355355
with pytest.raises(
356-
ValueError, match="No OpenEO backend configuration found for URL"
356+
ValueError, match="Unsupported OpenEO authentication method"
357357
):
358358
await platform._authenticate_user("user-token", url, conn)
359359

@@ -591,6 +591,11 @@ async def test_get_parameters_success(mock_udp_request, platform):
591591
"optional": True,
592592
"default": ["2020-01-01", "2020-12-31"],
593593
},
594+
{
595+
"name": "string_test",
596+
"description": "Test for a string parameter",
597+
"schema": {"type": "string"},
598+
},
594599
]
595600
mock_udp_request.return_value.json.return_value = {
596601
"id": "process123",
@@ -624,6 +629,12 @@ async def test_get_parameters_success(mock_udp_request, platform):
624629
optional=True,
625630
default=udp_params[2]["default"],
626631
),
632+
Parameter(
633+
name=udp_params[3]["name"],
634+
description=udp_params[3]["description"],
635+
type=ParamTypeEnum.STRING,
636+
optional=False,
637+
),
627638
]
628639
assert result == parameters
629640

0 commit comments

Comments
 (0)