class ActiveModelSerializers::Adapter::JsonApi

def relationships_for(serializer, requested_associations)

}.reject! {|_,v| v.nil? }
meta: meta
id: 'required-id',
type: 'required-type',
{
structure:
The "type" and "id" to non-empty members.
description:

meta
id (required) : String
type (required) : String
definition:
linkage

[ ] https://github.com/rails-api/active_model_serializers/pull/1282
polymorphic
prs:
]
linkage
linkage,
[
structure:
An array of objects each containing "type" and "id" members for to-many relationships
description:

array of unique items of type 'linkage'
definition:
relationshipToMany

end
nil
else
linkage
if has_related?
structure:
None: Describes an empty to-one relationship.

specified by including a member in a resource's links object.
References to other resource objects in a to-one ("relationship"). Relationships can be

description:
relationshipToOne

linkage
null
anyOf
definition:

end
relationshipToMany
else
relationshipToOne
if has_one?
structure:
Member, whose value represents "resource linkage"
description:

relationshipToMany
relationshipToOne
oneOf
definition:
relationshipsData

[ ] https://github.com/rails-api/active_model_serializers/pull/1420
polymorphic
[x] https://github.com/rails-api/active_model_serializers/pull/1454
meta
[x] https://github.com/rails-api/active_model_serializers/pull/1454
links
prs:

}.reject! {|_,v| v.nil? }
data: relationshipsData
meta: meta,
links: links,
{
structure:
resource object in which it's defined to other resource objects."
Members of the relationships object ("relationships") represent references from the

description:

meta
links
data : relationshipsData
properties:

^\\w[-\\w_]*$"
patternProperties:

JSON Object
definition:
relationships
{http://jsonapi.org/format/#document-resource-object-relationships Document Resource Object Relationship}
def relationships_for(serializer, requested_associations)
  include_directive = JSONAPI::IncludeDirective.new(
    requested_associations,
    allow_wildcard: true
  )
  serializer.associations(include_directive).each_with_object({}) do |association, hash|
    hash[association.key] = Relationship.new(
      serializer,
      association.serializer,
      instance_options,
      options: association.options,
      links: association.links,
      meta: association.meta
    ).as_json
  end
end