Commit Graph

213 Commits

Author SHA1 Message Date
Benjamin Fleischer
60ba54a3b0
Set up GitHub actions CI (#2403)
* Set up GitHub actions CI
* Remove simplecov entirely for now
* Fix deprecations
* Relax dev deps
* Address Rails 6.0 blocking hosts
* Rails 6.1 content type changed to application/json; charset=utf-8
* Test a few more rubies and rails
* Stop testing grape. We should drop grape support

```
/home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/grape-0.19.0/lib/grape/error_formatter.rb:16: warning: in `formatters': the last argument was passed as a single Hash
/home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/grape-0.19.0/lib/grape/error_formatter.rb:21: warning: although a splat keyword arguments here
Run options: --seed 23470

..........................................................................................................................................................................................................................................................................................................................................................................................................................................E

ActiveModelSerializers::GrapeTest#test_render_helper_passes_through_options_correctly:
NoMethodError: undefined method `[]' for nil:NilClass

bin/rails test /home/runner/work/active_model_serializers/active_model_serializers/test/grape_test.rb:126

W, [2020-12-29T02:27:48.991413 #2790]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#size defined in Hash. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
W, [2020-12-29T02:27:48.991505 #2790]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#size defined in Hash. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
W, [2020-12-29T02:27:48.991581 #2790]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#size defined in Hash. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
W, [2020-12-29T02:27:48.991625 #2790]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#size defined in Hash. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
E

Error:
ActiveModelSerializers::GrapeTest#test_implicit_formatter_handles_collections:
NoMethodError: undefined method `[]' for nil:NilClass

bin/rails test /home/runner/work/active_model_serializers/active_model_serializers/test/grape_test.rb:185

...............................................................................................................................................

Finished in 2.052241s, 280.6688 runs/s, 473.6285 assertions/s.
576 runs, 972 assertions, 0 failures, 7 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -w -I"lib:lib:test" -r./test/test_helper.rb  -w -I"/home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/lib" "/home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/lib/rake/rake_test_loader.rb" "test/action_controller/adapter_selector_test.rb" "test/action_controller/explicit_serializer_test.rb" "test/action_controller/json/include_test.rb" "test/action_controller/json_api/deserialization_test.rb" "test/action_controller/json_api/errors_test.rb" "test/action_controller/json_api/fields_test.rb" "test/action_controller/json_api/linked_test.rb" "test/action_controller/json_api/pagination_test.rb" "test/action_controller/json_api/transform_test.rb" "test/action_controller/lookup_proc_test.rb" "test/action_controller/namespace_lookup_test.rb" "test/action_controller/serialization_scope_name_test.rb" "test/action_controller/serialization_test.rb" "test/active_model_serializers/adapter_for_test.rb" "test/active_model_serializers/json_pointer_test.rb" "test/active_model_serializers/logging_test.rb" "test/active_model_serializers/model_test.rb" "test/active_model_serializers/test/schema_test.rb" "test/active_model_serializers/test/serializer_test.rb" "test/active_record_test.rb" "test/adapter/attributes_test.rb" "test/adapter/deprecation_test.rb" "test/adapter/json/belongs_to_test.rb" "test/adapter/json/collection_test.rb" "test/adapter/json/fields_test.rb" "test/adapter/json/has_many_test.rb" "test/adapter/json/transform_test.rb" "test/adapter/json_api/belongs_to_test.rb" "test/adapter/json_api/collection_test.rb" "test/adapter/json_api/errors_test.rb" "test/adapter/json_api/fields_test.rb" "test/adapter/json_api/has_many_explicit_serializer_test.rb" "test/adapter/json_api/has_many_test.rb" "test/adapter/json_api/has_one_test.rb" "test/adapter/json_api/include_data_if_sideloaded_test.rb" "test/adapter/json_api/json_api_test.rb" "test/adapter/json_api/linked_test.rb" "test/adapter/json_api/links_test.rb" "test/adapter/json_api/pagination_links_test.rb" "test/adapter/json_api/parse_test.rb" "test/adapter/json_api/relationship_test.rb" "test/adapter/json_api/resource_meta_test.rb" "test/adapter/json_api/toplevel_jsonapi_test.rb" "test/adapter/json_api/transform_test.rb" "test/adapter/json_api/type_test.rb" "test/adapter/json_test.rb" "test/adapter/null_test.rb" "test/adapter/polymorphic_test.rb" "test/adapter_test.rb" "test/array_serializer_test.rb" "test/cache_test.rb" "test/collection_serializer_test.rb" "test/generators/scaffold_controller_generator_test.rb" "test/generators/serializer_generator_test.rb" "test/grape_test.rb" "test/lint_test.rb" "test/logger_test.rb" "test/poro_test.rb" "test/serializable_resource_test.rb" "test/serializers/association_macros_test.rb" "test/serializers/associations_test.rb" "test/serializers/attribute_test.rb" "test/serializers/attributes_test.rb" "test/serializers/configuration_test.rb" "test/serializers/fieldset_test.rb" "test/serializers/meta_test.rb" "test/serializers/options_test.rb" "test/serializers/read_attribute_for_serialization_test.rb" "test/serializers/reflection_test.rb" "test/serializers/root_test.rb" "test/serializers/serialization_test.rb" "test/serializers/serializer_for_test.rb" "test/serializers/serializer_for_with_namespace_test.rb" ]
/home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle:23:in `load'
/opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle:23:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
Error: Process completed with exit code 1.
```
2020-12-31 17:15:21 -05:00
Alex Zherdev
628eff2582 Update configuration options doc 2019-10-17 11:07:37 -07:00
Felipe Renan
12ccb78fdb Fix serializer class link on guides
The link was pointing out to the master branch instead of the
v-10-stable branch.
2019-03-21 11:41:25 -03:00
Konstantin Munteanu
0d3999c36d Support conditions in link statements 2018-10-25 09:45:34 +02:00
Alvin Crespo
3a200d7fe1
Minor doc update
Use model.class.name to do the correct comparison
2018-09-07 14:28:21 -04:00
Abhay Nikam
4559774d60 Updated the defination for the class_name in documentation 2018-06-21 08:49:33 +05:30
Abhay Nikam
993a48fdcf wordsmitting 2018-06-07 10:05:21 +05:30
Abhay Nikam
65cf4836c8 Updated class_name defination. 2018-06-07 10:04:03 +05:30
Abhay Nikam
f3b202746b Added examples to use class_name options for association. 2018-06-07 09:58:48 +05:30
Benjamin Fleischer
3dd6cccb4d Fix 0.10.6 regression; make using belongs_to on self opt-in 2017-11-13 08:36:23 -06:00
Todd Morningstar
0bbeeb384e Update serializers.md
* Add note that any controller reference is acceptable for `serialization_scope`
 * Add note about `ActionController::API` and `view_context` set to `nil`, with respect to accessing helpers in a Serializer
 * refs #2144
 * Update CHANGELOG.md
2017-10-31 17:15:43 -04:00
Nate Pinsky
88367da970 Add warnings about global adapter config to docs (#2176) 2017-10-24 17:30:56 -05:00
Joel Tanner Jones
622872ae2b Fix dead link in docs/general/rendering
The add_pageination_links.md is dead in docs/general/rendering on the
0-10-stable branch.
2017-06-13 13:28:24 -04:00
Benjamin Fleischer
ec7b5859f7 Document namespace 2017-05-01 10:25:14 -05:00
Benjamin Fleischer
96028a7b99 Document new reflection options; support :foreign_key 2017-05-01 10:18:13 -05:00
Cassidy K
aa619b5e0e Update Serializers and Rendering Docs
- Updating general/serializers.md
- Updating docs/general/rendering.md
- adding to changelog
- Updating rendering.md to indicate that `each_serializer` must be used on a collection
- updating my handle in previous changelog entry
2017-04-19 11:29:20 -04:00
Timur
1a5e66b933 [0.10] add docs for include (#2081)
* Add docs for `include` option in the adapter
2017-03-28 02:16:45 -05:00
Ryunosuke Sato
cec6478f32 Fix example code in doc/general/getting_started.md
The `belongs_to` method should take relation name, not a foreign_key property.
2017-03-24 10:40:27 +09:00
lvela
c377b7e31d Correct info on using JSON adapter
I think this needs to be changed (based on info above).
2017-03-13 14:21:56 -05:00
Matt Gardner
24c0212c83 Providing caveat in documentation (#2070)
* Providing caveat in documentation

I think it'd be helpful to mention that `jsonapi_parse!` will throw an InvalidDocument error.

* Update ember-and-json-api.md
2017-03-08 18:04:35 -05:00
Hitabis GmbH
d48aaefdb2 Remove typo from upgrade from 0.8 to 0.10 docs
Typo ActiveMode::Serializer was changed to ActiveModel::Serializer
2017-03-07 09:36:05 +01:00
Akiicat
19f8ada4af Update serializers.md 2017-02-28 05:23:19 +08:00
Nick Ottrando
a9d533d916 Update outside_controller_use.md (#2047)
* Update outside_controller_use.md

Provide example for options parameter when serializing a resource.
2017-02-08 15:06:31 -06:00
Benjamin Fleischer
58e3983e4c Merge pull request #2037 from bf4/doc_derive_attributes_from_names_and_fix_accessors
Document Model declared attributes
2017-02-02 02:29:25 -06:00
Benjamin Fleischer
1e47c167a1 Merge branch 'master' into patch-1 2017-01-31 09:07:52 -06:00
Benjamin Fleischer
28c1b5bef6 Document Model delcared attributes 2017-01-31 09:02:51 -06:00
Igor Zubkov
3c6eb57ee9 Replace object with collection.
Replace resource with collection.
2017-01-24 13:28:50 +02:00
Igor Zubkov
d6b1b1c81f Fix typo 2017-01-24 13:27:20 +02:00
MSathieu
ab98c4a664 Update logging.md 2017-01-22 13:14:19 +01:00
MSathieu
3d44bfcf28 Update logging.md 2017-01-17 18:21:21 +01:00
MSathieu
68f8ebedf4 Update logging.md 2017-01-17 17:43:22 +01:00
Benjamin Fleischer
93ca27fe44 Merge 0-10-stable into master (to fix breaking change). (#2023)
* Merge pull request #1990 from mxie/mx-result-typo

Fix typos and capitalization in Relationship Links docs [ci skip]

* Merge pull request #1992 from ojiry/bump_ruby_versions

Run tests by Ruby 2.2.6 and 2.3.3

* Merge pull request #1994 from bf4/promote_architecture

Promote important architecture description that answers a lot of questions we get
Conflicts:
	docs/ARCHITECTURE.md

* Merge pull request #1999 from bf4/typos

Fix typos [ci skip]

* Merge pull request #2000 from berfarah/patch-1

Link to 0.10.3 tag instead of `master` branch

* Merge pull request #2007 from bf4/check_ci

Test was failing due to change in JSON exception message when parsing empty string

* Swap out KeyTransform for CaseTransform (#1993)

* delete KeyTransform, use CaseTransform

* added changelog

Conflicts:
	CHANGELOG.md

* Merge pull request #2005 from kofronpi/support-ruby-2.4

Update jsonapi runtime dependency to 0.1.1.beta6

* Bump to v0.10.4

* Merge pull request #2018 from rails-api/bump_version

Bump to v0.10.4 [ci skip]
Conflicts:
	CHANGELOG.md

* Merge pull request #2019 from bf4/fix_method_redefined_warning

Fix AMS warnings

* Merge pull request #2020 from bf4/silence_grape_warnings

Silence Grape warnings

* Merge pull request #2017 from bf4/remove_warnings

Fix mt6 assert_nil warnings

* Updated isolated tests to assert correct behavior. (#2010)

* Updated isolated tests to assert correct behavior.
* Added check to get unsafe params if rails version is great than 5

* Merge pull request #2012 from bf4/cleanup_isolated_jsonapi_renderer_tests_a_bit

Cleanup assertions in isolated jsonapi renderer tests a bit

* Add Model#attributes helper; make test attributes explicit

* Fix model attributes accessors

* Fix typos

* Randomize testing of compatibility layer against regressions

* Test bugfix

* Add CHANGELOG

* Merge pull request #1981 from groyoh/link_doc

Fix relationship links doc
Conflicts:
	CHANGELOG.md
2017-01-10 02:28:50 -06:00
Yohan Robert
91128fadb8 [skip ci] Fix relationship link documentation 2016-12-30 21:02:03 +01:00
Benjamin Fleischer
15a8f2c1eb Promote important architecture description that answers a lot of questions we get 2016-12-04 15:26:44 -06:00
Melissa Xie
3733efaf99 Use consistent capitalization for JSONAPI adapter references 2016-11-29 10:41:16 -05:00
Melissa Xie
4f72cc7d8c Fix "result" typo 2016-11-29 10:38:12 -05:00
Benjamin Fleischer
772b7999c5 Better AMS Model attributes interface 2016-11-21 09:14:26 -06:00
Alex Popov
d39dd04c11 Update SerializableResource documentation (#1977)
Mention that ActiveModelSerializers::SerializableResource.new can be used for
single resource as well as for collections
2016-11-17 13:57:07 +01:00
L. Preston Sego III
d31d741f43 Make serializer lookup configurable (#1757) 2016-11-16 18:38:40 +01:00
L. Preston Sego III
b29395b0ac This adds namespace lookup to serializer_for (#1968)
* This adds namespace lookup to serializer_for

* address rubocop issue

* address @bf4's feedback

* add docs

* update docs, add more tests

* apparently rails master doesn't have before filter

* try to address serializer cache issue between tests

* update cache for serializer lookup to include namespace in the key, and fix the tests for explicit namespace

* update docs, and use better cache key creation method

* update docs [ci skip]

* update docs [ci skip]

* add to changelog [ci skip]
2016-11-09 07:57:39 -05:00
Julia
b709cd41e6 Improve type method documentation (#1967) 2016-11-04 16:49:48 +01:00
大野峻典
ce8dd36633 Add documentation for root (#1959) 2016-11-01 19:25:52 +01:00
Benjamin Fleischer
6c6e45b23f Replace fail/rescue CollectionSerializer::NoSerializerError with throw/catch :no_serializer (#1767) 2016-09-26 10:18:27 -04:00
Brendon Muir
0606b06abd Update upgrade_from_0_8_to_0_10.md (#1933)
Update upgrade_from_0_8_to_0_10.md

Changes the upgrade guide to highlight the change in the way relationships are walked.
2016-09-20 13:38:53 -04:00
Ikariusrb
58ebf96e03 Update ember-and-json-api.md (#1894)
* Update ember-and-json-api.md

Removed ember-data adapter change to support include directives, as it's now built-in.  Updated the documentation for how to add include directives to ember store queries, and added documentation covering how to tell Rails that we are consuming and generating jsonapi data

* Fix up format for parameter restrictions

* Update ember-and-json-api.md

Updates to address comments; explain why Rails should know what format we are consuming/generating, reword introduction to include: examples, and fix render statement to specify jsonapi instead of json.
2016-09-07 16:26:33 -04:00
Mario Olivio Flores
1899437566 Add info on setting polymorphic serializers (#1906)
While this same document provides details on how to override the
serializer_for, not all users will realize this could be used to set the
sterilizers for polymorphic relationships.  This change just adds a link
to that documentation and makes that point obvious.
2016-09-07 15:22:08 -04:00
Filippos Vasilakis
50f27546c3 Add docs for links (#1909)
Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add controller info

Grammar fixing

Improve docs

some small wording changes

Add pr to changelog
2016-09-07 15:10:45 -04:00
Alberto Miedes Garcés
050060478d Fix typo (#1916) 2016-09-06 08:42:04 -04:00
Benjamin Fleischer
d34069b6ae Merge pull request #1799 from ScottKbka/patch-1
Update rendering.md
2016-08-31 16:18:47 -05:00
Benjamin Fleischer
ab85ce2b13 Merge pull request #1888 from Patsy-issa/patch-1
Updated ember integration guide to use the proper renderer
2016-08-31 01:07:30 -05:00