Skip to content

Fix: All use of raw json when updating flex_configs#2149

Closed
joshuaunity wants to merge 11 commits into
mainfrom
fix/asset-patch-accept-json-object-flex-context
Closed

Fix: All use of raw json when updating flex_configs#2149
joshuaunity wants to merge 11 commits into
mainfrom
fix/asset-patch-accept-json-object-flex-context

Conversation

@joshuaunity
Copy link
Copy Markdown
Contributor

@joshuaunity joshuaunity commented May 5, 2026

Description

In this PR i fixed a bug where RAW JSON had to be loaded before it can be parsed as a flex-config. These forced users to take extra steps just to modify flex-configs

Look & Feel

Before
image

After
image

How to test

I noticed i didn't experience this issue while use a http client like "insomnia" you'll probably also not experience it if you use POSTMAN as well. But rather running it though a python script reveals the issue.

Use this script for testing

import requests

token = "xxxxxxxxxxxxxxxxxxxxxxxx"

res = requests.patch("http://localhost:5000/api/v3_0/assets/<asset_id>",
    headers = {
        "Authorization": <token>,
    },
    json={
        "flex_context":
        {
            "site-power-capacity":"1000 kW"
        }
    }
)
print(res.text)

Further Improvements

None

Related Items

This PR closes #2144

Sign-off

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity joshuaunity self-assigned this May 5, 2026
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
@nhoening nhoening changed the title Fix: All use of raw json when updating flex_confgs Fix: All use of raw json when updating flex_configs May 5, 2026
@joshuaunity joshuaunity requested a review from nhoening May 12, 2026 07:32
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@nhoening nhoening added this to the 0.33.0 milestone May 12, 2026
joshuaunity and others added 3 commits May 12, 2026 09:00
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Comment thread documentation/changelog.rst Outdated
Comment on lines +45 to +47
* Make the sensor page load much faster for sensors with lots of data, by avoiding to load statistics over all of its history by default [see `PR #2129 <https://www.github.com/FlexMeasures/flexmeasures/pull/2129>`_]
* Return a clear validation error (instead of a server ZeroDivisionError) when posting instantaneous (0-minute) data to non-instantaneous sensors via ``[POST] /sensors/(id)/data`` [see `PR #2116 <https://www.github.com/FlexMeasures/flexmeasures/pull/2116>`_]
* Fix asset context page for asset names containing apostrophes [see `PR #2117 <https://www.github.com/FlexMeasures/flexmeasures/pull/2117>`_]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were some conflicts. i checked on main and saw that these list are under 0.32.1 so i moved them here as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill revert

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…hub.com:FlexMeasures/flexmeasures into fix/asset-patch-accept-json-object-flex-context

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity
Copy link
Copy Markdown
Contributor Author

i thnk ill need to recreate this PR

Flix6x added 2 commits May 12, 2026 12:05
…' of github.com:FlexMeasures/flexmeasures into fix/asset-patch-accept-json-object-flex-context"

This reverts commit 3e72b86, reversing
changes made to b0189ab.
This reverts commit b0189ab, reversing
changes made to f9546f5.
@joshuaunity
Copy link
Copy Markdown
Contributor Author

New PR in 2162.

illbe closing this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON formatting problems when patching asset.flex_context via API

3 participants