Y-Pydantic #84
kafonek
started this conversation in
Show and tell
Replies: 1 comment 2 replies
-
Thanks for sharing @kafonek ! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello ypy community. I wanted to share a learning project I'm working on in case it helps anyone else understand the Y ecosystem better. https://github.com/kafonek/y-pydantic are bindings to automatically update Pydantic models when changes to Y shared data types (YText, YArray, YMap) are observed, including nested type (e.g. YText's in YArrays).
The repo includes two Notebooks right now:
I don't have a compelling use case for using
y-pydantic
in any sort of real app right now, it really is just a way to explore how ypy works. There's some brick walls I've run into that I would appreciate a chance to discuss with maintainers, I'm not sure what the best forum might be. Issues, chat, an ad-hoc Zoom we can schedule?One of those brick walls is introspecting
attributes
on a YText object. There doesn't seem to be a way to access those besides observing changes to the YText object (on insert and retain) and saving them off outside the YText object. That falls apart in the example at the very end of the second Notebook when we sync two clients, one of which has a YArray with YText elements that have attributes. The observed YArray insert has the fully formed YText object, no updates to the attributes so those attributes on the YText elements (string characters) are effectively unobservable.Beta Was this translation helpful? Give feedback.
All reactions