Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rails-api/active_model_serializers
ActiveModel::Serializer implementation and Rails hooks
https://github.com/rails-api/active_model_serializers
json resource-serializer ruby
Last synced: 4 days ago
JSON representation
ActiveModel::Serializer implementation and Rails hooks
- Host: GitHub
- URL: https://github.com/rails-api/active_model_serializers
- Owner: rails-api
- License: mit
- Created: 2011-12-01T06:39:26.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T13:48:20.000Z (3 months ago)
- Last Synced: 2024-10-29T11:58:09.241Z (about 1 month ago)
- Topics: json, resource-serializer, ruby
- Language: Ruby
- Homepage:
- Size: 4.26 MB
- Stars: 5,328
- Watchers: 79
- Forks: 1,386
- Open Issues: 190
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG-0-08.md
- Contributing: CONTRIBUTING.md
- License: MIT-LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-ruby-toolbox - active_model_serializers - ActiveModel::Serializers allows you to generate your JSON in an object-oriented and convention-driven manner. (Web Apps, Services & Interaction / API Builders)
- awesome-ruby - ActiveModel::Serializers - JSON serialization of objects. (API Builder and Discovery)
- awesome-rails-api-gems - ActiveModel::Serializers - Serializer brings convention over configuration to your JSON generation. (Serializers)
- awesome-ruby-api - ActiveModel::Serializer - ActiveModel::Serializer brings convention over configuration to your JSON generation. (Serialization)
- awesome-rails-gem - ActiveModel::Serializers - Serializer brings convention over configuration to your JSON generation. (API / Omniauth)
README
# ActiveModelSerializers
## About
ActiveModelSerializers is undergoing some renovations. See [Development Status](#status-of-ams).
## Getting Help
If you find a bug, please report an [Issue](https://github.com/rails-api/active_model_serializers/issues/new)
and see our [contributing guide](CONTRIBUTING.md).If you have a question, please [post to Stack Overflow](http://stackoverflow.com/questions/tagged/active-model-serializers).
If you'd like to chat, we have a [community slack](http://amserializers.herokuapp.com).
Thanks!
## Documentation
If you're reading this at https://github.com/rails-api/active_model_serializers you are
reading documentation for our `master`, which is not yet released.
0.10 (0-10-stable) Documentation
Guides
0.9 (0-9-stable) Documentation
0.8 (0-8-stable) Documentation
## Status of AMS
### *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.
- :eyes: See below for [alternatives](#alternatives)### *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.### *What's happening to AMS*:
- There's been a lot of churn around AMS since it began back in [Rails 3.2](CHANGELOG-prehistory.md) 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. We're 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.See [PR 2121](https://github.com/rails-api/active_model_serializers/pull/2121) where these changes were introduced for more information and any discussion.
## Alternatives
- [jsonapi-rb](http://jsonapi-rb.org/) is a [highly performant](https://gist.github.com/NullVoxPopuli/748e89ddc1732b42fdf42435d773734a) and modular JSON:API-only implementation. There's a vibrant community around it that has produced projects such as [JSON:API Suite](https://jsonapi-suite.github.io/jsonapi_suite_deprecated/).
- [fast_jsonapi](https://github.com/fast-jsonapi/fast_jsonapi) is a lightning fast JSON:API serializer for Ruby Objects.
- [jsonapi-resources](https://github.com/cerebris/jsonapi-resources) is a popular resource-focused framework for implementing JSON:API servers.
- [blueprinter](https://github.com/procore/blueprinter) is a fast, declarative, and API spec agnostic serializer that uses composable views to reduce duplication. From your friends at Procore.
- [Alba](https://github.com/okuramasafumi/alba) is fast and spec agnostic serialization solution. It has some unique features such as global or per-resource error handling.
- [Transmutation](https://github.com/spellbook-technology/transmutation) is fast and lightweight JSON attribute serialization solution. It provides an intuitive serializer lookup, inspired from AMS.For benchmarks against alternatives, see https://github.com/rails-api/active_model_serializers/tree/benchmarks
## Semantic Versioning
This project adheres to [semver](http://semver.org/)
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)