-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Feature Request
Is your feature request related to a problem? Please describe.
When returning data from an API call, we usually unwrap the single field that might be returned by the API. Sometimes we return a Response wrapper including the different fields returned by the API.
This makes our API a bit inconsistent, and not future-proof: if a new field is added to the response, we usually have to implement a new method to return the new desired fields inside a wrapper class.
#181 is an example where we have to implement some dirty work around to provide the missing field.
Describe the solution you'd like
Make the return object consistent with the API response, and ensure we wrap all the returned fields in an object where it makes sense.
If the API returns:
{
"action": {}
}we return a class with an action field:
class MyResponse:
action: ActionAdding a new field should be easy
{
"action": {}
"root_password": "1234567890"
}class MyResponse:
action: Action
root_password: str | NoneTeachability, Documentation, Adoption, Migration Strategy
I wonder how this can be solved without asking too much effort to users, as this would be a decent amount of work.
Maybe using the trick with the return_response argument in #276 can solve this ?