guardedstruct
Nested DSLs
- field
- virtual_field
- dynamic_field
- sub_field
- conditional_field
- field
- sub_field
- field
- sub_field
- field
- field
- conditional_field
- conditional_field
- sub_field
- conditional_field
- field
- sub_field
- field
- sub_field
- field
- field
- conditional_field
- conditional_field
- field
- sub_field
- field
- field
- sub_field
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | false | |
opaque | boolean | false | |
module | any | ||
error | boolean | false | |
authorized_fields | boolean | false | |
main_validator | {atom, atom} | ||
validate_derive | atom | list(atom) | ||
sanitize_derive | atom | list(atom) | ||
json | boolean | false | When true, derives a JSON encoder. Uses Jason.Encoder if :jason is in the user's deps; otherwise falls back to the built-in JSON.Encoder on Elixir 1.18+. No-op if neither is available. |
auto_wire | boolean | false | Only effective inside the GuardedStruct.AshResource extension. When true, injects GuardedStruct.AshResource.Change into the resource's top-level changes section so every :create and :update action automatically runs the GuardedStruct pipeline. Equivalent to writing changes do change GuardedStruct.AshResource.Change end by hand. No-op outside the Ash extension. |
guardedstruct.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.virtual_field
virtual_field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
hint | String.t |
guardedstruct.dynamic_field
dynamic_field nameArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
type | any | {:map, [], []} | |
enforce | boolean | ||
default | any | {:%{}, [], []} | |
derives | String.t | "validate(map)" | |
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
hint | String.t |
guardedstruct.sub_field
sub_field name, typeNested DSLs
- conditional_field
- field
- sub_field
- field
- sub_field
- field
- field
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.sub_field.conditional_field
conditional_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.sub_field.conditional_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.sub_field.conditional_field.sub_field
sub_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.sub_field.conditional_field.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.sub_field.sub_field
sub_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.sub_field.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field
conditional_field name, typeNested DSLs
- sub_field
- conditional_field
- field
- sub_field
- field
- sub_field
- field
- field
- conditional_field
- conditional_field
- field
- sub_field
- field
- field
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.sub_field
sub_field name, typeNested DSLs
- conditional_field
- field
- sub_field
- field
- sub_field
- field
- field
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.conditional_field.sub_field.conditional_field
conditional_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.sub_field.conditional_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.sub_field.conditional_field.sub_field
sub_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.conditional_field.sub_field.conditional_field.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.sub_field.sub_field
sub_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.conditional_field.sub_field.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.conditional_field
conditional_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.conditional_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.conditional_field.sub_field
sub_field name, typeNested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean | ||
error | boolean | ||
authorized_fields | boolean | ||
main_validator | {atom, atom} |
guardedstruct.conditional_field.conditional_field.sub_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |
guardedstruct.conditional_field.field
field name, typeArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | any | ||
type | any |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
enforce | boolean | ||
default | any | ||
derives | String.t | ||
derive | String.t | ||
validator | {atom, atom} | ||
auto | {atom, atom} | {atom, atom, any} | ||
from | String.t | ||
on | String.t | ||
domain | String.t | ||
struct | atom | ||
structs | atom | boolean | ||
hint | String.t | ||
priority | boolean |