Skip to content

JsonApi::Deserialization YARD docs are misleading #2384

@wasabigeek

Description

@wasabigeek

Expected behavior vs actual behavior

In the YARD docs the example suggests that using a symbol-keyed hash will work:

# document = {
# data: {
# id: 1,
# type: 'post',
# attributes: {
# title: 'Title 1',
# date: '2015-12-20'
# },
# associations: {
# author: {
# data: {
# type: 'user',
# id: 2
# }
# },
# second_author: {
# data: nil
# },
# comments: {
# data: [{
# type: 'comment',
# id: 3
# },{
# type: 'comment',
# id: 4
# }]
# }
# }
# }
# }

(Edited)

But in the code, it will actually check via string-keys:
https://github.com/rails-api/active_model_serializers/blob/v0.10.10/lib/active_model_serializers/adapter/json_api/deserialization.rb#L118

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions