mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-04-06 13:36:18 +00:00
fix: catch AttributeError in validate_data to allow Union fallthrough for non-DataFrame inputs (#993)
Some checks are pending
Bump Version / Bump Version Workflow (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
docker-build / platform-excludes (push) Waiting to run
docker-build / build (push) Blocked by required conditions
docker-build / merge (push) Blocked by required conditions
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
Some checks are pending
Bump Version / Bump Version Workflow (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
docker-build / platform-excludes (push) Waiting to run
docker-build / build (push) Blocked by required conditions
docker-build / merge (push) Blocked by required conditions
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
* fix: catch AttributeError in validate_data for non-DataFrame Union types
PUT /v1/prediction/import/{provider_id} crashed with AttributeError
when Union validator tried PydanticDateTimeDataFrame validation on
scalar float/int values. Instead of falling through to DateTimeData
or dict, the exception propagated as 500. Fixes #992.
* fix: correct indentation of ValueError in validate_data
---------
Co-authored-by: Normann <github@koldrack.com>
This commit is contained in:
@@ -1023,7 +1023,12 @@ class PydanticDateTimeDataFrame(PydanticBaseModel):
|
||||
return v
|
||||
|
||||
# Validate consistent columns
|
||||
try:
|
||||
columns = set(next(iter(v.values())).keys())
|
||||
except AttributeError:
|
||||
raise ValueError(
|
||||
"Data values must be dicts (DataFrame format), not scalars. Use DateTimeData or DateTimeSeries format instead."
|
||||
)
|
||||
if not all(set(row.keys()) == columns for row in v.values()):
|
||||
raise ValueError("All rows must have the same columns")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user