-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
RFC: Name-spacing of objects under (module) ActiveModelSerializers vs. (core class) ActiveModel::Serializer #1298
Comments
Assigning @bf4 to this one as I believe you made those 2 PRs ( |
Basically, ActiveModel::Serializer is a terrible name for what it is and I'd like to move away from it. It's both the gem name, a namespace, and a resource attribute mapper. Also, using a class as a namespace for unrelated things isn't very Ruby-friendly. I can write more, but does that make sense? |
@bf4 I get what you're saying. Maybe it's still worth going into more details here so that we can keep a written trace of the exact reasons why. |
I'm going to try to write up something tonight that is json api focused that higkights the mismatching of terms But also, activemodel:: seializers right now attracts data and behavior not related to it being a serializer class since it is also a namespace that sounds like the namenof the gem
|
Thanks for the comments guys. @bf4 I want to hear more about your idea, I am working a little time on this project so maybe I miss something. Could you please expose what is the idea of the public APIs, something like:
The actual state I think is a little confusing having something in |
Welcome to team 'make things less confusing' I made a pr about this last night B mobile phone
|
@bf4 I think you PR do not cover the What I feel a little confusion is about the main entry point, If you take a look at ActiveModelSerializers and ActiveModel::Serializer seens that both are fighting to reach the main entry point. If we take a look at shoulda-matchers or Devise it is clear who is the entry point and how to extend the project. Just a note, today the gem name is a little confusing too, if we follow the rubygens recomendation, I think the goal was
Based on the bump of I think we need to expose only a single namespace |
@maurogeorge Thanks for your thoughts here. I really appreciate it. So, I haven't thought it all the way through, and I just wrote it out without any review, but what I'm thinking right now is something like:
see
|
@maurogeorge would you be interested in turning this issue into a PR so we can comment on diffs? using the hub gem would be something like hub pull-request -i 1298 -b rails-api:master -h maurogeorge:https://github.com/maurogeorge/active_model_serializers/tree/rfcs/namespacing |
Hi guys,
Today most of the public API is under
ActiveModel::Serializer
like:ActiveModel::Serializer.config
ActiveModel::Serializer
, which is the base class of our serializerI think the only 2 public APIs that are under the
ActiveModelSerializers
isActiveModelSerializers::Model
andActiveModelSerializers.logger
, I think this 2 APIs need to live underActiveModel::Serializer
to keep consistency to the user. I created 2 PRs that is related with this #1291 #1296In this PR #1138 was introduced a
ActiveModel::Adapter::Base
. I think we can do something like that, move from a class to a module and create aBase
class to follow the Rails idiom.The main goal here is to keep a good public API so the user will use:
I want to hear from you guys, your thought about it? You are 👍 or 👎
The text was updated successfully, but these errors were encountered: