Skip to content

Commit 7c020c9

Browse files
authored
fix: UTC-405: Fixed filterset_to_openapi_params function (#8878)
1 parent 4c52a9d commit 7c020c9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

label_studio/core/utils/filterset_to_openapi_params.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,12 @@ def _get_filter_config(filter_field: Any, overrides: dict) -> dict:
133133
config['enum'] = _get_choice_enum(filter_field)
134134

135135
elif isinstance(filter_field, (MultipleChoiceFilter, TypedMultipleChoiceFilter, AllValuesMultipleFilter)):
136-
config['type'] = OpenApiTypes.ARRAY
137-
config['extra_kwargs']['items'] = {'type': _map_filter_type(filter_field)}
136+
config['type'] = OpenApiTypes.STR
138137
if hasattr(filter_field, 'choices') and filter_field.choices:
139138
config['extra_kwargs']['items']['enum'] = _get_choice_enum(filter_field)
140139

141140
elif isinstance(filter_field, BaseInFilter):
142-
config['type'] = OpenApiTypes.ARRAY
143-
config['extra_kwargs']['items'] = {'type': _map_filter_type(filter_field)}
141+
config['type'] = OpenApiTypes.STR
144142
config['description'] = config.get('description', '') + ' (comma-separated values)'
145143

146144
elif isinstance(
@@ -162,7 +160,7 @@ def _get_filter_config(filter_field: Any, overrides: dict) -> dict:
162160
config['description'] = config.get('description', '') + ' (search term)'
163161

164162
elif isinstance(filter_field, (ModelChoiceFilter, ModelMultipleChoiceFilter)):
165-
config['type'] = OpenApiTypes.INT if isinstance(filter_field, ModelChoiceFilter) else OpenApiTypes.ARRAY
163+
config['type'] = OpenApiTypes.INT if isinstance(filter_field, ModelChoiceFilter) else OpenApiTypes.STR
166164
if isinstance(filter_field, ModelMultipleChoiceFilter):
167165
config['extra_kwargs']['items'] = {'type': OpenApiTypes.INT}
168166

@@ -208,7 +206,7 @@ def _map_filter_type(filter_field: Any) -> str:
208206
elif isinstance(
209207
filter_field, (MultipleChoiceFilter, TypedMultipleChoiceFilter, AllValuesMultipleFilter, BaseInFilter)
210208
):
211-
return OpenApiTypes.ARRAY
209+
return OpenApiTypes.STR
212210

213211
elif isinstance(
214212
filter_field,

0 commit comments

Comments
 (0)