Commit Graph

123 Commits

Author SHA1 Message Date
Chris Peters
dba85f2720 #1594 - Document generator's auto-extending of (if it exists) 2016-04-02 13:18:07 -04:00
Krzysztof Rybka
37e0fdb0ee Remove wrong quoting in serializers guide 2016-03-31 14:56:07 +02:00
Benjamin Fleischer
fa7b3afbfd Prefer explicitly yielding the serializer, per groyoh 2016-03-30 14:01:28 -05:00
Arti Sinani
9e2edded7c architecture doc fix 2016-03-30 14:18:27 +01:00
Yohan Robert
21cb896802 Move SerializableResource to ActiveModelSerializers namespace
Ref. https://github.com/rails-api/active_model_serializers/pull/1310
2016-03-30 11:33:04 +02:00
Ben Mills
bfff46b66e Add output examples to Adapters docs 2016-03-17 14:07:32 -06:00
Jeffrey Wan
297e1f7e9d Update docs regarding overriding the root key 2016-03-17 10:54:22 -06:00
L. Preston Sego III
88d4fe5b5e Merge pull request #1431 from beauby/deserialization-docs
Add docs for deserialization.
2016-03-17 12:48:55 -04:00
L. Preston Sego III
586ff09cc5 Added more detailed examples to deserialization.md from json_api/deserialization.rb 2016-03-17 07:58:51 -04:00
Ben Mills
9e992358d8 Merge pull request #1574 from remear/key-casing
Provide key transformation
2016-03-15 13:42:24 -06:00
Marc Garreau
045fa9bc07 Adds polymorphic tests and documentation 2016-03-15 13:09:59 -06:00
Ben Mills
c533d1a7fe Provide key case translation 2016-03-15 12:21:10 -06:00
Krzysztof Rybka
7c3f0ec6af Remove wrong quoting in serializers guide 2016-03-14 15:00:46 +01:00
Benjamin Fleischer
b6343a5cd1 Merge pull request #1475 from bf4/rfc/template
Add an RFC template
2016-03-13 00:28:32 -06:00
Benjamin Fleischer
26b089c881 Add serialization_scope example [ci skip] 2016-03-12 19:59:43 -06:00
L. Preston Sego III
0c8abf2483 Merge pull request #1566 from remear/meta-docs
Add resource-level meta docs. Update top-level meta docs.
2016-03-11 10:13:42 -05:00
L. Preston Sego III
bbebeab348 Merge pull request #1280 from vasilakisfil/patch-1
Show how pagination can be done using meta tag from controller in JSON adapter
2016-03-10 12:53:41 -05:00
Ben Mills
4219844c12 Add resource-level meta docs. Update top-level meta docs. 2016-03-08 20:47:22 -07:00
Ben Mills
cc10928472 Provide Rails url_helpers via SerializationContext 2016-03-07 10:40:34 -07:00
Benjamin Fleischer
1a312bc2d3 Merge pull request #1545 from CodedBeardedSignedTaylor/1506-document-passing-arbitrary-options-to-serializer
[DOCS] 1506 document passing arbitrary options to serializer
2016-03-07 01:09:50 -06:00
Benjamin Fleischer
5d7a1a4889 Remove the last of ApiObjects 2016-03-06 23:24:53 -06:00
Benjamin Fleischer
e6ae34b84c Update documentation with Yard links 2016-03-06 20:05:25 -06:00
Benjamin Fleischer
3d986377b6 Collapse JSON API success/failure documents in one adapter
Idea per remear (Ben Mills) in the slack:
https://amserializers.slack.com/archives/general/p1455140474000171

remear:

    just so i understand, the adapter in `render json: resource, status: 422, adapter: 'json_api/error',
    serializer: ActiveModel::Serializer::ErrorSerializer` is a different one than, say what i’ve
    specified in a base serializer with `ActiveModel::Serializer.config.adapter = :json_api`. correct?

    and a followup question of, why not same adapter but different serializer?

me:

   With the way the code is written now, it might be possible to not require a special jsonapi adapter.
   However, the behavior is pretty different from the jsonapi adapter.

   this first draft of the PR had it automatically set the adapter if there were errors.  since that
   requires more discussion, I took a step back and made it explicit for this PR

   If I were to re-use the json api adapter and remove the error one, it think the serializable hash
   method would look like

   ```
   def serializable_hash(options = nil)
     return { errors: JsonApi::Error.collection_errors } if serializer.is_a?(ErrorsSerializer)
     return { errors: JsonApi::Error.resource_errors(serializer) } if serializer.is_a?(ErrorSerializer)
     options ||= {}
   ```

   I suppose it could be something more duckish like

   ```
   def serializable_hash(options = nil)
     if serializer.errors? # object.errors.any? || object.any? {|o| o.errors.any? }
       JsonApi::Error.new(serializer).serializable_hash
     else
       # etc
   ```
2016-03-06 12:03:17 -06:00
Benjamin Fleischer
96107c56aa Require explicit adapter/serializer to render JSON API errors
- Separate collection errors from resource errors in adapter
- Refactor to ErrorsSerializer; first-class json error methods
- DOCS
- Rails 4.0 requires assert exact exception class, boo
2016-03-06 12:03:17 -06:00
Taylor Jones
48f8a892e6 a little bit more trimming 2016-03-04 11:14:43 -05:00
Taylor Jones
60a207bb0d wrong link 2016-03-04 11:12:09 -05:00
Taylor Jones
32c6bccec7 edits and rearranging logic 2016-03-04 11:09:38 -05:00
Taylor Jones
da55cd181c addressing comments / concerns 2016-03-01 08:40:45 -05:00
Taylor Jones
e9f259697a addressing pull request comments 2016-02-29 10:56:14 -05:00
CodedBeardedSignedTaylor
6a8da1f664 adding ruby tag to code blocks 2016-02-28 22:45:45 -05:00
bobba surendranath chowdary
8b5da690fe Removes DESIGN.textile doc and update ARCHITECTURE.md
The old DESIGN.textile was removed and replace by reference to 0.8 and
0.9 READMEs within the ARCHITECTURE.md docs.
2016-02-29 04:41:47 +01:00
CodedBeardedSignedTaylor
558769981e rough draft 2016-02-28 22:41:26 -05:00
Yohan Robert
8a040052af Merge pull request #1535 from bf4/domitian-move-namespace-of-adapter-to-active-model-serializers
Moved the adapter and adapter folder to active_model_serializers folder and changed the module namespace
2016-02-28 12:58:36 +01:00
Ben Mills
5d9039e172 Adjust GitHub templates 2016-02-26 10:43:52 -07:00
Benjamin Fleischer
e35390623d Improve adapter test coverage per groyoh 2016-02-25 23:08:20 -06:00
Benjamin Fleischer
25c9df0b97 Merge branch 'master' into domitian-move-namespace-of-adapter-to-active-model-serializers
Conflicts:
	CHANGELOG.md
	lib/active_model/serializer/adapter/attributes.rb
	lib/active_model/serializer/adapter/cached_serializer.rb
	lib/active_model/serializer/adapter/fragment_cache.rb
	lib/active_model/serializer/adapter/json_api.rb
	lib/active_model/serializer/adapter/json_api/link.rb
	test/adapter/fragment_cache_test.rb
	test/adapter/json_api/links_test.rb
	test/adapter/json_api/resource_type_config_test.rb
2016-02-23 23:21:49 -06:00
bobba surendranath chowdary
252f9c4ae9 Moved the adapter and adapter folder to active_model_serializers folder and changed the module namespace
Changed the namespace in adapters and folder to active_model_serializers from active_model::serializer

Changed namespace of adapters in serializers and other folders

Moved adapter_for_test file to active_model_serializers folder and changed namespace of adapter inside the test file

Require ActiveSupport's string/inflections

We depend on string/inflections to define String#underscore.

Refactor JsonApi adapter to avoid redundant computations.

Update readme.md to link to v0.10.0.rc4

changed namespace of adapter folder testcases

Changed all namespaces of adapter under active_moder_serializers

Namespaced IncludeTree which is from serializer module, so needed to namespace it properly

Fixed wrong namsepacing of fieldset

namespace change in deserializer json_api

Fixed the namespace for collection serializer when used inside adapter, changed namespace for adapter to new namespace which I had forgotten previously

Modified logging test and adapter test cases to make the testcases pass

Changed the yardoc links,as old links are not taking to documentation pages,proper links for 0.10,0.9 and 0.8 in rubydoc

Rubocop errors are fixed by underscore naming unused variables

Moved the require of adapter to serializable resource

Remoeved adapter dependency inside serializer and added warning to Serializer::adapter method

Fixed frament cache test which is calling Serializer.adapter

Changed the name of lookup_adapter_from_config to configured_adapter

Changed the docs which will show the new namespace of adapters

Rubocop fix
2016-02-23 21:49:58 -06:00
Yohan Robert
727d7631ae Add symbol support for ActiveModel::Serializer.type method
The ActiveModel::Serializer.type method now accepts symbol as paremeter:
class AuthorSerializer < ActiveModel::Serializer
  type :profile
end
The test file for the type was also refactored.
2016-02-19 17:05:13 +01:00
Benjamin Fleischer
344d09d36e Merge pull request #1472 from edwinlunando/master
[DOC] update JSON adapter pagination links how to guide
2016-02-12 14:13:40 -06:00
Benjamin Fleischer
5b953ff40f Address concerns from #1018 commit c59668e 2016-02-08 17:55:15 -06:00
Benjamin Fleischer
c59668e7a8 Merge branch 'leandrocp-add-top-level-links'
Needs followup
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51733900
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51734779
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51735145
- https://github.com/rails-api/active_model_serializers/pull/1018#discussion_r51735218
2016-02-08 17:44:05 -06:00
bobba surendranath chowdary
68f09e59c4 Fixed a documentation error regarding adapter key constant, added tests
for SerializableResource::use_adapter?
2016-02-08 15:27:56 +05:30
Leandro Cesquini Pereira
b55fc32ba2 improve doc as suggested by @bf4 2016-02-03 10:22:17 -02:00
Leandro Cesquini Pereira
1844c162f1 Adds support for top-level links to JsonApi adapter
http://jsonapi.org/format/#document-top-level

fix failing tests

support for top-level links limited to jsonapi adapter

Move docs from README to docs/ dir

move links to json-api adapter & create Links class to hold links data
2016-02-03 10:16:22 -02:00
Peter Wagenet
efdd466147 Namespace is included in auto-registered adapters [ci skip] 2016-01-28 15:48:18 -08:00
Peter Wagenet
75fdbfa992 Adapters inherit from Adapter::Base 2016-01-28 14:27:53 -08:00
Benjamin Fleischer
7d4f47d4a2 Add an RFC template 2016-01-28 12:59:57 -06:00
Benjamin Fleischer
65093055d6 Merge pull request #1310 from maurogeorge/patch-12
RFC: Primary namespace: ActiveModel::Serializer, ActiveModel::Serializers, vs. ActiveModelSerializers
2016-01-28 12:54:52 -06:00
Edwin Lunando
2678896a9c update JSON adapter pagination links 2016-01-28 13:51:19 +07:00
Nate Sullivan
0a937a0fba Use new block-based attribute override in docs 2016-01-23 18:59:18 -08:00