-
Notifications
You must be signed in to change notification settings - Fork 45
add fields param to the asset-listing endpoints, controlling fields in response
#1884
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
base: main
Are you sure you want to change the base?
Conversation
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>
Documentation build overview
Show files changed (6 files in total): 📝 6 modified | ➕ 0 added | ➖ 0 deleted
|
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Flix6x
left a comment
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.
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'.", |
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.
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.
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.
I propose including a warning in the changelog to this effect.
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.
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.
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.
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.
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.
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.
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.
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>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
fields param to the asset-listing endpoints, controlling fields in response
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>
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.
fieldsparameter to asset index endpoint, with sensible defaultdocumentation/changelog.rstand api changelogCloses #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.