-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
REST API: simplify json response by removing result wrapper (BC) #22299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @andig - I've reviewed your changes - here's some feedback:
- This change breaks client contracts by removing the
resultwrapper, so please bump the API version or add a migration note to alert consumers of the new response format. - Make sure you update and regenerate the OpenAPI spec (and any MCP artifacts) before merging so the docs match the new JSON responses.
- Double-check that all downstream code (including website components and integrations) has been updated to use
response.datainstead ofresponse.data.result.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- This change breaks client contracts by removing the `result` wrapper, so please bump the API version or add a migration note to alert consumers of the new response format.
- Make sure you update and regenerate the OpenAPI spec (and any MCP artifacts) before merging so the docs match the new JSON responses.
- Double-check that all downstream code (including website components and integrations) has been updated to use `response.data` instead of `response.data.result`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Schlaubi ;) |
|
@naltatis integration hab ich wohl verdaddelt- dass das dann 17 Minuten läuft ist aber auch nicht schön? |
ich schau mir die Timeouts mal an. |
|
@TheNinth7 Ich denke dieser PR wird für deine Garmin App Breaking. |
|
No hurry, lets see if we can get this working first and then prepare transition. |
Ja, Danke für den Hinweis, werde die App entsprechend vorbereiten! |
|
... currently the existence of a So when this |
How about checking whether the status code is 200? |
|
Exactly that 👍🏻 |
of course the ha-integration is checking for http status 200, before reading any json data... I personally prefer, when http status codes are not used to indicate application layer information - so http 200 must not mean, that the response itself have valid/consistent data... But since this is just my opinion, and since it's your project, I will adopt to this change. |
|
I'm not saying that it necessarily does but at the same time I'm not aware of any best practice requiring wrapping json payloads in top level elements which is what we're changing here.
I disagree (and I personally don't like the wording). It is a community project and we're open to feedback! Adhering to best practices certainly is of high value to us. |
I must assume, before starting with this breaking 'everything' change, you had internally (e.g. in slack) discussed the pro's & con's already. I highly appreciate the overall structure of this project and the clean code principles. So there is great experience & expertise in the core development group. Getting rid of an obsolete container object seams to be reasonable. The only thing I wanted to remark was triggert by "why not (simply) check for http 200?" - From my point of view, http 200 should not be the indicator, that the response object is in the expected format or structure. So processing any API response with http status 200 must be done with care and without any additional assumptions. In the HA integration, I have (mis)used the presence of the So when the |
- re-configuration instead of options - prepare for "result" container being removed (evcc-io/evcc#22299)
- re-configuration instead of options - prepare for "result" container being removed (evcc-io/evcc#22299)
|
|
An update for the Garmin app will be released in the next few days, adding support for both JSON formats - with and without the "result" wrapper. The app uses a jq filter to reduce memory usage, and the filter has been updated to handle both cases. The code was tested with the old format, but I can only fully verify support for the new one once the update is live. Mock servers can't replicate how the jq filter is applied by the actual server. Side note: AI isn’t much help with Garmin’s Monkey C or SDK, but it is well-versed in jq and was also helpful in this case. 😉 |
|
@andig I also noticed the openHAB evcc binding isn’t showing up in the list. Maybe it needs an update too to handle the new JSON format? |
|
Whom do we need to cc? |
@florian-h05, would you be the right person to look into how this change affects the openHAB evcc binding? Or do you happen to know who maintains it currently? |
- prepare for "result" container being removed (evcc-io/evcc#22299) - fix - initial handling of chargerSinglePhase, chargerFeatureIntegratedDevice loadpoint attributes - do not add (vehicle) entities for loadpoints that are 'IntegratedDevice'
* (arteck) simplify json response by removing result wrapper, see evcc-io/evcc#22299
|
Announcement is done via release notes and discussions: #22416. I'd tentatively like to schedule this for 0.206.0. |
my experience with HA Integration users is, that they update Integrations not frequently - but the obvious question is, "how long you are willing to wait" with the rollout of this PR... In my opinion this change does not add any (awaited) functionality - therefor the release-pressure is not high (IMHO) |
|
The pressure comes from the other release contents. But we'll need to merge this into the nightly before.
This will be an issue for any release, be it sooner or later? |
|
Maybe make it a "dedicated" release, where people can roll-back to the previous version if they cannot immediately update their integrations? I guess, a lot of people are on the "latest" tag when using Docker and will otherwise be quite surprised by the update and it would be beneficial, if they could rollback one version in order to update their home automation integrations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @andig - I've reviewed your changes - here's some feedback:
- Please regenerate and commit the updated server/mcp/openapi.json so the OpenAPI schema matches the new top-level response structure.
- Add a clear migration note or section for API consumers about this backward-incompatible removal of the “result” wrapper.
- Double-check that all frontend service calls and components have been updated to use response.data instead of response.data.result with no leftover .result references.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Please regenerate and commit the updated server/mcp/openapi.json so the OpenAPI schema matches the new top-level response structure.
- Add a clear migration note or section for API consumers about this backward-incompatible removal of the “result” wrapper.
- Double-check that all frontend service calls and components have been updated to use response.data instead of response.data.result with no leftover .result references.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Wir haben gethomepage/homepage#5630 vergessen :/ |
evcc API changes see evcc-io/evcc#22299 testing current and old API responses prepare-commit.sh corrections
|
Unfortunately, the integration with openHAB is currently broken — the evcc binding no longer works with the latest evcc version.
Perhaps I can help. However, I’m running openHAB in Docker, so I can only use what’s available as a Docker image or what can be installed into an existing installation via Karaf. |
Simplify HTTP JSON response format. Remove
"result": {}wrapper.Example
GET /api/statebefore
after
TODO