View Source Franklin.ValidationErrorMap (Franklin v0.1.0)

Link to this section Summary

Functions

Given an Ecto.Changeset, returns a Franklin.ValidationErrorMap expressing the errors in a more accessible format.

Link to this section Types

@type t() :: %{required(atom()) => [String.t()]}

Link to this section Functions

@spec new(Ecto.Changeset.t()) :: t()

Given an Ecto.Changeset, returns a Franklin.ValidationErrorMap expressing the errors in a more accessible format.

example

Example:

iex> new(changeset)
%{
  id: ["is invalid"],
  published_at: ["can't be blank"],
  title: ["should be at least 3 character(s)"]
}