# `Bylaw.Ecto.Query.Issue`
[🔗](https://github.com/ryanzidago/bylaw/blob/v0.1.0-alpha.1/lib/bylaw/ecto/query/issue.ex#L1)

Describes a query validation issue found by a check.

# `format_opt`

```elixir
@type format_opt() :: {:meta, boolean()}
```

# `format_opts`

```elixir
@type format_opts() :: [format_opt()]
```

# `t`

```elixir
@type t() :: %Bylaw.Ecto.Query.Issue{
  check: module(),
  message: String.t(),
  meta: map()
}
```

# `format`

```elixir
@spec format(t()) :: String.t()
```

Formats a query issue for human-readable error output.

Metadata is omitted by default because issue messages are meant for humans and
often already contain the actionable details. Pass `meta: true` to include the
structured metadata for debugging.

## Examples

    iex> issue = %Bylaw.Ecto.Query.Issue{
    ...>   check: MyApp.RequiredOrder,
    ...>   message: "queries with limit require order_by",
    ...>   meta: %{operation: :all}
    ...> }
    iex> Bylaw.Ecto.Query.Issue.format(issue)
    "MyApp.RequiredOrder: queries with limit require order_by"

    iex> issue = %Bylaw.Ecto.Query.Issue{
    ...>   check: MyApp.RequiredOrder,
    ...>   message: "queries with limit require order_by",
    ...>   meta: %{operation: :all}
    ...> }
    iex> Bylaw.Ecto.Query.Issue.format(issue, meta: true)
    "MyApp.RequiredOrder: queries with limit require order_by %{operation: :all}"

# `format`

```elixir
@spec format(t(), format_opts()) :: String.t()
```

Formats a query issue for human-readable error output.

# `format_many`

```elixir
@spec format_many([t()]) :: String.t()
```

Formats many query issues for human-readable error output.

## Examples

    iex> issues = [
    ...>   %Bylaw.Ecto.Query.Issue{check: MyApp.RequiredOrder, message: "missing order"},
    ...>   %Bylaw.Ecto.Query.Issue{check: MyApp.EmptyInPredicates, message: "empty in predicate"}
    ...> ]
    iex> Bylaw.Ecto.Query.Issue.format_many(issues)
    "MyApp.RequiredOrder: missing order\nMyApp.EmptyInPredicates: empty in predicate"

# `format_many`

```elixir
@spec format_many([t()], format_opts()) :: String.t()
```

Formats many query issues for human-readable error output.

---

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