Return 422 ValidationError for zero-duration single-value posts on non-instantaneous sensors#2116
Open
Return 422 ValidationError for zero-duration single-value posts on non-instantaneous sensors#2116
Conversation
Documentation build overview
|
Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures/sessions/eb04c29e-a8cf-4f7b-885f-fbe2ec4ef622 Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures/sessions/eb04c29e-a8cf-4f7b-885f-fbe2ec4ef622 Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix missing ValidationError for instantaneous sensor value
Return 422 ValidationError for zero-duration single-value posts on non-instantaneous sensors
Apr 16, 2026
Flix6x
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Posting sensor data with
duration=PT0Mand a single value to a non-instantaneous sensor currently falls through to a server-side error path instead of producing a client-facing validation response. This change moves that case into schema validation and adds explicit regression coverage.Validation behavior
PostSensorDataSchema.check_resolution_compatibility_of_sensor_datafor:0:00:00ValidationErrorwith a clear message, returning the expected422response shape instead of surfacing a runtime error.Existing compatibility check retained
inferred_resolution % required_resolution != 0).Regression test
flexmeasures/api/v3_0/tests/test_sensor_data.pyfor posting:num_values=1duration="PT0M"422and schema-level error text.Changelog
POST /sensors/(id)/data.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
publicsuffix.org/home/REDACTED/work/flexmeasures/flexmeasures/.venv/bin/pytest pytest flexmeasures/ui/tests/test_utils.py flexmeasures/ui/tests/test_asset_crud.py flexmeasures/ui/tests/test_error_handling.py 76a4.pid flexmeasures/ui/tests/test_views.py flexmeasures/ui/tests/conftest.py 58611d1ccef45b6e0bae01ed96d1d581e03/log.json flexmeasures/ui/tests/test_user_crud.py flexmeasures/ui/tests/__init__.py flexmeasures/ui/tests/test_json_attributes_editor.py flexmeasures/ui/error_handlers.py be0f��(dns block)If you need me to access, download, or install something from one of these locations, you can either: