-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add data serialization/deserialization #16
Comments
and serialize method supporting field names mapping. refs #16
I've implemented initial deserialization and serialization in the Now the Also a In addition I would like to be able to deserialize lists of models, but first its needed a new field (something like fields.Embedded but for a list of models) in order to know how to deserialize the dicts in the list. I'll work on that shortly. Finally I have to add some docs for these new features. |
Awesome! I've got a deadline Friday that I'm scrambling for, but I should have a little time this weekend. For embedded objects with mapped fields, it looks like you're handling them by creating a mapped dictionary that goes all the way down the tree – is that right? |
Nice! Give it a try when you can and let me know how it works for you.
Yeah, that's right. Every time a model is found its |
Hey, this is working great! It integrated easily into what I had. I did encounter one issue – see #19. |
Great! I just merged it. Now I'm working on the second part of the data serialization (data formatters) that I think is needed to have an initial serialization layer. If you miss something more for data serialization, feel free to open a new pull request or just let me know. |
Sure! One thing that comes to mind is date formatting. That's something I could use immediately. I posted the library yesterday: capysule. It's in rough shape still, but you can take a look. |
Dates are a little forgotten in Booby so I think it's a good time to take care of them.
Nice! I'll keep it to link it as a Booby use in a near future. Thanks! |
* Renamed serialize and deserialize Model methods to encode and decode. * Extracted serialization/deserialization logic to fields and encoders/decoders.
I think serialization/deserialization should be a major feature for the next release, so I opened this issue to start designing and implementing it.
We're going to use the @paulmelnikow's work from #15 pull request as a starting point.
Based on it, some desirable features are:
from_dict
classmethod.to_dict
method rather than perform serialization in the__iter__
method.update_from_dict
method (suggestions?)As data serialization/deserialization I mean:
field name
- dictitem name
mapping (as implemented in the pull request)str
toint
and vice versa.I think it would be appropriate to start with the first item in the list above and later implement the second item.
The text was updated successfully, but these errors were encountered: