Skip to content

Commit 523b8c9

Browse files
authored
Merge pull request #1470 from sanders41/generics
Fix pydantic warning with generics in search results
2 parents 1216b9c + 4bc0a48 commit 523b8c9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

meilisearch_python_sdk/models/search.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Generic, Literal, TypeVar
3+
from typing import Annotated, Generic, Literal, TypeVar
44

55
from camel_converter.pydantic_base import CamelBase
66
from pydantic import Field, field_validator
@@ -83,12 +83,12 @@ def validate_ranking_score_threshold(cls, v: float | None) -> float | None:
8383

8484

8585
class SearchResults(CamelBase, Generic[T]):
86-
hits: list[T]
86+
hits: Annotated[list[T], Field()]
8787
offset: int | None = None
8888
limit: int | None = None
8989
estimated_total_hits: int | None = None
9090
processing_time_ms: int
91-
query: str
91+
query: Annotated[str, Field()]
9292
facet_distribution: JsonDict | None = None
9393
total_pages: int | None = None
9494
total_hits: int | None = None
@@ -103,7 +103,7 @@ class SearchResultsWithUID(SearchResults, Generic[T]):
103103

104104

105105
class SearchResultsFederated(CamelBase, Generic[T]):
106-
hits: list[T]
106+
hits: Annotated[list[T], Field()]
107107
offset: int | None = None
108108
limit: int | None = None
109109
estimated_total_hits: int | None = None
@@ -118,7 +118,7 @@ class SearchResultsFederated(CamelBase, Generic[T]):
118118

119119

120120
class SimilarSearchResults(CamelBase, Generic[T]):
121-
hits: list[T]
121+
hits: Annotated[list[T], Field()]
122122
id: str
123123
processing_time_ms: int
124124
limit: int | None = None

0 commit comments

Comments
 (0)