Full refactor of ItemBase/Item/Edge/central schema
- Using this in plugins requires changing the local plugin schema + manual testing if everything works
- Now works with pydantic
- Works with minimal changes to code if developer adds edges with
Item.add_edge
- Schema now lives in submodule
data.schema
. Importing from module works (from .data.schema import Account
) - all base functionality is defined on ItemBase, Item only contains properties
- Edges are stored in
Item.__edges__[edge_name]
.Item.edge_name
will just return a list of targets, but should not be editted - ItemBase private attributes are defined in the metaclass, to prevent PyLance picking them up in class signature
- note: defining private attributes on Item subclasses still works, example
_my_attribute: Optional[str] = PrivateAttr(None)
- note: defining private attributes on Item subclasses still works, example
- Item schema generation for pod is now done on Item, removed duplicate functionality on PodClient and Plugin
Breaking changes
- Item init arguments are now strict, will throw error if arg is not a model field.
- Pydantic does type coercion.
PluginRun(id=1234) == PluginRun(id="1234")
-
Edge._type
is now calledEdge.name
(required for Pydantic, can be reverted with workaround). -
Item.from_json
now only parses properties. This was already the case in practice, as parsing edges was broken. - Removed unused/unimplemented methods from ItemBase and PodClient. If a plugin uses a method that is missing, method should be re-added
- EdgeList no longer exists
- Local oauth schema is removed, uses central schema oauth now (same fields)