Open drheinheimer opened 4 years ago
This is a fair point.
This also makes the case for unifying return types and content more generally.
For example hydra base returns dict objects, JSONObjects and SQLAlchemy objects for different function calls. This is mainly done for efficiency -- SQLAlchemy objects don't like being altered, so better to put them into a more portable format. This isn't an issue when using the hydra client library, but can be an issue when interfacing with hydra base directly.
I have noticed that some (all?) objects are not the same when called individually as when part of a collection. For example:
add_node
returns a node object that is different than what is return in a network from, e.g.,get_network
->network['nodes'][0]
. I have also noticed this with template types (single vs. in a template).This presents a bit of a challenge to manage, and I suggest the structure of objects be the same no matter where they are found, unless modification is requested with some argument.
This makes updating CRUD operations in a GUI particularly challenging. Often, I want to add/change a single element. For example, if I add a node, I want to simply append the newly added node to the list of existing nodes, without having to refactor the node to be consistent with existing nodes.
Here's a specific example:
add_typeattr
returns:In contrast, the same typeattr, when part of a template (in a templatetype), is: