Skip to content

Commit

Permalink
fix(specs): update search api specs [skip-bc] (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3760

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Thomas Raffray <[email protected]>
  • Loading branch information
algolia-bot and Fluf22 committed Sep 16, 2024
1 parent 400e10b commit 2da2b0f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 134 deletions.
39 changes: 9 additions & 30 deletions algoliasearch/recommend/models/highlight_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,17 @@ class HighlightResult(BaseModel):
HighlightResult
"""

oneof_schema_1_validator: Optional[Dict[str, HighlightResult]] = Field(
oneof_schema_1_validator: Optional[HighlightResultOption] = None
oneof_schema_2_validator: Optional[Dict[str, HighlightResult]] = Field(
default=None,
description="Surround words that match the query with HTML tags for highlighting.",
)
oneof_schema_2_validator: Optional[HighlightResultOption] = None
oneof_schema_3_validator: Optional[Dict[str, HighlightResultOption]] = Field(
default=None,
description="Surround words that match the query with HTML tags for highlighting.",
)
oneof_schema_4_validator: Optional[List[HighlightResultOption]] = Field(
oneof_schema_3_validator: Optional[List[HighlightResult]] = Field(
default=None,
description="Surround words that match the query with HTML tags for highlighting.",
)
actual_instance: Optional[
Union[
Dict[str, HighlightResultOption],
Dict[str, HighlightResult],
HighlightResultOption,
List[HighlightResultOption],
]
Union[Dict[str, HighlightResult], HighlightResultOption, List[HighlightResult]]
] = None

def __init__(self, *args, **kwargs) -> None:
Expand All @@ -66,12 +57,7 @@ def __init__(self, *args, **kwargs) -> None:
def unwrap_actual_instance(
self,
) -> Optional[
Union[
Dict[str, HighlightResultOption],
Dict[str, HighlightResult],
HighlightResultOption,
List[HighlightResultOption],
]
Union[Dict[str, HighlightResult], HighlightResultOption, List[HighlightResult]]
]:
"""
Unwraps the `actual_instance` when calling the `to_json` method.
Expand All @@ -89,14 +75,14 @@ def from_json(cls, json_str: str) -> Self:
error_messages = []

try:
instance.oneof_schema_1_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_1_validator
instance.actual_instance = HighlightResultOption.from_json(json_str)

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.actual_instance = HighlightResultOption.from_json(json_str)
instance.oneof_schema_2_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_2_validator

return instance
except (ValidationError, ValueError) as e:
Expand All @@ -105,19 +91,12 @@ def from_json(cls, json_str: str) -> Self:
instance.oneof_schema_3_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_3_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.oneof_schema_4_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_4_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

raise ValueError(
"No match found when deserializing the JSON string into HighlightResult with oneOf schemas: Dict[str, HighlightResultOption], Dict[str, HighlightResult], HighlightResultOption, List[HighlightResultOption]. Details: "
"No match found when deserializing the JSON string into HighlightResult with oneOf schemas: Dict[str, HighlightResult], HighlightResultOption, List[HighlightResult]. Details: "
+ ", ".join(error_messages)
)

Expand Down
16 changes: 9 additions & 7 deletions algoliasearch/recommend/models/recommendations_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@ class RecommendationsResults(BaseModel):
description="Whether automatic events collection is enabled for the application.",
alias="_automaticInsights",
)
page: Annotated[int, Field(strict=True, ge=0)] = Field(
description="Page of search results to retrieve."
page: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
default=0, description="Page of search results to retrieve."
)
nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits")
nb_pages: StrictInt = Field(
description="Number of pages of results.", alias="nbPages"
nb_hits: Optional[StrictInt] = Field(
default=None, description="Number of results (hits).", alias="nbHits"
)
hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field(
description="Number of hits per page.", alias="hitsPerPage"
nb_pages: Optional[StrictInt] = Field(
default=None, description="Number of pages of results.", alias="nbPages"
)
hits_per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field(
default=20, description="Number of hits per page.", alias="hitsPerPage"
)
hits: List[RecommendationsHit]

Expand Down
39 changes: 9 additions & 30 deletions algoliasearch/recommend/models/snippet_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,17 @@ class SnippetResult(BaseModel):
SnippetResult
"""

oneof_schema_1_validator: Optional[Dict[str, SnippetResult]] = Field(
oneof_schema_1_validator: Optional[SnippetResultOption] = None
oneof_schema_2_validator: Optional[Dict[str, SnippetResult]] = Field(
default=None,
description="Snippets that show the context around a matching search query.",
)
oneof_schema_2_validator: Optional[SnippetResultOption] = None
oneof_schema_3_validator: Optional[Dict[str, SnippetResultOption]] = Field(
default=None,
description="Snippets that show the context around a matching search query.",
)
oneof_schema_4_validator: Optional[List[SnippetResultOption]] = Field(
oneof_schema_3_validator: Optional[List[SnippetResult]] = Field(
default=None,
description="Snippets that show the context around a matching search query.",
)
actual_instance: Optional[
Union[
Dict[str, SnippetResultOption],
Dict[str, SnippetResult],
List[SnippetResultOption],
SnippetResultOption,
]
Union[Dict[str, SnippetResult], List[SnippetResult], SnippetResultOption]
] = None

def __init__(self, *args, **kwargs) -> None:
Expand All @@ -66,12 +57,7 @@ def __init__(self, *args, **kwargs) -> None:
def unwrap_actual_instance(
self,
) -> Optional[
Union[
Dict[str, SnippetResultOption],
Dict[str, SnippetResult],
List[SnippetResultOption],
SnippetResultOption,
]
Union[Dict[str, SnippetResult], List[SnippetResult], SnippetResultOption]
]:
"""
Unwraps the `actual_instance` when calling the `to_json` method.
Expand All @@ -89,14 +75,14 @@ def from_json(cls, json_str: str) -> Self:
error_messages = []

try:
instance.oneof_schema_1_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_1_validator
instance.actual_instance = SnippetResultOption.from_json(json_str)

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.actual_instance = SnippetResultOption.from_json(json_str)
instance.oneof_schema_2_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_2_validator

return instance
except (ValidationError, ValueError) as e:
Expand All @@ -105,19 +91,12 @@ def from_json(cls, json_str: str) -> Self:
instance.oneof_schema_3_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_3_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.oneof_schema_4_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_4_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

raise ValueError(
"No match found when deserializing the JSON string into SnippetResult with oneOf schemas: Dict[str, SnippetResultOption], Dict[str, SnippetResult], List[SnippetResultOption], SnippetResultOption. Details: "
"No match found when deserializing the JSON string into SnippetResult with oneOf schemas: Dict[str, SnippetResult], List[SnippetResult], SnippetResultOption. Details: "
+ ", ".join(error_messages)
)

Expand Down
39 changes: 9 additions & 30 deletions algoliasearch/search/models/highlight_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,17 @@ class HighlightResult(BaseModel):
HighlightResult
"""

oneof_schema_1_validator: Optional[Dict[str, HighlightResult]] = Field(
oneof_schema_1_validator: Optional[HighlightResultOption] = None
oneof_schema_2_validator: Optional[Dict[str, HighlightResult]] = Field(
default=None,
description="Surround words that match the query with HTML tags for highlighting.",
)
oneof_schema_2_validator: Optional[HighlightResultOption] = None
oneof_schema_3_validator: Optional[Dict[str, HighlightResultOption]] = Field(
default=None,
description="Surround words that match the query with HTML tags for highlighting.",
)
oneof_schema_4_validator: Optional[List[HighlightResultOption]] = Field(
oneof_schema_3_validator: Optional[List[HighlightResult]] = Field(
default=None,
description="Surround words that match the query with HTML tags for highlighting.",
)
actual_instance: Optional[
Union[
Dict[str, HighlightResultOption],
Dict[str, HighlightResult],
HighlightResultOption,
List[HighlightResultOption],
]
Union[Dict[str, HighlightResult], HighlightResultOption, List[HighlightResult]]
] = None

def __init__(self, *args, **kwargs) -> None:
Expand All @@ -66,12 +57,7 @@ def __init__(self, *args, **kwargs) -> None:
def unwrap_actual_instance(
self,
) -> Optional[
Union[
Dict[str, HighlightResultOption],
Dict[str, HighlightResult],
HighlightResultOption,
List[HighlightResultOption],
]
Union[Dict[str, HighlightResult], HighlightResultOption, List[HighlightResult]]
]:
"""
Unwraps the `actual_instance` when calling the `to_json` method.
Expand All @@ -89,14 +75,14 @@ def from_json(cls, json_str: str) -> Self:
error_messages = []

try:
instance.oneof_schema_1_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_1_validator
instance.actual_instance = HighlightResultOption.from_json(json_str)

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.actual_instance = HighlightResultOption.from_json(json_str)
instance.oneof_schema_2_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_2_validator

return instance
except (ValidationError, ValueError) as e:
Expand All @@ -105,19 +91,12 @@ def from_json(cls, json_str: str) -> Self:
instance.oneof_schema_3_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_3_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.oneof_schema_4_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_4_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

raise ValueError(
"No match found when deserializing the JSON string into HighlightResult with oneOf schemas: Dict[str, HighlightResultOption], Dict[str, HighlightResult], HighlightResultOption, List[HighlightResultOption]. Details: "
"No match found when deserializing the JSON string into HighlightResult with oneOf schemas: Dict[str, HighlightResult], HighlightResultOption, List[HighlightResult]. Details: "
+ ", ".join(error_messages)
)

Expand Down
16 changes: 9 additions & 7 deletions algoliasearch/search/models/search_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@ class SearchResponse(BaseModel):
description="Whether automatic events collection is enabled for the application.",
alias="_automaticInsights",
)
page: Annotated[int, Field(strict=True, ge=0)] = Field(
description="Page of search results to retrieve."
page: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
default=0, description="Page of search results to retrieve."
)
nb_hits: StrictInt = Field(description="Number of results (hits).", alias="nbHits")
nb_pages: StrictInt = Field(
description="Number of pages of results.", alias="nbPages"
nb_hits: Optional[StrictInt] = Field(
default=None, description="Number of results (hits).", alias="nbHits"
)
hits_per_page: Annotated[int, Field(le=1000, strict=True, ge=1)] = Field(
description="Number of hits per page.", alias="hitsPerPage"
nb_pages: Optional[StrictInt] = Field(
default=None, description="Number of pages of results.", alias="nbPages"
)
hits_per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field(
default=20, description="Number of hits per page.", alias="hitsPerPage"
)
hits: List[Hit] = Field(
description="Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. "
Expand Down
39 changes: 9 additions & 30 deletions algoliasearch/search/models/snippet_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,17 @@ class SnippetResult(BaseModel):
SnippetResult
"""

oneof_schema_1_validator: Optional[Dict[str, SnippetResult]] = Field(
oneof_schema_1_validator: Optional[SnippetResultOption] = None
oneof_schema_2_validator: Optional[Dict[str, SnippetResult]] = Field(
default=None,
description="Snippets that show the context around a matching search query.",
)
oneof_schema_2_validator: Optional[SnippetResultOption] = None
oneof_schema_3_validator: Optional[Dict[str, SnippetResultOption]] = Field(
default=None,
description="Snippets that show the context around a matching search query.",
)
oneof_schema_4_validator: Optional[List[SnippetResultOption]] = Field(
oneof_schema_3_validator: Optional[List[SnippetResult]] = Field(
default=None,
description="Snippets that show the context around a matching search query.",
)
actual_instance: Optional[
Union[
Dict[str, SnippetResultOption],
Dict[str, SnippetResult],
List[SnippetResultOption],
SnippetResultOption,
]
Union[Dict[str, SnippetResult], List[SnippetResult], SnippetResultOption]
] = None

def __init__(self, *args, **kwargs) -> None:
Expand All @@ -66,12 +57,7 @@ def __init__(self, *args, **kwargs) -> None:
def unwrap_actual_instance(
self,
) -> Optional[
Union[
Dict[str, SnippetResultOption],
Dict[str, SnippetResult],
List[SnippetResultOption],
SnippetResultOption,
]
Union[Dict[str, SnippetResult], List[SnippetResult], SnippetResultOption]
]:
"""
Unwraps the `actual_instance` when calling the `to_json` method.
Expand All @@ -89,14 +75,14 @@ def from_json(cls, json_str: str) -> Self:
error_messages = []

try:
instance.oneof_schema_1_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_1_validator
instance.actual_instance = SnippetResultOption.from_json(json_str)

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.actual_instance = SnippetResultOption.from_json(json_str)
instance.oneof_schema_2_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_2_validator

return instance
except (ValidationError, ValueError) as e:
Expand All @@ -105,19 +91,12 @@ def from_json(cls, json_str: str) -> Self:
instance.oneof_schema_3_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_3_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
try:
instance.oneof_schema_4_validator = loads(json_str)
instance.actual_instance = instance.oneof_schema_4_validator

return instance
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

raise ValueError(
"No match found when deserializing the JSON string into SnippetResult with oneOf schemas: Dict[str, SnippetResultOption], Dict[str, SnippetResult], List[SnippetResultOption], SnippetResultOption. Details: "
"No match found when deserializing the JSON string into SnippetResult with oneOf schemas: Dict[str, SnippetResult], List[SnippetResult], SnippetResultOption. Details: "
+ ", ".join(error_messages)
)

Expand Down

0 comments on commit 2da2b0f

Please sign in to comment.