Skip to content

Conversation

@nhoening
Copy link
Contributor

@nhoening nhoening commented Dec 27, 2025

Until now, the asset index endpoint would return all possible asset information, including child assets, sensors, flex-config and model.

This made listings hard to read (as a developer) and also we're sending a lot of unnecessary data.

  • Add new field fields parameter to asset index endpoint, with sensible default
  • Make asset listing pages use it
  • Improve some other schema field descriptions
  • Make endpoint for public assets also use the new parameter
  • Added changelog item in documentation/changelog.rst and api changelog

Closes #1887

Look & Feel

Nothing should really change in the UI.

The API endpoints should return less data by default, testable in SwaggerUI.

Further Improvements

We could investigate to do the same for sensor listing endpoints, but they don't send that much data per entry.

Flix6x and others added 17 commits December 18, 2025 11:09
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…t for pubic for now returns a default set); also improve some parameter descriptions

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@read-the-docs-community
Copy link

read-the-docs-community bot commented Dec 27, 2025

Documentation build overview

📚 flexmeasures | 🛠️ Build #30839488 | 📁 Comparing 3c8187c against latest (1e28403)


🔍 Preview build

Show files changed (6 files in total): 📝 6 modified | ➕ 0 added | ➖ 0 deleted
File Status
changelog.html 📝 modified
genindex.html 📝 modified
_autosummary/flexmeasures.api.common.schemas.assets.html 📝 modified
_autosummary/flexmeasures.api.v3_0.assets.html 📝 modified
api/change_log.html 📝 modified
api/v3_0.html 📝 modified

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening changed the title add included-fields param to the asset-listing endpoint add included_fields param to the asset-listing endpoints Dec 27, 2025
@nhoening nhoening requested a review from Flix6x December 27, 2025 17:31
Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

Good idea to have a new field for this.

included_fields = PipedListField(
load_default=None,
metadata=dict(
description="Which fields to include in response. List fields separated by '|' (pipe). Defaults to 'id|name|account_id|generic_asset_type'.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This default appears to be a breaking change in our API. I'm guessing we are currently returning all db columns as fields? API clients may depend on that feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I propose including a warning in the changelog to this effect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately I don't think that is enough, even though I'd like it to be. As a host, I'd require a migration plan to make sure I can still upgrade without breaking my client's code. I instead suggest returning all fields by default, purely for backwards compatibility. Of course, in FM's own UI, we can still reduce the number of fields queried.

Slightly better would be to freeze the default (to those fields currently returned), such that at least any new field added in the future won't end up also returned by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am on the other side of the fence. Too much restriction and care like this slows us down too much.

There is one other thing we can do:
We can put the question to the community actually, on slack and the TSC.
I believe that we are in contact with most anybody who is already running with custom code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea involving the community. Here's an example of client code that I suspect would break: https://github.com/V2G-liberty/addon-v2g-liberty/blob/7eafe2e22c88cf89da61873d5f02ecbdcc8e8a40/v2g-liberty/rootfs/root/appdaemon/apps/v2g_liberty/fm_client.py#L250

We're now already two steps into formulating a migration plan: informing the community and identifying necessary adjustments to client-side code. I share your concern about slowing ourselves down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will inform the community.

What can we to identify necessary adjustments to client-side code, or to help people do it?

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Base automatically changed from feat/index-assets-given-root-node-and-depth to main December 29, 2025 23:46
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening changed the title add included_fields param to the asset-listing endpoints add fields param to the asset-listing endpoints, controlling fields in response Dec 30, 2025
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening requested a review from Flix6x December 30, 2025 11:33
@Flix6x Flix6x added the API label Dec 31, 2025
@Flix6x Flix6x added this to the 0.31.0 milestone Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop sending all asset data in /assets results

3 participants