Breaking changes:
Features:
Fixes:
Misc:
Fixes:
- #1857 JSON:API does not load belongs_to relation to get identifier id. (@bf4)
- #2119 JSON:API returns null resource object identifier when 'id' is null. (@bf4)
- #2093 undef problematic Serializer methods: display, select. (@bf4)
Misc:
- #2104 Documentation for serializers and rendering. (@cassidycodes)
- #2081 Documentation for
include
option in adapters. (@charlie-wasp) - #2120 Documentation for association options: foreign_key, type, class_name, namespace. (@bf4)
Breaking changes:
Features:
- #2021 ActiveModelSerializers::Model#attributes. Originally in #1982. (@bf4)
- #2057
Update version constraint for jsonapi-renderer to
['>= 0.1.1.beta1', '< 0.2']
(@jaredbeck)
Fixes:
- #2022 Mutation of ActiveModelSerializers::Model now changes the attributes. Originally in #1984. (@bf4)
Misc:
- #2055 Replace deprecated dependency jsonapi with jsonapi-renderer. (@jaredbeck)
- #2021 Make test attributes explicit. Tests have Model#associations. (@bf4)
- #1981 Fix relationship link documentation. (@groyoh)
- #2035 Document how to disable the logger. (@MSathieu)
- #2039 Documentation fixes. (@biow0lf)
Misc:
- #2005 Update jsonapi runtime dependency to 0.1.1.beta6, support Ruby 2.4. (@kofronpi)
- #1993 Swap out KeyTransform for CaseTransform gem for the possibility of native extension use. (@NullVoxPopuli)
Fixes:
- #1973 Fix namespace lookup for collections and has_many relationships (@groyoh)
- #1887 Make the comment reflect what the function does (@johnnymo87)
- #1890 Ensure generator inherits from ApplicationSerializer when available (@richmolj)
- #1922 Make railtie an optional dependency in runtime (@ggpasqualino)
- #1930 Ensure valid jsonapi when relationship has no links or data (@richmolj)
Features:
- #1757 Make serializer lookup chain configurable. (@NullVoxPopuli)
- #1968 (@NullVoxPopuli)
- Add controller namespace to default controller lookup
- Provide a
namespace
render option - document how set the namespace in the controller for implicit lookup.
- #1791 (@bf4, @youroff, @NullVoxPopuli)
- Added
jsonapi_namespace_separator
config option.
- Added
- #1889 Support key transformation for Attributes adapter (@iancanderson, @danbee)
- #1917 Add
jsonapi_pagination_links_enabled
configuration option (@richmolj) - #1797 Only include 'relationships' when sideloading (@richmolj)
Fixes:
- #1833 Remove relationship links if they are null (@groyoh)
- #1881 ActiveModelSerializers::Model correctly works with string keys (@yevhene)
Misc:
-
#1767 Replace raising/rescuing
CollectionSerializer::NoSerializerError
, throw/catch:no_serializer
. (@bf4) -
#1839
fields
tests demonstrating usage for both attributes and relationships. (@NullVoxPopuli) -
#1812 add a code of conduct (@corainchicago)
-
#1878 Cache key generation for serializers now uses
ActiveSupport::Cache.expand_cache_key
instead ofArray#join
by default and is also overridable. This change should be backward-compatible. (@markiz) -
#1799 Add documentation for setting the adapter. (@cassidycodes)
-
#1909 Add documentation for relationship links. (@vasilakisfil, @NullVoxPopuli)
-
#1959 Add documentation for root. (@shunsuke227ono)
-
#1967 Improve type method documentation. (@yukideluxe)
Fixes:
- #1814 Ensuring read_multi works with fragment cache
- #1848 Redefine associations on inherited serializers. (@EhsanYousefi)
Misc:
- #1808 Adds documentation for
fields
option. (@luizkowalski)
Features:
- #1668 Exclude nil and empty links. (@sigmike)
- #1426 Add ActiveModelSerializers.config.default_includes (@empact)
Fixes:
- #1754 Fixes #1759, Grape integration, improves serialization_context
missing error message on pagination. Document overriding CollectionSerializer#paginated?. (@bf4)
Moved serialization_context creation to Grape formatter, so resource serialization works without explicit calls to the
render
helper method. Added Grape collection tests. (@onomated) - #1287 Pass
fields
options from adapter to serializer. (@vasilakisfil) - #1710 Prevent association loading when
include_data
option is set tofalse
. (@groyoh) - #1747 Improve jsonapi mime type registration for Rails 5 (@remear)
Misc:
- #1734 Adds documentation for conditional attribute (@lambda2)
- #1685 Replace
IncludeTree
withIncludeDirective
from the jsonapi gem.
Breaking changes:
- #1662 Drop support for Rails 4.0 and Ruby 2.0.0. (@remear)
Features:
- #1677 Add
assert_schema
,assert_request_schema
,assert_request_response_schema
. (@bf4) - #1697 Include actual exception message with custom exceptions;
Test::Schema
exceptions are nowMinitest::Assertion
s. (@bf4) - #1699 String/Lambda support for conditional attributes/associations (@mtsmfm)
- #1687 Only calculate
_cache_digest
(incache_key
) whenskip_digest
is false. (@bf4) - #1647 Restrict usage of
serializable_hash
options to the ActiveModel::Serialization and ActiveModel::Serializers::JSON interface. (@bf4)
Fixes:
- #1700 Support pagination link for Kaminari when no data is returned. (@iamnader)
- #1726 Adds polymorphic option to association definition which includes association type/nesting in serializer (@cgmckeever)
Misc:
- #1673 Adds "How to" guide on using AMS with POROs (@DrSayre)
- #1730 Adds documentation for overriding default serializer based on conditions (@groyoh/@cgmckeever)
Breaking changes:
- #1645 Changed :dashed key transform to :dash. (@remear)
- #1574 Default key case for the JsonApi adapter changed to dashed. (@remear)
Features:
- #1645 Transform keys referenced in values. (@remear)
- #1650 Fix serialization scope options
scope
,scope_name
take precedence overserialization_scope
in the controller. Fix tests that required tearing down dynamic methods. (@bf4) - #1644 Include adapter name in cache key so that the same serializer can be cached per adapter. (@bf4 via #1346 by @kevintyll)
- #1642 Prefer object.cache_key over the generated cache key. (@bf4 via #1346 by @kevintyll)
- #1637 Make references to 'ActionController::Base.cache_store' explicit in order to avoid issues when application controllers inherit from 'ActionController::API'. (@ncuesta)
- #1633 Yield 'serializer' to serializer association blocks. (@bf4)
- #1616 SerializableResource handles no serializer like controller. (@bf4)
- #1618 Get collection root key for empty collection from explicit serializer option, when possible. (@bf4)
- #1574 Provide key translation. (@remear)
- #1494 Make serializers serializalbe (using the Attributes adapter by default). (@bf4)
- #1550 Add
Rails url_helpers to
SerializationContext
for use in links. (@remear, @bf4) - #1004 JSON API errors object implementation.
- Only implements
detail
andsource
as derived fromActiveModel::Error
- Provides checklist of remaining questions and remaining parts of the spec.
- Only implements
- #1515 Adds support for symbols to the
ActiveModel::Serializer.type
method. (@groyoh) - #1504 Adds the changes missing from #1454
and add more tests for resource identifier and relationship objects. Fix association block with link
returning
data: nil
.(@groyoh) - #1372 Support cache_store.read_multi. (@LcpMarvel)
- #1018 Add more tests and docs for top-level links. (@leandrocp)
- #1454 Add support for relationship-level links and meta attributes. (@beauby)
- #1340 Add support for resource-level meta. (@beauby)
Fixes:
- #1657 Add missing missing require "active_support/json". (@andreaseger)
- #1661 Fixes
read_attribute_for_serialization
not seeing methods defined in serialization superclass (#1653, #1658, #1660), introduced in #1650. (@bf4) - #1651 Fix deserialization of nil relationships. (@NullVoxPopuli)
- #1480 Fix setting of cache_store from Rails configuration. (@bf4) Fix unintentional mutating of value in memory cache store. (@groyoh)
- #1622 Fragment cache changed from per-record to per-serializer. Now, two serializers that use the same model may be separately cached. (@lserman)
- #1478 Cache store will now be correctly set when serializers are loaded before Rails initializes. (@bf4)
- #1570 Fixed pagination issue with last page size. (@bmorrall)
- #1516 No longer return a nil href when only adding meta to a relationship link. (@groyoh)
- #1458 Preserve the serializer type when fragment caching. (@bdmac)
- #1477 Fix
fragment_cached?
method to check if caching. (@bdmac) - #1501 Adds tests for SerializableResource::use_adapter?,doc typos (@domitian)
- #1488 Require ActiveSupport's string inflections (@nate00)
Misc:
- #1608 Move SerializableResource to ActiveModelSerializers (@groyoh)
- #1602 Add output examples to Adapters docs (@remear)
- #1557 Update docs regarding overriding the root key (@Jwan622)
- #1471 [Cleanup] Serializer caching is its own concern. (@bf4)
- #1482 Document JSON API implementation defs and progress in class. (@bf4)
- #1551 Added codebeat badge (@korzonek)
- #1527 Refactor fragment cache class. (@groyoh)
- #1560 Update rubocop and address its warnings. (@bf4 @groyoh)
- #1545 Document how to pass arbitrary options to the serializer (@CodedBeardedSignedTaylor)
- #1496 Run all branches against JRuby on CI (@nadavshatz)
- #1559 Add a deprecation DSL. (@bf4 @groyoh)
- #1543 Add the changes missing from #1535. (@groyoh)
- #1535 Move the adapter and adapter folder to active_model_serializers folder and changes the module namespace. (@domitian @bf4)
- #1497 Add JRuby-9000 to appveyor.yml(@corainchicago)
- #1420 Adds tests and documentation for polymorphism(@marcgarreau)
Breaking changes:
- #1360 #1369 Drop support for Ruby 1.9.3 (@karaAJC, @maurogeorge)
- #1131 Remove Serializer#root_name (@beauby)
- #1138 Introduce Adapter::Base (@bf4)
- Adapters now inherit Adapter::Base. 'Adapter' is now a module, no longer a class.
- using a class as a namespace that you also inherit from is complicated and circular at times i.e. buggy (see #1177)
- The class methods on Adapter aren't necessarily related to the instance methods, they're more Adapter functions.
- named
Base
because it's a Rails-ism. - It helps to isolate and highlight what the Adapter interface actually is.
- Adapters now inherit Adapter::Base. 'Adapter' is now a module, no longer a class.
- #1418 serialized collections now use the root option as is; now, only the root derived from the serializer or object is always pluralized.
Features:
- #1406 Allow for custom dynamic values in JSON API links (@beauby)
- #1270 Adds
assert_response_schema
test helper (@maurogeorge) - #1099 Adds
assert_serializer
test helper (@maurogeorge) - #1403 Add support for if/unless on attributes/associations (@beauby)
- #1248 Experimental: Add support for JSON API deserialization (@beauby)
- #1378 Change association blocks
to be evaluated in serializer scope, rather than association scope. (@bf4)
- Syntax changes from e.g.
has_many :titles do customers.pluck(:title) end
(in #1356) tohas_many :titles do object.customers.pluck(:title) end
- Syntax changes from e.g.
- #1356 Add inline syntax for
attributes and associations (@bf4 @beauby @noahsilas)
- Allows defining attributes so that they don't conflict with existing methods. e.g.
attribute :title do 'Mr. Topum Hat' end
- Allows defining associations so that they don't conflict with existing methods. e.g.
has_many :titles do customers.pluck(:title) end
- Allows dynamic associations, as compared to compare to using
virtual_value
. e.g.has_many :reviews, virtual_value: [{ id: 1 }, { id: 2 }]
- Allows dynamic associations, as compared to compare to using
- Removes dynamically defined methods on the serializer
- Allows defining attributes so that they don't conflict with existing methods. e.g.
- #1336 Added support for Grape >= 0.13, < 1.0 (@johnhamelink)
- #1322 Instrumenting rendering of resources (@bf4, @maurogeorge)
- #1291 Add logging (@maurogeorge)
- #1272 Add PORO serializable base class: ActiveModelSerializers::Model (@bf4)
- #1255 Make more class attributes inheritable (@bf4)
- #1249 Inheritance of serializer inheriting the cache configuration(@Rodrigora)
- #1247 Add support for toplevel JSON API links (@beauby)
- #1246 Add support for resource-level JSON API links (@beauby)
- #1225 Better serializer lookup, use nested serializer when it exists (@beauby)
- #1213
type
directive for serializer to control type field with json-api adapter (@youroff) - #1172 Better serializer registration, get more than just the first module (@bf4)
- #1158 Add support for wildcards in
include
option (@beauby) - #1127 Add support for nested
associations for JSON and Attributes adapters via the
include
option (@NullVoxPopuli, @beauby). - #1050 Add support for toplevel jsonapi member (@beauby, @bf4)
- #1251 Rename ArraySerializer to CollectionSerializer for clarity, add ActiveModelSerializers.config.collection_serializer (@bf4)
- #1295 Add config
serializer_lookup_enabled
that, when disabled, requires serializers to explicitly specified. (@trek)
Fixes:
- #1352 Fix generators; Isolate Rails-specifc code in Railties (@dgynn, @bf4)
- #1384Fix database state leaking across tests (@bf4)
- #1297 Fix
fields
option to restrict relationships as well (@beauby) - #1239 Fix duplicates in JSON API compound documents (@beauby)
- #1214 retrieve the key from the reflection options when building associations (@NullVoxPopuli, @hut8)
- #1358 Handle serializer file paths with spaces (@rwstauner, @bf4)
- #1195 Fix id override (@beauby)
- #1185 Fix options passing in Json and Attributes adapters (@beauby)
Misc:
- #1383 Simplify reflections handling (@beauby)
- #1370 Simplify attributes handling via a mixin (@beauby)
- #1301 Mapping JSON API spec / schema to AMS (@bf4)
- #1271 Handle no serializer source file to digest (@bf4)
- #1260 Serialization and Cache Documentation (@bf4)
- #1259 Add more info to CONTRIBUTING (@bf4)
- #1233 Top-level meta and meta_key options no longer handled at serializer level (@beauby)
- #1232 fields option no longer handled at serializer level (@beauby)
- #1220 Remove empty rubocop.rake (@maurogeorge)
- #1178 env CAPTURE_STDERR=false lets devs see hard failures (@bf4)
- #1177 Remove Adapter autoloads in favor of require (@bf4)
- #1117 FlattenJson adapter no longer inherits Json adapter, renamed to Attributes (@bf4)
- #1171 add require statements to top of file (@shicholas)
- #1167 Delegate Serializer.attributes to Serializer.attribute (@bf4)
- #1174 Consistently refer to the 'JSON API' and the 'JsonApi' adapter (@bf4)
- #1173 Comment private accessor warnings (@bf4)
- #1166 Prefer methods over instance variables (@bf4)
- #1168 Fix appveyor failure cache not being expired (@bf4)
- #1161 Remove duplicate test helper (@bf4)
- #1360 Update CI to test 2.2.2 -> 2.2.3 (@karaAJC)
- #1371 Refactor, update, create documentation (@bf4)
- #1129 Remove SerializableResource.serialize in favor of
.new
(@bf4) - #1155 Outside controller use tutorial (@CodedBeardedSignedTaylor)
- #1154 Rubocop fixes for issues introduced by #1089 (@NullVoxPopuli)
- #1089 Add ActiveModelSerializers.logger with default null device (@bf4)
- #1109 Make better use of Minitest's lifecycle (@bf4)
- #1144 Fix Markdown to adapters documentation (@bacarini)
- #1121 Refactor
add_links
in JSONAPI adapter. (@beauby) - #1150 Remove legacy method accidentally reintroduced in #1017 (@beauby)
- #1149 Update README with nested included association example. (@mattmueller)
- #1110 Add lint tests for AR models (@beauby)
- #1131 Extended format for JSONAPI
include
option (@beauby)- adds extended format for
include
option to JsonApi adapter
- adds extended format for
- #1142 Updating wording on cache expiry in README (@leighhalliday)
- #1140 Fix typo in fieldset exception (@lautis)
- #1132 Get rid of unnecessary instance variables, and implied dependencies. (@beauby)
- #1139 Documentation for serializing resources without render (@PericlesTheo)
- #1017 Make Adapters registerable so they are not namespace-constrained (@bf4)
- #1120 Add windows platform to loading sqlite3 (@Eric-Guo)
- #1123 Remove url options (@bacarini)
- #1093 Factor
with_adapter
+ force cache clear before each test. (@beauby) - #1095 Add documentation about configuration options. (@beauby)
- #1069 Add test coverage; account for no artifacts on CI (@bf4)
- #1103 Move
id
andjson_api_type
methods fromSerializer
toJsonApi
. (@beauby) - #1106 Add Style enforcer (via Rubocop) (@bf4)
- #1079 Add ArraySerializer#object like Serializer (@bf4)
- #1096 Fix definition of serializer attributes with multiple calls to `attri… (@beauby)
- #1105 Add ActiveRecord-backed fixtures. (@beauby)
- #1108 Better lint (@bf4)
- #1102 Remove remains of
embed
option. (@beauby) - #1090 Clarify AMS dependencies (@bf4)
- #1081 Add configuration option to set resource type to singular/plural (@beauby)
- #1067 Fix warnings (@bf4)
- #1066 Adding appveyor to the project (@joaomdmoura, @Eric-Guo, @bf4)
- #1071 Make testing suite running and pass in Windows (@Eric-Guo, @bf4)
- #1041 Adding pagination links (@bacarini)
- adds support for
pagination links
at top level of JsonApi adapter
- adds support for
- #1063 Lead by example: lint PORO model (@bf4)
- #1 Test caller line parsing and digesting (@bf4)
- #1048 Let FlattenJson adapter decide it doesn't include meta (@bf4)
- #1060 Update fragment cache to support namespaced objects (@aaronlerch)
- #1052 Use underscored json_root when serializing a collection (@whatthewhat)
- #1051 Fix some invalid JSON in docs (@tjschuck)
- #1049 Fix incorrect s/options = {}/options ||= {} (@bf4)
- #1037 allow for type attribute (@lanej)
- #1034 allow id attribute to be overriden (@lanej)
- #1035 Fixed Comments highlight (@artLopez)
- #1031 Disallow to define multiple associations at once (@bolshakov)
- #1032 Wrap railtie requirement with rescue (@elliotlarson)
- #1026 Bump Version Number to 0.10.0.rc2 (@jfelchner)
- #985 Associations implementation refactoring (@bolshakov)
- #954 Encapsulate serialization in ActiveModel::SerializableResource (@bf4)
- #972 Capture app warnings on test run (@bf4)
- #1019 Improve README.md (@baojjeu)
- #998 Changing root to model class name (@joaomdmoura)
- #1006 Fix adapter inflection bug for api -> API (@bf4)
- #1016 require rails/railtie before subclassing Rails::Railtie (@bf4)
- #1013 Root option with empty array support (@vyrak, @mareczek)
- #994 Starting Docs structure (@joaomdmoura)
- #1007 Bug fix for ArraySerializer json_key (@jiajiawang)
- #1003 Fix transient test failures (@Rodrigora)
- #996 Add linter for serializable resource (@bf4)
- #990 Adding json-api meta test (@joaomdmoura)
- #984 Add option "key" to serializer associations (@Rodrigora)
- #982 Fix typo (@bf4)
- #981 Remove unused PORO#to_param (@bf4)
- #978 fix generators template bug (@regonn)
- #975 Fixes virtual value not being used (@GriffinHeart)
- #970 Fix transient tests failures (@Rodrigora)
- #962 Rendering objects that doesn't have serializers (@bf4, @joaomdmoura, @JustinAiken)
- #939 Use a more precise generated cache key (@aaronlerch)
- #971 Restore has_one to generator (@bf4)
- #965 options fedault valueserializable_hash and as_json (@bf4)
- #959 TYPO on README.md (@kangkyu)
- #958 Splitting json adapter into two (@joaomdmoura)
- adds FlattenJSON as default adapter
- #953 use model name to determine the type (@lsylvester)
- uses model name to determine the type
- #949 Don't pass serializer option to associated serializers (@bf4, @edwardloveall)
- #902 Added serializer file digest to the cache_key (@cristianbica)
- #948 AMS supports JSONAPI 1.0 instead of RC4 (@SeyZ)
- #936 Include meta when using json adapter with custom root (@chrisbranson)
- #942 Small code styling issue (@thiagofm)
- #930 Reverting PR #909 (@joaomdmoura)
- #924 Avoid unnecessary calls to attribute methods when fragment caching (@navinpeiris)
- #925 Updates JSON API Adapter to generate RC4 schema (@benedikt)
- adds JSON API support 1.0
- #918 Adding rescue_with_handler to clear state (@ryansch)
- #909 Defining Json-API Adapter as Default (@joaomdmoura)
- remove root key option and split JSON adapter
- #914 Prevent possible duplicated attributes in serializer (@groyoh)
- #880 Inabling subclasses serializers to inherit attributes (@groyoh)
- #913 Avoiding the serializer option when instantiating a new one for ArraySerializer Fixed #911 (@groyoh)
- #897 Allow to define custom serializer for given class (@imanel)
- #892 Fixed a bug that appeared when json adapter serialize a nil association (@groyoh)
- #895 Adding a test to cover 'meta' and 'meta_key' attr_readers (@adomokos)
- #894 Fixing typos in README.md (@adomokos)
- #888 Changed duplicated test name in action controller test (@groyoh)
- #890 Remove unused method
def_serializer
(@JustinAiken) - #887 Fixing tests on JRuby (@joaomdmoura)
- #885 Updates rails versions for test and dev (@tonyta)
- #810 Adding Fragment Cache to AMS (@joaomdmoura)
- adds fragment cache support
- #868 Fixed a bug that appears when a nil association is included (@groyoh)
- #861 README: Add emphasis to single-word difference (@machty)
- #858 Included resource fixes (@mateomurphy)
- #853 RC3 Updates for JSON API (@mateomurphy)
- #852 Fix options merge order in
each_association
(@mateomurphy) - #850 Use association value for determining serializer used (@mateomurphy)
- #843 Remove the mailing list from the README (@JoshSmith)
- #842 Add notes on how you can help to contributing documentation (@JoshSmith)
- #833 Cache serializers for class (@lsylvester)
- #837 Store options in array serializers (@kurko)
- #836 Makes passed in options accessible inside serializers (@kurko)
- #773 Make json api adapter 'include' option accept an array (@sweatypitts)
- #830 Add contributing readme (@JoshSmith)
- #811 Reimplement serialization scope and scope_name (@mateomurphy)
- #725 Support has_one to be compatible with 0.8.x (@ggordon)
- adds
has_one
attribute for backwards compatibility
- adds
- #822 Replace has_one with attribute in template (@bf4)
- #821 Fix explicit serializer for associations (@wjordan)
- #798 Fix lost test
test_include_multiple_posts_and_linked
(@donbobka) - #807 Add Overriding attribute methods section to README. (@alexstophel)
- #693 Cache Support at AMS 0.10.0 (@joaomdmoura)
- adds cache support to attributes and associations.
- #792 Association overrides (@kurko)
- adds method to override association
- #794 add to_param for correct URL generation (@carlesjove)
- Introduce Adapter
- Prefer
ActiveModel::Serializer
toActiveModelSerializers
: