# `JSONCodec.Schema`
[🔗](https://github.com/dannote/json_codec/blob/main/lib/json_codec/schema.ex#L1)

Behaviour for modules that provide their own JSON Schema.

Every `JSONCodec` module implements it. Other modules implement it to give
codec fields that reference them a schema:

    defmodule Money do
      @behaviour JSONCodec.Schema

      @impl true
      def schema, do: %{"type" => "string", "pattern" => "^\\d+\\.\\d{2}$"}
    end

Referenced modules that implement neither get an empty schema.

# `schema`

```elixir
@callback schema() :: map()
```

Returns a JSON Schema-compatible map describing this module's JSON form.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
