Skip to content

Commit

Permalink
fixup! Issue #678/#682 further finetuning
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Jan 16, 2025
1 parent ac11868 commit adf4f4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openeo/api/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@ def schema_supports(schema: Union[dict, List[dict]], type: str, subtype: Optiona
elif isinstance(actual_type, list):
if type not in actual_type:
return False
elif actual_type is None:
# Without explicit "type", anything is accepted
return True
else:
raise ValueError(actual_type)
if subtype:
Expand Down
8 changes: 8 additions & 0 deletions tests/api/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,11 @@ def test_schema_supports_list():
assert schema_supports(schema, type="object") is True
assert schema_supports(schema, type="object", subtype="datacube") is True
assert schema_supports(schema, type="object", subtype="geojson") is False


def test_default_parameter_supports_anything():
parameter = Parameter(name="foo")
assert schema_supports(parameter.schema, type="string") is True
assert schema_supports(parameter.schema, type="number") is True
assert schema_supports(parameter.schema, type="object") is True
assert schema_supports(parameter.schema, type="object", subtype="datacube") is True

0 comments on commit adf4f4c

Please sign in to comment.