fix bug where pydantic field set to None does not use default
Merged
requested to merge ghsc/contractors/ahobbs/geomag-algorithms:fix-starttime-pydantic-error into master
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
Activity
Please register or sign in to reply