22
33from typing import Any , Dict , Iterator , List , Optional
44
5- import pydantic
65from camel_converter import to_snake
76from camel_converter .pydantic_base import CamelBase
87
9- from meilisearch ._utils import is_pydantic_2
10-
118
129class 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
6635class Pagination (CamelBase ):
6736 max_total_hits : int
0 commit comments