Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
Continue fleshing out structure of this package's backend
Notes on validation
I've chosen
apischema
here since it is the beast we know, and has similar functionality to pydantic.apischema
performs type validation happens on serialization/deserialization, but not outside of that. If we are to be constructing these dataclasses we'll want to validate them before attempting to save them to a backend (whether serialized or not).To help with that, the
.validate()
method has been added. This calls theapischema
validation routine. Adding routines can be done with the@validator
decorator, quite easily.In pursuit of lazy loading
This section is also the "Why hint
Union[UUID, Entry]
everwhere?" sectionI expect lazy loading will become a requirement, especially as database size grows. I imagine a world where we have a huge root tree structure, with deep nesting of collections and snapshots. In this case, we wouldn't want to pull the whole database's contents with every app load.
Instead we might first grab the metadata information (name, description, creation time), then fill its children when their information is requested. Exactly how we accomplish this should be fleshed out in the client/backend implementations, but the data-model would have to allow "unfilled" references to
Entry
objects.How Has This Been Tested?
Added a few tests, need to flesh them out a bit
Where Has This Been Documented?
This PR, soon pre-release notes
Pre-merge checklist
docs/pre-release-notes.sh
and created a pre-release documentation page