View Source Instructor.EctoType behaviour (Instructor v0.0.5)

Instructor.EctoType 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 Instructor.EctoType

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

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

Summary

Callbacks

@callback to_json_schema() :: map()