ja_serializer v0.15.0 JaSerializer.EctoErrorSerializer View Source

The EctoErrorSerializer is used to transform Ecto changeset errors to JSON API standard error objects.

If a changeset is past in without optional error members then the object returned will only contain: source, title, and detail.

%{"errors" => [
   %{
     source: %{pointer: "/data/attributes/monies"},
     title: "must be more than 10",
     detail: "Monies must be more than 10"
    }
  ]
}

Additional error members can be set by passing in an options list. These include: id, status, code, meta, and links.

For more information on the JSON API standard for handling error objects check_origin: jsonapi.org

Link to this section Summary

Link to this section Functions