diff --git a/src/corva/handlers.py b/src/corva/handlers.py index 3e748af4..862eeb86 100644 --- a/src/corva/handlers.py +++ b/src/corva/handlers.py @@ -197,7 +197,7 @@ def wrapper( return app_event = event.metadata.log_type.event.model_validate( - event.model_copy(update={"records": records}, deep=True).model_dump() + event.copy(update={"records": records}, deep=True).model_dump() ) with LoggingContext( aws_request_id=aws_request_id, diff --git a/src/corva/models/stream/raw.py b/src/corva/models/stream/raw.py index a88ba09c..814c95f3 100644 --- a/src/corva/models/stream/raw.py +++ b/src/corva/models/stream/raw.py @@ -82,9 +82,9 @@ class RawMetadata(CorvaBaseEvent): RecordsTime = Sequence[RawTimeRecord] RecordsDepth = Sequence[RawDepthRecord] else: - RecordsBase = Annotated[List[RawBaseRecord], Field(min_length=1)] - RecordsTime = Annotated[List[RawTimeRecord], Field(min_length=0)] - RecordsDepth = Annotated[List[RawDepthRecord], Field(min_length=1)] + RecordsBase = Annotated[List[RawBaseRecord], Field(min_items=1)] + RecordsTime = Annotated[List[RawTimeRecord], Field(min_items=0)] + RecordsDepth = Annotated[List[RawDepthRecord], Field(min_items=1)] class RawStreamEvent(CorvaBaseEvent, RawBaseEvent): diff --git a/src/corva/models/stream/stream.py b/src/corva/models/stream/stream.py index 3b8aeb4f..78d368b0 100644 --- a/src/corva/models/stream/stream.py +++ b/src/corva/models/stream/stream.py @@ -39,8 +39,8 @@ class StreamDepthRecord(CorvaBaseEvent): RecordsTime = Sequence[StreamTimeRecord] RecordsDepth = Sequence[StreamDepthRecord] else: - RecordsTime = Annotated[List[StreamTimeRecord], Field(min_length=1)] - RecordsDepth = Annotated[List[StreamDepthRecord], Field(min_length=1)] + RecordsTime = Annotated[List[StreamTimeRecord], Field(min_items=1)] + RecordsDepth = Annotated[List[StreamDepthRecord], Field(min_items=1)] class StreamEvent(CorvaBaseEvent): diff --git a/tests/unit/test_scheduled_app.py b/tests/unit/test_scheduled_app.py index ea4b10b0..d6af52b7 100644 --- a/tests/unit/test_scheduled_app.py +++ b/tests/unit/test_scheduled_app.py @@ -254,7 +254,7 @@ def test_set_schedule_start( def app(e, api, state): return e - event = event.model_copy(update={'schedule_start': value}) + event = event.copy(update={'schedule_start': value}) app_event = ( type(event) .model_validate(