Skip to content

Commit

Permalink
update decoder conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
pnilan committed Oct 2, 2024
1 parent 9ce665a commit 1b55803
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ class SessionTokenAuthenticator(BaseModel):
description='Authentication method to use for requests sent to the API, specifying how to inject the session token.',
title='Data Request Authentication',
)
decoder: Optional[Union[JsonDecoder, JsonlDecoder, IterableDecoder]] = Field(
decoder: Optional[JsonDecoder] = Field(
None, description='Component decoding the response', title='Decoder'
)
parameters: Optional[Dict[str, Any]] = Field(None, alias='$parameters')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ def create_legacy_to_per_partition_state_migration(
def create_session_token_authenticator(
self, model: SessionTokenAuthenticatorModel, config: Config, name: str, **kwargs: Any
) -> Union[ApiKeyAuthenticator, BearerAuthenticator]:
if not isinstance(model.decoder, JsonDecoder):
raise ValueError(f"Provided decoder of {type(model.decoder)=} is not supported. Please set JsonDecoder instead.")
decoder = self._create_component_from_model(model=model.decoder, config=config) if model.decoder else JsonDecoder(parameters={})
if not isinstance(decoder, JsonDecoder):
raise ValueError(f"Provided decoder of {type(model.decoder)=} is not supported. Please set JsonDecoder instead.")
login_requester = self._create_component_from_model(
model=model.login_requester, config=config, name=f"{name}_login_requester", decoder=decoder
)
Expand Down

0 comments on commit 1b55803

Please sign in to comment.