Skip to content
Snippets Groups Projects

fix bug where pydantic field set to None does not use default

In pydantic v2, setting a field value to None does not trigger the default_factory(). This was causing a bug for GET /data and GET /filter if users were not setting starttime. The get_data_query() and get_filter_data_query() were explicitly setting empty starttimes to None, which did not trigger the default being set and returned a 500. This MR fixes this by also adding a custom field_validator which handles fields being set to None. More information in this issue. Absolutely bonkers.

I also made the error around CustomUTCDateTime a little more helpful by pointing users to the obspy UTCDateTime documentation. UTCDateTime accepts a huge variety of strings, not just %Y-%m-%dT%H:%M:%S.%fZ.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading