Skip to content

Commit 2917b58

Browse files
fix(specs): ingestion destination reject indexPrefix (generated)
algolia/api-clients-automation#3478 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 0840d88 commit 2917b58

File tree

2 files changed

+4
-82
lines changed

2 files changed

+4
-82
lines changed

algoliasearch/ingestion/models/destination_index_prefix.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

algoliasearch/ingestion/models/destination_input.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@
1212
from pydantic import BaseModel, ValidationError, model_serializer
1313

1414
from algoliasearch.ingestion.models.destination_index_name import DestinationIndexName
15-
from algoliasearch.ingestion.models.destination_index_prefix import (
16-
DestinationIndexPrefix,
17-
)
1815

1916

2017
class DestinationInput(BaseModel):
2118
"""
2219
DestinationInput
2320
"""
2421

25-
oneof_schema_1_validator: Optional[DestinationIndexPrefix] = None
26-
oneof_schema_2_validator: Optional[DestinationIndexName] = None
27-
actual_instance: Optional[Union[DestinationIndexName, DestinationIndexPrefix]] = (
28-
None
29-
)
22+
oneof_schema_1_validator: Optional[DestinationIndexName] = None
23+
actual_instance: Optional[Union[DestinationIndexName]] = None
3024

3125
def __init__(self, *args, **kwargs) -> None:
3226
if args:
@@ -43,9 +37,7 @@ def __init__(self, *args, **kwargs) -> None:
4337
super().__init__(**kwargs)
4438

4539
@model_serializer
46-
def unwrap_actual_instance(
47-
self,
48-
) -> Optional[Union[DestinationIndexName, DestinationIndexPrefix]]:
40+
def unwrap_actual_instance(self) -> Optional[Union[DestinationIndexName]]:
4941
"""
5042
Unwraps the `actual_instance` when calling the `to_json` method.
5143
"""
@@ -61,12 +53,6 @@ def from_json(cls, json_str: str) -> Self:
6153
instance = cls.model_construct()
6254
error_messages = []
6355

64-
try:
65-
instance.actual_instance = DestinationIndexPrefix.from_json(json_str)
66-
67-
return instance
68-
except (ValidationError, ValueError) as e:
69-
error_messages.append(str(e))
7056
try:
7157
instance.actual_instance = DestinationIndexName.from_json(json_str)
7258

@@ -75,7 +61,7 @@ def from_json(cls, json_str: str) -> Self:
7561
error_messages.append(str(e))
7662

7763
raise ValueError(
78-
"No match found when deserializing the JSON string into DestinationInput with oneOf schemas: DestinationIndexName, DestinationIndexPrefix. Details: "
64+
"No match found when deserializing the JSON string into DestinationInput with oneOf schemas: DestinationIndexName. Details: "
7965
+ ", ".join(error_messages)
8066
)
8167

0 commit comments

Comments
 (0)