360 Commits

Author SHA1 Message Date
Krzysztof Rybka
b24af1f912 Test against Ruby 2.6 and fix Travis (#3)
* Test against Ruby 2.6

* Enforce bundler 1.17.3
2019-10-04 12:50:22 -04:00
iwsksky
e68dbee806 update document/use let statement 2019-10-04 12:50:22 -04:00
iwsksky
b9a86a002a pass array of unique movies to serializer 2019-10-04 12:50:22 -04:00
Daniel Duke
5767664c8a add specs for multiple include options 2019-10-04 12:50:22 -04:00
Daniel Duke
267b706366 validate all include items instead of just the first 2019-10-04 12:50:22 -04:00
Daniel Illi
8d8e5c3059 Fix error on defining anonymous serializer class, fixes #353 2019-10-04 12:50:22 -04:00
Matt Eddy
21ae4aaa0a Allow fieldsets to specify no attributes/relationships 2019-10-04 12:50:22 -04:00
Danil Pismenny
1a407c0030 [#365] Support frozen array in option 2019-10-04 12:50:22 -04:00
Maxime Orefice
021db27605 Update Readme
Fix typo
2019-10-04 12:50:22 -04:00
Charalampos Aristomenopoulos
209c925723 Fix typo in README 2019-10-04 12:50:22 -04:00
Csaba Apagyi
f0142d948c Fix formatting of set_id example in README 2019-10-04 12:50:22 -04:00
Jessie A. Young
9e83c1e0a5 Highlight that this is for JSON:API spec only
* The link was already there but I skipped over it on my first read.
This update makes the fact more prominent.
* I was testing to see if we wanted to move from AM Serializers to
fast_jsonapi but our API is not written according to the JSON:API spec
so, after converting one serializer over, I learned that this would not work for me.
* This update might save someone in my position the ~30 mins or so it
takes to bundle and write a serializer in the future. :)
2019-10-04 12:50:22 -04:00
Kevin Pheasey
0dc332dc32
Create CHANGELOG.md 2019-10-04 12:46:53 -04:00
Krzysztof Rybka
dce1faf1e2 Move transforms mapping to constant 2019-10-04 12:44:22 -04:00
Krzysztof Rybka
9ec89d4cf5 Map split include_item in-place 2019-10-04 12:42:42 -04:00
Jo Potts
2b6c81692f Allow relationship links to be declared as object method (#2)
* Allow relationship links to be declared as object method

* Relationship links note added to readme
2019-10-04 12:39:34 -04:00
Krzysztof Rybka
1373eb436c Compute remaining_items once 2019-10-04 12:28:02 -04:00
Krzysztof Rybka
d64b1b5f4f Test against Ruby 2.6 and fix Travis (#3)
* Test against Ruby 2.6

* Enforce bundler 1.17.3
2019-10-04 08:42:12 -04:00
Srinivas R
3df917f407
Update README.md 2019-06-11 14:59:22 -07:00
iwsksky
83e7fb62f9 update document/use let statement 2019-04-07 12:50:43 -07:00
iwsksky
4077a23c45 pass array of unique movies to serializer 2019-04-07 12:50:43 -07:00
Daniel Duke
9f0608d4c9 add specs for multiple include options 2019-04-07 12:33:16 -07:00
Daniel Duke
3668625882 validate all include items instead of just the first 2019-04-07 12:33:16 -07:00
Daniel Illi
dd379a02ca Fix error on defining anonymous serializer class, fixes #353 2019-04-07 12:29:56 -07:00
Matt Eddy
ae93b85103 Allow fieldsets to specify no attributes/relationships 2019-04-07 12:28:44 -07:00
Danil Pismenny
36b8ea2dfc [#365] Support frozen array in option 2019-03-28 21:15:08 -07:00
Shishir Kakaraddi
6aefeb7556 bump up version to 1.5 2019-03-28 21:15:08 -07:00
Manoj M J
e0228dacdc Add documentation on how to use helper methods in serializers 2019-03-28 21:12:36 -07:00
Manoj M J
a160d6746f Fix Documentation of Meta Per Resource
Some part of the documentation for this got removed during last merge, so fixing it.
2019-03-28 21:11:48 -07:00
Maxime Orefice
91e2beec8e Update Readme
Fix typo
2019-03-28 15:00:06 -07:00
Charalampos Aristomenopoulos
513eaca3dc Fix typo in README 2019-03-28 14:59:25 -07:00
Csaba Apagyi
bf7a7e35c8 Fix formatting of set_id example in README 2019-03-28 14:59:07 -07:00
Jessie A. Young
fcecda7dd8 Highlight that this is for JSON:API spec only
* The link was already there but I skipped over it on my first read.
This update makes the fact more prominent.
* I was testing to see if we wanted to move from AM Serializers to
fast_jsonapi but our API is not written according to the JSON:API spec
so, after converting one serializer over, I learned that this would not work for me.
* This update might save someone in my position the ~30 mins or so it
takes to bundle and write a serializer in the future. :)
2019-03-28 14:58:20 -07:00
Shishir Kakaraddi
fdcaed6f0d
Merge pull request #342 from Netflix/release-1.5
Release 1.5
1.5
2018-11-03 12:32:22 -07:00
Shishir Kakaraddi
ee76e0c69b bump up version to 1.5 2018-11-03 12:11:56 -07:00
Shishir Kakaraddi
cc7f88843a
Merge pull request #331 from larissa/set-id-block
Allow block for id customization
2018-11-03 11:37:56 -07:00
Shishir Kakaraddi
326f9784ca
Merge pull request #294 from nikz/add-links-option-to-relationship-serializer
Adds a :links option to the relationship macros
2018-11-03 11:35:39 -07:00
Shishir Kakaraddi
9d19f32c78
Merge pull request #334 from hmcfletch/fix/as-core_ext-time
require AS core extension for time
2018-11-03 11:30:54 -07:00
Shishir Kakaraddi
a105bac3d9
Merge pull request #336 from coderbydesign/patch-1
Minor fix in README.md
2018-11-03 11:30:35 -07:00
Shishir Kakaraddi
74bb9d6f6d
Merge pull request #339 from mhluska/fix-params-not-being-default
Fix params not being hash by default
2018-11-03 11:30:20 -07:00
Larissa Reis
0ba5f231fe Add set_id block syntax example to README 2018-10-18 22:04:52 -06:00
Maros Hluska
d5ea95370f Fix params not being hash by default 2018-10-18 22:59:33 +07:00
Keith Walsh
dbda6b6153
Update README.md
Resolve minor typo
2018-10-17 09:29:49 -04:00
Shishir Kakaraddi
ece607af5f
Merge pull request #326 from gorenje/spec_for_has_one_through
added spec for has_one-through relationship
2018-10-14 08:32:44 -07:00
Shishir Kakaraddi
935fc05beb
Merge pull request #329 from zinosama/improve-readme-with-id_method_name
Improve documentation with id_method_name
2018-10-14 08:31:01 -07:00
Shishir Kakaraddi
f3368dee2d
Merge pull request #330 from matzko/dev
Don't share data_links among inherited serializers.
2018-10-14 08:29:59 -07:00
Larissa Reis
9fa26fa588 Allow block for id customization
Allow an ID of object to be customized directly on the serializer by
passing a block to `set_id` as opposed to only through a model property.

We already allow for attributes that do not have a model property of the
same name to be customized directly on the serializer using a block.

This customization can be useful in situation in which you have
different classes being serialized using the same serializer. For
example, if we have `HorrorMovie`, `ComedyMovie` and `DramaMovie` using
the same `MovieSerializer`, we can unify their IDs using

```
class MovieSerializer
  include FastJsonapi::ObjectSerializer

  attributes :name, :year
  set_id do |record|
    "#{record.name.downcase}-#{record.id}"
  end
```

which is preferable to creating a `#serialized_id` method in every model
that will use `MovieSerializer` to encapsulate the customization.

Closes #315
2018-10-10 22:26:57 -06:00
Les Fletcher
05ad93084b
require 'active_support/core_ext/numeric/time’
`5.minutes` was failing in the performance spec
2018-10-09 14:53:57 -07:00
nikz
1ad20d6b7b Merge branch 'upstream-dev' into add-links-option-to-relationship-serializer 2018-10-07 21:29:43 +01:00
nikz
85b41c45d4 Adds :lazy_load_data option
If you include a default empty `data` option in your JSON API response,
many frontend frameworks will ignore your `related` link that could be
used to load relationship records, and will instead treat the
relationship as empty.

This adds a `lazy_load_data` option which will:

  * stop the serializer attempting to load the data and;
  * exclude the `data` key from the final response

This allows you to lazy load a JSON API relationship.
2018-10-07 21:23:36 +01:00