dance-engine / dance-engine/the-engine

Validation fails if a required field is not in dynamodb

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

This is perfectly expected behaviour, but it causes a problem if somehow an event was created without required fields. Probably a fringe case but worth a fix at some point soon.

```
[ERROR] 2025-07-29T01:18:15.822Z b36d7dcf-b56a-4ff8-a658-5d4b46bb2b0a Traceback (most recent call last):
File "/var/task/functions/events/lambda_events.py", line 135, in get_single_event
result = blank_model.query_gsi(
^^^^^^^^^^^^^^^^^^^^^^
File "/var/task/_pydantic/dynamodb.py", line 93, in query_gsi
return self.assemble_from_items(items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/task/_pydantic/dynamodb.py", line 206, in assemble_from_items
parsed = ModelClass.model_validate(item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pydantic/main.py", line 627, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for LocationModel
parent_event_ksuid
Field required [type=missing, input_value={'gsi1SK': 'LOCATION#2vOz...i1PK': 'EVENTLIST#demo'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/missing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/task/functions/events/lambda_events.py", line 233, in lambda_handler
result = get_single_event(organisationSlug, eventId, public=is_public)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/task/functions/events/lambda_events.py", line 143, in get_single_event
except db.exceptions.ResourceNotFoundException as e:
^^^^^^^^^^^^^
AttributeError: 'dynamodb.ServiceResource' object has no attribute 'exceptions'
```

In the above case, when I searched in dynodb I could not see a related Location object for this particular event.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.