# `Scrypath.QueryParams`
[🔗](https://github.com/szTheory/scrypath/blob/v0.3.7/lib/scrypath/query_params.ex#L1)

Public request-edge toolkit for turning top-level request params into one stable
plain-data Scrypath search-args shape.

`%Scrypath.Query{}` remains **internal normalized query state** owned by the common
`Scrypath.search/3` runtime. Host applications should use this module when they want a
framework-light contract that can be cast from request params and then converted into
`{text, keyword_opts}` for a context-owned `Scrypath.search/3` call.

Use `normalize/1` at the request edge when handling Plug-decoded browser params.
It returns either `{:ok, query_params}` or `{:error, error_map}` for owned Scrypath
namespaces. `cast/1` remains available for already-runtime-compatible nested values.

This module is data-only: it does not validate schema-specific search semantics and it
does not execute searches.

# `normalize_error_map`

```elixir
@type normalize_error_map() :: %{
  form_errors: [Scrypath.QueryParams.Error.t()],
  field_errors: %{optional(atom()) =&gt; [Scrypath.QueryParams.Error.t()]},
  errors: [Scrypath.QueryParams.Error.t()]
}
```

# `t`

```elixir
@type t() :: %{
  text: String.t(),
  filter: keyword(),
  sort: keyword(),
  page: keyword(),
  facets: [atom()],
  facet_filter: keyword(),
  per_query: map()
}
```

Stable public plain-data contract for `Scrypath.search/3` args.

# `cast`

```elixir
@spec cast(map()) :: t()
```

Casts string-keyed or atom-keyed top-level request input into the public Scrypath
query-param contract.

# `normalize`

```elixir
@spec normalize(map()) :: {:ok, t()} | {:error, normalize_error_map()}
```

Normalizes Plug-decoded request params into the public Scrypath query-param contract.

Unknown top-level params are ignored, while malformed values inside owned namespaces
return aggregate structured issues.

# `to_search_args`

```elixir
@spec to_search_args(t()) :: {String.t(), keyword()}
```

Converts the public plain-data contract into `{text, keyword_opts}` for a context-owned
`Scrypath.search/3` call.

---

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