Skip to content

Commit

Permalink
fix: decimal to float serialization fix (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
smohiudd authored Feb 13, 2024
2 parents 1089949 + 7bd70f2 commit 61a46ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ingest_api/runtime/src/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from pydantic import AnyHttpUrl, BaseSettings, Field, constr
from pydantic_ssm_settings import AwsSsmSourceConfig

Expand All @@ -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
)

Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ingest_api/runtime/src/ingestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.to_dict())
for ingestion in ingestions
]

Expand Down

0 comments on commit 61a46ea

Please sign in to comment.