# Ostara

[![Contributor Covenant](][Contributor Covenant]

Transforms [Ecto] schema modules into [JSON Schema] structures.

<img alt="Ostara by Johannes Gehrts" width="300" src="">

[Ostara _(1901) by Johannes Gehrts_][art]

**Note:** Ostara is under active development and does not yet support all features of Ecto or the full JSON Schema specification. Contributions are welcome!

## Example

Given the following schema module:

defmodule Product do
  @moduledoc "A product from Acme's catalog",
  use Ecto.Schema

  @primary_key false

  embedded_schema do
    field :product_name, :string
    field :price, :float

  def changeset(data, params) do
    |> cast(params, [:product_name, :price])
    |> validate_required([:product_name])
    |> validate_number(:price, greater_than: 0)

Ostara will produce the following data:

  "$schema" => "",
  "title" => "Product",
  "type" => "object",
  "description" => "A product from Acme's catalog",
  "properties" => %{
    "productName" => %{
      "type" => "string"
    "price" => %{
      "type" => "number",
      "exclusiveMinimum" => 0
  "required" => ["productName"]

## Installation

Ostara is [available in Hex] and can beinstalled by adding `ostara` to your list of dependencies in `mix.exs`:

def deps do
    {:ostara, "~> 0.1.0"}

## License

Ostara source code is released under Apache License 2.0. See
[LICENSE][LICENSE] for more information.

[Contributor Covenant]:
[JSON Schema]:
[available in Hex]: