-
Notifications
You must be signed in to change notification settings - Fork 88
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
Investigate out of the box JSON::Serializable support #250
Comments
@Blacksmoke16 I'm all for ideas! The current json integration is minimal at best and various ideas have been floated in the past, both here and on Amber. |
Support for this would be amazing. I been looking into it here and there but im not too sure what is going on still. It seems
|
Update: This is due to the usage of Looking into it more
But if you add an initialize method for PullParser it yells at you saying Update 2: Not really sure on how to best fix the errors thing since adding that type to @robacarp any ideas? Update 3: Was able to fix it by making the error array of type Update 4: Was able to have a better fix by adding some |
Fixed with #253 |
I would like to start a discussion on how doable support for Crystal
JSON::Serializable
would be for Granite.If this works out how I think it will this would be a major improvement on the ability for models to work much better with JSON APIs. It would allow:
.from_json
supportJSON::Field
annotations to better control serialization/deserialization.after_initialize
event. I..e you could run validations after consuming a JSON object to check if the provided values are allowed with the providedvalidate_*
validators. Or populate meta fields based on JSON values + a DB query for example.I'm not too familiar with how/what would have to be done to support this (or if its even doable). So i wanted to see what thoughts you guys have.
The text was updated successfully, but these errors were encountered: