Skip to content

Commit a2bda78

Browse files
issue693 detect type null in schema
1 parent 754a399 commit a2bda78

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

openeo/internal/processes/parse.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def get_enum_options(self):
5353
result = copy.deepcopy(item["enum"])
5454
else:
5555
result += item["enum"]
56+
elif "type" in item:
57+
if item["type"] == "null":
58+
result += [None]
5659
elif isinstance(self.schema,dict):
5760
if "enum" in self.schema:
5861
result = self.schema["enum"]

openeo/rest/datacube.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2773,7 +2773,7 @@ def sar_backscatter(
27732773
"coefficient"
27742774
)
27752775
schema = parameter.schema
2776-
coefficient_options = schema.get_enum_options() + [None]
2776+
coefficient_options = schema.get_enum_options()
27772777
if coefficient == _UNSET:
27782778
coefficient = parameter.default
27792779
except Exception as e:

tests/internal/processes/test_parse.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,23 @@ def test_schema_accepts_geojson(schema, expected):
5555
"mode",
5656
"near",
5757
],
58-
}
58+
},
5959
),
6060
["average", "bilinear", "cubic", "cubicspline", "lanczos", "max", "med", "min", "mode", "near"],
6161
),
6262
(
63-
Schema([{"type": "string", "enum": ["replicate", "reflect", "reflect_pixel", "wrap"]}, {"type": "number"}]),
64-
["replicate", "reflect", "reflect_pixel", "wrap"],
63+
Schema([{"type": "string", "enum": ["replicate", "reflect", "reflect_pixel", "wrap"]}, {"type": "null"}]),
64+
["replicate", "reflect", "reflect_pixel", "wrap", None],
6565
),
6666
(
6767
Schema(
6868
[
6969
{"type": "string", "enum": ["replicate", "reflect"]},
70+
{"type": "null"},
7071
{"type": "number", "enum": ["reflect_pixel", "wrap"]},
7172
]
7273
),
73-
["replicate", "reflect", "reflect_pixel", "wrap"],
74+
["replicate", "reflect", None, "reflect_pixel", "wrap"],
7475
),
7576
],
7677
)

0 commit comments

Comments
 (0)