JaSerializer.DSL

Summary

attributes(atts)

TODO

has_many(name, opts \\ [])

Adds a serialized relationship. By default expects to include a list of ids in the serialized resource. Include the full resource in the output by included a serializer option

has_one(name, opts \\ [])
location(path)

Defines the canoical path for retrieving this resource

serialize(type, list2)

Define a serializer. The binary argument “type” should be the plural version of the type of object being serialized

Macros

attributes(atts)

TODO

has_many(name, opts \\ [])

Adds a serialized relationship. By default expects to include a list of ids in the serialized resource. Include the full resource in the output by included a serializer option.

Override the default by defining a function of relation name with arity of 2.

Opts

  • included - Another serializer. If defined full representation is sideloaded

    (included) in the response.
  • link - Represent this resource as a link to another resource.
  • type -
has_one(name, opts \\ [])
location(path)

Defines the canoical path for retrieving this resource.

serialize(type, list2)

Define a serializer. The binary argument “type” should be the plural version of the type of object being serialized.