Comments (9)
@christophersansone I like the idea of having a clear guideline about what goes into the serializer class and what goes into the serializer instance. I wonder if we can provide backward compatibility to the current way of doing things so that users of the gem can upgrade without changing things around a lot.
from fast_jsonapi.
@shishirmk Yeah I was thinking about the upgrade path too. I think we can potentially offer backwards compatibility for the short-term and provide deprecation warnings. But it seems like the sooner we implement this, the fewer people will have to change.
I'm thinking we wait until after next week's release so we don't hold it up, and then tackle this right afterwards. Does that seem reasonable?
from fast_jsonapi.
I attempted to refactor fast_jsonapi
because of this exact reason: I was confused with abstraction distribution across instance-class levels. But it turned out to be a complete rewrite, the result can be checked out here: https://github.com/youroff/alt_jsonapi
Core idea is that class is the place where serializer is configured and then using this configuration and fields
and include
params, it builds a tree of serializer instances that in its turn is used for serialization itself. It already supports custom attributes, polymorphic relationships etc.
Eventually it can be pulled in to fast_jsonapi
if maintainers decide to do so. However that are number of architectural decisions that are different with fast_jsonapi
and might be incompatible.
- Inheritance of serializers is explicitly forbidden, because it's reserved for PolymorphicSerializer. Though it's technically possible to make so that regular serializers were supporting inheritance.
- It doesn't know anything about ActiveRecord and its conventions (like relation_id / _ids), so even without inclusion of relationships, they must be preloaded to build id hashes. The reasons are described in documentation.
- There is no internal caching, and honestly I don't see the right place and way to put it there.
So please try it and let me know if you find any issues and/or get ideas how to make it better! :)
from fast_jsonapi.
@shishirmk I feel like we are starting to be blocked by the amount of divergence between dev
and master
. I see there is a v1.1 milestone, but I'm wondering if we can help speed up development and issue resolution if we release a smaller version bump like 1.0.18
. If there are no breaking changes between dev
and master
, can we do this? If there are breaking changes, can we consider reducing the scope of v1.1 and push some of the less complete features to a future version?
from fast_jsonapi.
@christophersansone yes we are. I think we can release v1.1 with what we have in dev now. It is not ideal but i think it's a good next step. I would like to document some known issues before we do the release.
There is a minor breaking change hence i would like to bump it to v1.1.0
. We dont support use_hyphen
anymore. It is being replaced by key_transform.
@mrryanjohnston is testing parts of the dev branch. I would like to test the branch on some of our internal projects. Once it looks good. I am planning to release v1.1.0
from fast_jsonapi.
@shishirmk Awesome, thanks. If use_hyphen
is the only breaking change, would it be better to deprecate it rather than remove it all together? The implementation can just call the new key transform method and serve a deprecation warning. It would be simple to do, and we can remove it in a future release that will have more significant breaking changes that we can't easily deprecate.
For upcoming releases, it will help to tag PRs with "breaking change" when appropriate, and perhaps require the author to update a CHANGELOG
to document the code changes the users need to implement upon release.
from fast_jsonapi.
Ya i agree lets just add support for use_hyphen
and we can just release 1.0.18
from fast_jsonapi.
@shishirmk Thanks for getting 1.1 out the door! It seems like this is probably the next big blocker to address before some of the other features can be implemented, right? Want me to give this a shot this week?
from fast_jsonapi.
@christophersansone ya i think after we address #79. This would be a good thing to to tackle.
from fast_jsonapi.
Related Issues (20)
- How can I reference dynamic attributes inside of other dynamic attributes? HOT 1
- Relationship scope HOT 1
- do i need to always give serializer name or it can auto pick HOT 1
- Any way to globally output 'pretty' JSON? HOT 1
- Is this project abandoned? No PR's merged or versions released in nearly a year! HOT 10
- Customize JSON Response HOT 3
- passing in list of params for collection?
- Thoughts on adding a value transform option or a 'type' option to Attribute?
- Unexpected behavior when object belongs_to :size HOT 2
- set_id value not respected in relationships HOT 1
- FYI > this repo has been FORKED and is active at new repository HOT 1
- uninitialized constant FooBar::OrganizationSerializer::FastJsonapi HOT 2
- #serialized_json for empty collection HOT 1
- circular association troubles HOT 1
- Integers and Floats are represented as strings HOT 1
- Bug: Associations that have an attribute or method named `map` cannot be serialized HOT 1
- ObjectSerializer not working for single object HOT 2
- Alternative to this gem -> Alba HOT 1
- Issue with accessor with a proc shortcut in ruby 3.0 HOT 1
- Single attribute with serializer parameter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast_jsonapi.