392 Commits

Author SHA1 Message Date
Markus
843d943e07
Refactor caching support (#52)
- Very explicit where caching is stored
- No `Rails.cache` automagic with possible colliding keys
- Rails 5.2+ cache versioning support
- Implicit namespace support (by cache instance, e.g.
  ActiveSupport::Cache::MemoryStore.new(namespace: 'jast_jsonapi')
- All cache instance options are supported
2020-02-25 16:49:02 +00:00
Attila Horvath
3faca2d1e0 Fix conditional procedures with lambdas 2020-02-21 14:36:50 +00:00
Attila Horvath
08a20d0ebb Fix relationships with &:proc shorthands 2020-02-20 13:44:18 +00:00
James Reichley
9daa5a64f1 Fix syntax error in json_serialization.md 2020-02-19 09:51:03 +00:00
hotatekaoru
e79406d455 Fix README typo
Fix typo in the readme sample command
from 
1b3d73cbf3
2020-02-18 13:49:06 +00:00
Stas SUȘCOV
1b3d73cbf3
Remove multi-to-json. Add a deprecation warning. 2020-02-15 15:05:06 +00:00
Christopher Sansone
6d01bec146
Improved relationship serializer options (#32)
* allow the relationship's serializer key to be a Proc

* fixes

* specifically test the relationship name and the resource type

* support object blocks without a serializer defined

* stop validation gracefully if the relationship is polymorphic

* improve performance by using instance variables instead of accessor methods

* force initialization up front to avoid the iterative calls

* serializer procs should act like polymorphic when determining the id_method_name

* specs for serializer procs

* updated with more details and examples for relationship serializer options

* adjust specs to define the serializers

* avoid extra method calls for performance

* name change

* one less function call for better performance

* do not require lazy loaded relationships to resolve the serializer

* give polymorphic precedence for backwards compatibility

* move serializer inference into ObjectSerializer to allow for overriding

* move method for better diff

* fix race condition in multi-threaded environments
2020-02-15 14:57:44 +00:00
Pedro Caseiro
79a49fb3bd Run CI against ruby 2.7 2020-01-17 16:07:21 +00:00
Stas SUȘCOV
ca5c776d71 Added templates for contributing. Minor cleanups. 2020-01-17 13:46:34 +00:00
Stas SUȘCOV
eb8460fd74 Switch to Github CI. 2020-01-07 18:51:20 +00:00
Stas SUȘCOV
2172e40892 Remove unused files. 2020-01-07 18:51:20 +00:00
Attila Horváth
c305b699a9 Clean up some whitespace in the README (#35) 2019-12-18 13:19:21 +00:00
Aubrey Holland
1d7c18f5da Support for polymorphic id_method_name (#17)
* fix id method bugs, add specs
* Use SecureRandom.uuid
2019-12-03 18:04:04 +00:00
Nick Rattermann
2d92ab4cf9 Update README.md (#20)
* Update README.md

Update README.md to include proper way to install this forked gem.

* Update README.md
2019-11-20 12:05:04 +00:00
Kevin Pheasey
6a08165347
Merge pull request #18 from fast-jsonapi/dev
1.6.0
2019-11-04 17:38:13 -05:00
Kevin Pheasey
1cd3f97485 1.6.0 1.6.0 2019-11-04 17:31:35 -05:00
Kevin Pheasey
8fe376c8a3
Update CHANGELOG.md 2019-10-25 09:36:02 -04:00
Brad Grzesiak
ddc261d8dc Allow "if: Proc..." on link (#15) 2019-10-25 09:32:56 -04:00
Henning Vogt
587fb2c5fe Add params to set_id block (#16)
* Add params to set_id block arguments

Pull request #331 added a block to the ObjectSerializer.set_id class
method, which allows passing a block to the set_id method. Currently
this block takes only one argument `record`:

```
set_id do |record|
  "#{record.name.downcase}-#{record.id}"
end
```

This PR adds another argument `params` to the block:

```
set id do |record, params|
  params[:admin] ?  record.id : "#{record.name.downcase}-#{record.id}"
end
```

This customization can be useful in situation where we serve different
clients that may need different IDs. One nice side effect is also that
the `set_id` method has the same method signature as the `attribute`
method.

* Update the README
2019-10-15 14:45:46 -04:00
Kevin Pheasey
691c8ac632 Merge branch 'master' into dev 2019-10-08 11:31:01 -04:00
Thomas
330dc89e62 do not enforce lastest bundler version 2019-10-08 11:29:59 -04:00
Thomas
0c49f29e75 update bundle version 2019-10-08 11:29:59 -04:00
Kevin Pheasey
145b4ce23a
Update CHANGELOG.md 2019-10-08 08:31:25 -04:00
David Pickart
8e2383128e Include data key when lazy-loaded relationships are specified with includes (#10) 2019-10-08 08:30:21 -04:00
Kevin Pheasey
37206ddf0b
Update CHANGELOG.md 2019-10-04 19:45:43 -04:00
Krzysztof Rybka
f2a1934b76 Use each_with_object instead of Hash[map] 2019-10-04 19:44:17 -04:00
Krzysztof Rybka
44a896dda5 Take items of original array instead of dup and delete 2019-10-04 19:41:22 -04:00
Kevin Pheasey
5f8629873a Merge remote-tracking branch 'origin/dev' into dev 2019-10-04 12:51:05 -04:00
Krzysztof Rybka
e4c65a2567 Move transforms mapping to constant 2019-10-04 12:50:22 -04:00
Krzysztof Rybka
fd17386b51 Map split include_item in-place 2019-10-04 12:50:22 -04:00
Jo Potts
83e99b2923 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:50:22 -04:00
Krzysztof Rybka
f04abfd2fe Compute remaining_items once 2019-10-04 12:50:22 -04:00
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