Skip to content

Commit 6283633

Browse files
feat(specs): update try transformation specs for no-code (generated)
algolia/api-clients-automation#4974 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Mehmet Ali Gok <33124154+mehmetaligok@users.noreply.github.com>
1 parent fbe5488 commit 6283633

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

algoliasearch/ingestion/models/transformation_create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class TransformationCreate(BaseModel):
4444
""" It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code. """
4545
name: str
4646
""" The uniquely identified name of your transformation. """
47-
type: TransformationType
48-
input: TransformationInput
47+
type: Optional[TransformationType] = None
48+
input: Optional[TransformationInput] = None
4949
description: Optional[str] = None
5050
""" A descriptive name for your transformation of what it does. """
5151
authentication_ids: Optional[List[str]] = None

algoliasearch/ingestion/models/transformation_try.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919

2020

2121
from algoliasearch.ingestion.models.authentication_create import AuthenticationCreate
22+
from algoliasearch.ingestion.models.transformation_input import TransformationInput
23+
from algoliasearch.ingestion.models.transformation_type import TransformationType
2224

2325
_ALIASES = {
2426
"code": "code",
27+
"type": "type",
28+
"input": "input",
2529
"sample_record": "sampleRecord",
2630
"authentications": "authentications",
2731
}
@@ -36,8 +40,10 @@ class TransformationTry(BaseModel):
3640
TransformationTry
3741
"""
3842

39-
code: str
43+
code: Optional[str] = None
4044
""" It is deprecated. Use the `input` field with proper `type` instead to specify the transformation code. """
45+
type: Optional[TransformationType] = None
46+
input: Optional[TransformationInput] = None
4147
sample_record: object
4248
""" The record to apply the given code to. """
4349
authentications: Optional[List[AuthenticationCreate]] = None
@@ -77,6 +83,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
7783
if not isinstance(obj, dict):
7884
return cls.model_validate(obj)
7985

86+
obj["type"] = obj.get("type")
87+
obj["input"] = (
88+
TransformationInput.from_dict(obj["input"])
89+
if obj.get("input") is not None
90+
else None
91+
)
8092
obj["authentications"] = (
8193
[AuthenticationCreate.from_dict(_item) for _item in obj["authentications"]]
8294
if obj.get("authentications") is not None

0 commit comments

Comments
 (0)