- Adds support for default values (martinthenth#120 - by laraujo7)
- Fixes a bug when using
{:array, :map}
with rules where the rules are ignored (martinthenth#115)
- Fixes a regression where
:map
without rules returns an empty map instead of the user's input (martinthenth#112)
- Adds support for enum arrays (martinthenth#107 - by @davorbadrov)
- Fixes a compatibility issue introduced with Ecto 3.12 (martinthenth#103 - by @deolivtiago)
- Export formatting rules for macros without parens (martinthenth#99 - by @nelsonmestevao)
- Graduates the library to version 1.0.0 🎉
- Adds support for passing attribute tags to the schema
- Removes the custom types inside the macro because they can conflict with user-defined types
- Adds benchmarks script and results to the documentation
Migration instructions:
- If you used Goal's types that were included in the macro: a. Replace those types with your own types b. The compiler will let you know if there are were any references
- Fixes a bug with validations for negative numbers (martinthenth#88 - by @Joraeuw)
- Adds support for custom regexes via the application config (martinthenth#84 - by @lucca65)
- Adds support for recasing inbound keys in
changeset/3
- Adds support for validation on array items (martinthenth#50 - by @LukasKnuth)
- Adds support for Regex validation in
defparams
(martinthenth#53 - by @LukasKnuth) - Adds the
:any
field type indefparams
, enabling presence checks without validation - Fixes a bug with optional arrays of maps
- Removes
defschema
in favor ofdefparams
Migration instructions:
- Replace
defschema
withdefparams
definitions
- Fixes a bug with recasing inbound keys when an empty map is given as parameter
- Fixes a bug with
recase_keys: [from: :camel_case]
where empty values were ignored
- Adds
recase_keys/2
for recasing outbound keys - Adds optional
:to_case
option to:recase_keys
global configuration - Adds fallback to non-recased parameters when recasing inbound parameters
- Fixes a bug in
recase_keys/4
when it receives a value that isn't a map or list of maps
- Adds
recase_keys/3
to recase parameter keys fromcamelCase
,snake_case
,PascalCase
orkebab-case
- Adds optional
:recase_keys
configuration tovalidate/3
andvalidate_params/3
- Adds optional
:recase_keys
global configuration
- Adds new macros
defparams/1
anddefparams/2
- Adds
changeset/1
andchangeset/2
to build changesets from schemas defined withdefparams/2
. - Adds
validate/1
andvalidate/2
to validate changesets built from schemas defined withdefparams/2
. - Adds
action: :validate
in returned changesets - Switches the order of arguments in
validate_params/2
- Switches the order of arguments in
build_changeset/2
Migration instructions:
- Replace
import Goal.Syntax
withimport Goal
- Switch the arguments for
validate_params/2
fromvalidate_params(data, schema)
tovalidate_params(schema, data)
- Switch the arguments for
build_changeset/2
frombuild_changeset(data, schema)
tobuild_changeset(schema, data)
See the docs for more information on the new defparams
macro.
- Exposes
build_changeset/2
in the main namespace (Goal
) - Updates documentation for use with LiveViews
- Adds
:uuid
type - Improves password regex to allow non-alphanumeric characters
- Allow number validations for all number fields (incl.
:decimal
,:float
) - Adds performance optimizations to the validation logic
- Adds tests to confirm
traverse_errors/2
doesn't break embedded Ecto schemas - Refactors the validation logic
- Updates documentation
- Adds
defschema
macro for defining validation schemas with less boilerplate
- Initial release