Skip to content
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

Clear out master, move 0.10.x dev to the stable branch #2121

Merged
merged 2 commits into from
May 12, 2017

Conversation

bf4
Copy link
Member

@bf4 bf4 commented May 2, 2017

Status:

  • ❗️ All existing PRs against master will need to be closed and re-opened against 0-10-stable, if so desired
  • ❗️ Master, for the moment, won't have any released version of AMS on it.

Changes to 0.10.x maintenance:

  • The 0.10.x version has become a huge maintenance version. We had hoped to get it in shape for a 1.0 release, but it is clear that isn't going to happen. Almost none of the maintainers from 0.8, 0.9, or earlier 0.10 are still working on AMS. We'll continue to maintain 0.10.x on the 0-10-stable branch, but maintainers won't otherwise be actively developing on it
    • We may choose to make a 0.11.x ( 0-11-stable) release based on 0-10-stable that just removes the deprecations.

Changes in this PR:

  • The code and docs have been removed from master to signify that development against master has been suspended. When choosing ways that people might be surprised by the current state of 0.10.x development, we thought it would be simpler to make master simply incompatible with 0.10.x PRs than to ensure none are merged.

What's happening to AMS:

  • There's been a lot of churn around AMS since it began back in Rails 3.2 and a lot of new libraries are around and the JSON:API spec has reached 1.0.
  • If there is to be a 1.0 release of AMS, it will need to address the general needs of serialization in much the way ActiveJob can be used with different workers.
  • The next major release is in development. I am building and extracting it from an app I'm working on and thereby dogfooding it myself to ensure it to see if it makes sense. I'm starting simple and avoiding, at least at the outset, all the complications in AMS version, especially all the implicit behavior from guessing the serializer, to the association's serializer, to the serialization type, etc.
  • The basic idea is that models to serializers are a one to many relationship. Everything will need to be explicit. If you want to serialize a User with a UserSerializer, you'll need to call it directly. The serializer will essentially be for defining a basic JSON:API resource object: id, type, attributes, and relationships. The serializer will have an as_json method and can be told which fields (attributes/relationships) to serialize to JSON and will likely not know serialize any more than the relations id and type. Serializing anything more about the relations would require code that called a serializer. (This is still somewhat in discussion).
  • If this works out, the idea is to get something into Rails that existing libraries can use.

Steps:

  1. review this PR, clearing out master, moving 0-10 dev to 0-10-stable
  2. merge it
  3. make a PR from dev to master and work on it

@mention-bot
Copy link

@bf4, thanks for your PR! By analyzing the history of the files in this pull request, we identified @remear, @dubadub and @domitian to be potential reviewers.

Copy link
Member Author

@bf4 bf4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting some of the changes

@@ -0,0 +1,92 @@
## 0.08.x
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gets its own changelog

@@ -0,0 +1,74 @@
## 0.09.x
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gets its own changelog

@@ -0,0 +1,466 @@
## 0.10.x
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gets its own changelog

@@ -10,641 +10,10 @@ Fixes:

Misc:

### [v0.10.6 (2017-05-01)](https://github.com/rails-api/active_model_serializers/compare/v0.10.5...v0.10.6)
## [0.10.x](CHANGELOG-0-10.md)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just references other changelogs

- [Guides](docs)
- [0.9 (0-9-stable) Documentation](https://github.com/rails-api/active_model_serializers/tree/0-9-stable)
- [0.8 (0-8-stable) Documentation](https://github.com/rails-api/active_model_serializers/tree/0-8-stable)
See if your issue can be resolved by information in the [documentation](README.md).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these links weren't up to date

@@ -43,7 +37,9 @@ for discussion or add your comments to existing ones.
We also gladly welcome pull requests. When preparing to work on pull request,
please adhere to these standards:

- Base work on the master branch unless fixing an issue with
- Base work on the relevant branch:
[0.10-stable](https://github.com/rails-api/active_model_serializers/tree/0-10-stable)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0-10 is no longer master

@@ -52,10 +48,10 @@ please adhere to these standards:
- Note any specific areas that should be reviewed.
- Include tests.
- The test suite must pass on [supported Ruby versions](.travis.yml)
- Include updates to the [documentation](https://github.com/rails-api/active_model_serializers/tree/master/docs)
- Include updates to the [documentation](docs)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work on master.. maybe should link to 0-10? or no link?

@@ -86,10 +20,11 @@ Thanks!
## Documentation

If you're reading this at https://github.com/rails-api/active_model_serializers you are
reading documentation for our `master`, which may include features that have not
been released yet. Please see below for the documentation relevant to you.
reading documentation for our `master`, which is not yet released.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0-10 is no longer master


- [0.10 (master) Documentation](https://github.com/rails-api/active_model_serializers/tree/master)
- [0.10 (0-10-stable) Documentation](https://github.com/rails-api/active_model_serializers/tree/0-10-stable)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0-10 is no longer master


Gem::Specification.new do |spec|
spec.name = 'active_model_serializers'
spec.version = ActiveModel::Serializer::VERSION
spec.version = "1.0.0-dev"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just picked something so tests can run

@bf4 bf4 changed the title Clear out master Clear out master, move 0.10.x dev to the stable branch May 2, 2017
@bf4 bf4 merged commit e3e5a41 into rails-api:master May 12, 2017
@bf4 bf4 deleted the new_master branch May 12, 2017 13:58
@mauriciopasquier
Copy link
Contributor

What about Adapters? I'm in the process of migrating from 0.8 to 0.10, and was planing to write a few Adapters to fit my needs. Right now (0.8) I'm basically using model Serializers to describe a "neutral" hash of the model and I use specific serializers to convert that neutral representation to GeoJSON, CSV and JSON:API.

Will the Serializer/Adapter model be compatible with the new work beign done? From what I read here, my approach of having a specific serializer for a needed format (i.e. GeoJSON) will be prefered.

@bf4
Copy link
Member Author

bf4 commented May 12, 2017

@mauriciopasquier At this time, it appears that adapters may be a special case for serializers. I haven't fully fleshed this out, yet, but basically you'd have your UserSerializer and your DocumentSerializer and combine the two to serialize the user into a JSONAPI response document. I'm starting from a place with no magic so that the fundamentals of how the combine the parts are less hard to work with. I imagine something like DocumentSeriarlizer.new(UserSerializer.new(user)).as_json.

@mauriciopasquier
Copy link
Contributor

@bf4 So I guess I'll stay with that approach. What I'm doing exactly in 0.8 is:

# In a controller
format.geojson do
  render json: @users, serializer: GeojsonCollectionSerializer
end

# In the collection serializer `as_json` method
object.map do |user|
  GeojsonUserSerializer.new(user).as_json
end

Of course this implementation makes one serializer depends on the other, but it works for my case. Will 1.0.0 provide this DocumentSerializer (or similar) as 0.10 does with a the JSON:API Adapter?

Thanks for answering :)

@bf4
Copy link
Member Author

bf4 commented May 15, 2017

Will 1.0.0 provide this DocumentSerializer (or similar) as 0.10 does with a the JSON:API Adapter?

probably... like I said, I'm building and extracting this out of our code, while talking to stakeholders in Rails and API-gems...

@thomasnal
Copy link

thomasnal commented Sep 10, 2017

I have come to re-check some details in documentation and spotted the ideas at the top planned for AMS.

AMS is instrumental to our project, we use it heavily to keep sane view on serialization and keep the team producing clean code.

Some of the ideas are related to removing functionality that works perfectly currently therefore it is worry-some. I came to this PR to see background behind the decisions that I have not found. Is there other source where I can find rationals behind the decisions? Especially for removing that what works now?

DocumentSeriarlizer.new(UserSerializer.new(user)).as_json

This snippet looks backwards from what AMS does currently. However, perhaps it means that below will keep working? Can you please shed more light @bf4?

class Profile:UsersShowSerializer < ActiveModel::Serializer
  attributes ...
end

class User::UsersShowSerializer < ActiveModel::Serializer
  attribute :profile, :serializer => Profile::UsersShowSerializer
  ...
end

class UsersController < ApplicationController
  def show
    render json: user, status: :ok
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants