Skip to content

Commit

Permalink
fix(specs): add secrets payload for updates (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4061

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed Oct 31, 2024
1 parent 3af1599 commit b1645a0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions algoliasearch/ingestion/models/auth_input_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from json import dumps
from json import dumps, loads
from sys import version_info
from typing import Any, Dict, Optional, Set, Union

Expand Down Expand Up @@ -49,13 +49,16 @@ class AuthInputPartial(BaseModel):

oneof_schema_6_validator: Optional[AuthAlgoliaInsightsPartial] = Field(default=None)

oneof_schema_7_validator: Optional[Dict[str, str]] = Field(default=None)
""" A key:value authentication for your transformations. """
actual_instance: Union[
AuthAPIKeyPartial,
AuthAlgoliaInsightsPartial,
AuthAlgoliaPartial,
AuthBasicPartial,
AuthGoogleServiceAccountPartial,
AuthOAuthPartial,
Dict[str, str],
None,
] = None
one_of_schemas: Set[str] = {
Expand All @@ -65,6 +68,7 @@ class AuthInputPartial(BaseModel):
"AuthBasicPartial",
"AuthGoogleServiceAccountPartial",
"AuthOAuthPartial",
"Dict[str, str]",
}

def __init__(self, *args, **kwargs) -> None:
Expand All @@ -91,6 +95,7 @@ def unwrap_actual_instance(
AuthBasicPartial,
AuthGoogleServiceAccountPartial,
AuthOAuthPartial,
Dict[str, str],
Self,
None,
]:
Expand Down Expand Up @@ -145,12 +150,19 @@ def from_json(cls, json_str: str) -> Self:
try:
instance.actual_instance = AuthAlgoliaInsightsPartial.from_json(json_str)

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

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

raise ValueError(
"No match found when deserializing the JSON string into AuthInputPartial with oneOf schemas: AuthAPIKeyPartial, AuthAlgoliaInsightsPartial, AuthAlgoliaPartial, AuthBasicPartial, AuthGoogleServiceAccountPartial, AuthOAuthPartial. Details: "
"No match found when deserializing the JSON string into AuthInputPartial with oneOf schemas: AuthAPIKeyPartial, AuthAlgoliaInsightsPartial, AuthAlgoliaPartial, AuthBasicPartial, AuthGoogleServiceAccountPartial, AuthOAuthPartial, Dict[str, str]. Details: "
+ ", ".join(error_messages)
)

Expand All @@ -177,6 +189,7 @@ def to_dict(
AuthBasicPartial,
AuthGoogleServiceAccountPartial,
AuthOAuthPartial,
Dict[str, str],
]
]:
"""Returns the dict representation of the actual instance"""
Expand Down

0 comments on commit b1645a0

Please sign in to comment.