Skip to content

Commit 715a9e9

Browse files
committed
Remove validation
1 parent c7dcf66 commit 715a9e9

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

meilisearch/models/index.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
from typing import Any, Dict, Iterator, List, Optional
44

5-
import pydantic
65
from camel_converter import to_snake
76
from camel_converter.pydantic_base import CamelBase
87

9-
from meilisearch._utils import is_pydantic_2
10-
118

129
class IndexStats:
1310
__dict: Dict
@@ -34,34 +31,6 @@ class Faceting(CamelBase):
3431
max_values_per_facet: int
3532
sort_facet_values_by: Optional[Dict[str, str]] = None
3633

37-
if is_pydantic_2():
38-
39-
@pydantic.field_validator("sort_facet_values_by") # type: ignore[attr-defined]
40-
@classmethod
41-
def validate_facet_order(cls, val: Optional[Dict[str, str]]) -> Optional[Dict[str, str]]:
42-
if not val: # pragma: no cover
43-
return None
44-
45-
for _, value in val.items():
46-
if value not in ("alpha", "count"):
47-
raise ValueError('facet_order must be either "alpha" or "count"')
48-
49-
return val
50-
51-
else: # pragma: no cover
52-
53-
@pydantic.validator("sort_facet_values_by") # type: ignore[attr-defined]
54-
@classmethod
55-
def validate_facet_order(cls, val: Optional[Dict[str, str]]) -> Optional[Dict[str, str]]:
56-
if not val:
57-
return None
58-
59-
for _, value in val.items():
60-
if value not in ("alpha", "count"):
61-
raise ValueError('facet_order must be either "alpha" or "count"')
62-
63-
return val
64-
6534

6635
class Pagination(CamelBase):
6736
max_total_hits: int

tests/settings/test_setting_faceting.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ def test_update_faceting_sort_facet_values(
6666
assert response.model_dump() == expected
6767

6868

69-
def test_update_faceting_sort_facet_values_invalid_sort_type():
70-
with pytest.raises(ValueError):
71-
Faceting(
72-
max_values_per_facet=2,
73-
sort_facet_values_by={"*": "bad"},
74-
)
75-
76-
7769
def test_reset_faceting(empty_index):
7870
index = empty_index()
7971
response = index.update_faceting_settings(

0 commit comments

Comments
 (0)