105 Commits

Author SHA1 Message Date
Johannes Vetter
d7f6963afc Links on a relationship can take a callable 2021-01-16 11:45:37 -08:00
Stas SUȘCOV
c3376037e7 Let everyone know there's a WIP branch for v3. 2021-01-11 11:11:24 +00:00
Yaroslav Kasperovych
963cd77900 Fix require clause in fastjson migration guide
Seems like the require clause should be different as it produces an error if used as it is right now.
2020-11-06 10:15:26 +00:00
Tony Dehnke
98dd59884c Fix namespace name per comment in #139 2020-10-26 12:01:52 +00:00
Guillaume Briday
b7e8a30833 Fix typo in readme 2020-10-25 18:13:08 +00:00
Guillaume Briday
f4ed4f0440 Adding migration section 2020-10-25 17:23:20 +00:00
Jorge Garcia
88061bcfac Add deserialization options on Readme 2020-10-08 10:21:20 +01:00
Stas SUȘCOV
72f3ae64dd Remove skylight and old instrumentation support. 2020-08-30 15:57:07 +01:00
Kapil Sachdev
c32358ecf5 fix: Rename FastJsonapi::ObjectSerializer to JSONAPI::Serializer
As the project has been renamed, its better to reflect it in the source 
code as well.
JSONAPI::Serializer is evaluated from FastJsonapi::ObjectSerializer so 
this change  probably will go unnoticed in gem usage.
2020-08-27 10:57:15 +01:00
Kapil Sachdev
f56a354860
Update links to use https (#114) 2020-08-25 18:50:24 +01:00
Matthew Newell
8401d16c2e Fix cache keys to prevent fieldset caching errors
This change alters the cache namespace prior to retrieving cached record
data to ensure that different fieldsets are given different cache keys.

Previously, all cache keys for the same record would be specified
identically, leading to a situation where the fieldset would be ignored
if record caching is enabled.

Fixes #90.
2020-08-11 12:54:57 +01:00
David Angulo
0e051fcad2 Add example for custom attribute with condtion 2020-08-07 12:35:11 +01:00
mperice
dd7f5ba415
Add optional meta field to relationships (#99) (#100)
* Add optional meta field to relationships (#99)

* Fix Rubocop's warnings.

* Minor syntax corrections.
2020-07-07 15:22:25 +01:00
Stas SUȘCOV
95ce09d526 Updated the readme. 2020-06-22 14:47:59 +01:00
sun
1819629408
Add set_type documentation (#88) 2020-05-25 12:53:35 +01:00
Kevin Pheasey
7e2289006c chore(version): release 1.7.2 2020-05-18 11:21:44 -04:00
Stas SUȘCOV
ac34aa22f7
Revert "Updated the installation steps."
This reverts commit ab9db291d4d89ed93029f0844461498364d3be3b.
2020-05-01 16:30:22 +01:00
Stas SUȘCOV
c32aacd8a6 Updated the readme with performance tests. 2020-04-29 15:30:44 +01:00
Stas SUȘCOV
ab9db291d4
Updated the installation steps. 2020-04-29 15:15:30 +01:00
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
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
Stas SUȘCOV
ca5c776d71 Added templates for contributing. Minor cleanups. 2020-01-17 13:46:34 +00:00
Attila Horváth
c305b699a9 Clean up some whitespace in the README (#35) 2019-12-18 13:19:21 +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
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
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
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
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
Srinivas R
3df917f407
Update README.md 2019-06-11 14:59:22 -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
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
a105bac3d9
Merge pull request #336 from coderbydesign/patch-1
Minor fix in README.md
2018-11-03 11:30:35 -07:00
Larissa Reis
0ba5f231fe Add set_id block syntax example to README 2018-10-18 22:04:52 -06:00
Keith Walsh
dbda6b6153
Update README.md
Resolve minor typo
2018-10-17 09:29:49 -04: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
zino
467024f8fd Improve readme with id_method_name 2018-10-02 11:36:21 -04:00
Orhan Toy
8357acd6a7 [ci skip] Fix punctuation 2018-09-03 12:01:45 -07:00
Shishir Kakaraddi
2eaaa71bd8
Merge pull request #299 from g13ydson/feature/add_option_key
add the option "key" in customizable options in the README
2018-08-13 18:05:05 -07:00
Gleydson Tavares
ce2c8003ee add the "option key" in customizable options 2018-08-10 13:15:02 -03:00
Nik Wakelin
100f850416
Merge branch 'dev' into add-links-option-to-relationship-serializer 2018-08-05 20:58:39 +01:00
nikz
8eef7a0bb1 Adds README documentation for relationship links 2018-08-05 20:51:56 +01:00