ExParamsSchema.Schema.Options (ex_params_schema v0.1.1)

Copy Markdown View Source

Manages default values and normalization rules for schema-level options.

This internal module is shared by use ExParamsSchema, defschema, and map-form schema definitions.

Summary

Functions

Validates options and normalizes them to the internal representation with defaults applied.

Types

t()

@type t() :: %ExParamsSchema.Schema.Options{strict: boolean()}

Functions

normalize!(options, function_name, defaults \\ %__MODULE__{})

@spec normalize!(keyword(), String.t(), t()) :: t()

Validates options and normalizes them to the internal representation with defaults applied.

iex> ExParamsSchema.Schema.Options.normalize!([strict: true], "schema")
%ExParamsSchema.Schema.Options{strict: true}

iex> ExParamsSchema.Schema.Options.normalize!(
...>   [],
...>   "schema",
...>   %ExParamsSchema.Schema.Options{strict: true}
...> )
%ExParamsSchema.Schema.Options{strict: true}