Mentor.Ecto.Type behaviour (mentor v0.2.2)

View Source

Mentor.Ecto.Type is a behaviour that lets your implement your own custom Ecto.Type that works natively with Instructor.

Example

defmodule MyCustomType do
  use Ecto.Type
  use Mentor.Ecto.Type

  # ... See `Ecto.Type` for implementation details

  def to_json_schema do
    %{
      type: "string",
      format: "email"
    }
  end
end

Summary

Callbacks

to_json_schema()

@callback to_json_schema() :: map()