From 1900aaae0cb707b6ed751b007f51923403426af9 Mon Sep 17 00:00:00 2001 From: smohiudd Date: Mon, 12 Feb 2024 12:43:38 -0700 Subject: [PATCH 1/2] include model_dump() --- ingest_api/runtime/src/ingestor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingest_api/runtime/src/ingestor.py b/ingest_api/runtime/src/ingestor.py index bc65af86..3d014d30 100644 --- a/ingest_api/runtime/src/ingestor.py +++ b/ingest_api/runtime/src/ingestor.py @@ -67,7 +67,7 @@ def handler(event: "events.DynamoDBStreamEvent", context: "context_.Context"): items = [ # NOTE: Important to deserialize values to convert decimals to floats - convert_decimals_to_float(ingestion.item) + convert_decimals_to_float(ingestion.item.model_dump()) for ingestion in ingestions ] From 7bd70f243b1a33fe26b9825e6d7ccc367d1d4f0b Mon Sep 17 00:00:00 2001 From: smohiudd Date: Mon, 12 Feb 2024 21:25:54 -0700 Subject: [PATCH 2/2] update config and json serialization --- ingest_api/runtime/src/config.py | 8 +++++--- ingest_api/runtime/src/ingestor.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ingest_api/runtime/src/config.py b/ingest_api/runtime/src/config.py index 2f55ed4b..e270c180 100644 --- a/ingest_api/runtime/src/config.py +++ b/ingest_api/runtime/src/config.py @@ -1,3 +1,5 @@ +from typing import Optional + from pydantic import AnyHttpUrl, BaseSettings, Field, constr from pydantic_ssm_settings import AwsSsmSourceConfig @@ -8,7 +10,7 @@ class Settings(BaseSettings): dynamodb_table: str - jwks_url: AnyHttpUrl = Field( + jwks_url: Optional[AnyHttpUrl] = Field( description="URL of JWKS, e.g. https://cognito-idp.{region}.amazonaws.com/{userpool_id}/.well-known/jwks.json" # noqa ) @@ -22,8 +24,8 @@ class Settings(BaseSettings): client_id: str = Field(description="The Cognito APP client ID") client_secret: str = Field("", description="The Cognito APP client secret") - root_path: str = Field(description="Root path of API") - stage: str = Field(description="API stage") + root_path: Optional[str] = Field(description="Root path of API") + stage: Optional[str] = Field(description="API stage") class Config(AwsSsmSourceConfig): env_file = ".env" diff --git a/ingest_api/runtime/src/ingestor.py b/ingest_api/runtime/src/ingestor.py index 3d014d30..fdcdf465 100644 --- a/ingest_api/runtime/src/ingestor.py +++ b/ingest_api/runtime/src/ingestor.py @@ -67,7 +67,7 @@ def handler(event: "events.DynamoDBStreamEvent", context: "context_.Context"): items = [ # NOTE: Important to deserialize values to convert decimals to floats - convert_decimals_to_float(ingestion.item.model_dump()) + convert_decimals_to_float(ingestion.item.to_dict()) for ingestion in ingestions ]