Skip to content

Receiving a PATCH with an Array inside the "data"-key should be valid #1925

Open
@ddefrenne

Description

@ddefrenne

Expected behavior vs actual behavior

  • Expected: Receiving a PATCH with an Array inside the "data"-key is valid, according to http://jsonapi.org/format/#crud-updating-relationships
  • Actual: It throws an error ActiveModelSerializers::Adapter::JsonApi::Deserialization::InvalidDocument: Invalid payload ({:data => "Expected Hash"})

Steps to reproduce

PATCH to /articles/1/relationships/comments with

{
  "data": [
    { "type": "comments", "id": "2" },
    { "type": "comments", "id": "3" }
  ]
}

Environment

ActiveModelSerializers Version (commit ref if not on tag): 0.10.2

Output of ruby -e "puts RUBY_DESCRIPTION": ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

OS Type & Version: Mac OS X 10.11.6

Integrated application and version (e.g., Rails, Grape, etc): Rails 4.2.7.1

Backtrace

(e.g., provide any applicable backtraces from your application)

Additonal helpful information

(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions