Changelog
View SourceAll notable changes to this project will be documented in this file.
0.7.1 - 2025-10-12
Added
Zoi.to_json_schema/1support for metadata (e.g., example, description)guides/quickstart_guide.mdadded to the documentation
0.7.0 - 2025-10-10
Added
Zoi.to_json_schema/1function to convertZoischemas to JSON Schema format
Changed
Zoi.array/2fixed path in errors when parsing arraysZoi.regex/2fixed regex compile errors when used in module attributes
0.6.6 - 2025-10-08
Added
Zoi.metadata/1- option to add metadata to types for documentation purposes
Changed
Zoi.example/1deprecated in favor ofZoi.metadata/1
0.6.5 - 2025-10-07
Added
Zoi.example/1option to add example values to types for documentation and testing purposes
0.6.4 - 2025-09-30
Added
Zoi.downcase/1refinement to validate if a string is in lowercaseZoi.upcase/1refinement to validate if a string is in uppercaseZoi.hex/1refinement to validate if a string is a valid hexadecimal
0.6.3 - 2025-09-27
Added
keysinZoi.object/2data structureZoi.struct/2type to parse structs and maps into structsZoi.Structmodule with helper functions to work with structs. This module offers two main functions:Zoi.Struct.enforce_keys/1: List of keys that must be present in the structZoi.Struct.struct_keys/1: List of keys and their default values to be used withdefstruct
0.6.2 - 2025-09-26
Added
Zoi.literal/2type to accept only a specific literal value
Changed
- Refactor all errors to be generated on type creation instead of parsing time
0.6.1 - 2025-09-08
Added
Zoi.null/1type to accept onlynilvaluesZoi.positive/1refinement for numbers to accept only positive valuesZoi.negative/1refinement for numbers to accept only negative values
0.6.0 - 2025-09-07
Added
Zoi.required/2type to enforce presence of a value inkeywordandobjecttypes
Changed
Zoi.object/2now usesmfato call innertransformfunctionZoi.keyword/2have all fields set as optional by default, useZoi.required/2to enforce presence of a value
0.5.7 - 2025-09-06
Changed
Zoi.parse!/3Error message
0.5.6 - 2025-09-05
Added
Zoi.parse!/3function that raises an error if parsing failsZoi.type_spec/2function that returns the Elixir type spec for a given Zoi schema, implemented for all types
0.5.5 - 2025-09-03
Added
Zoi.keyword/2type
Changed
Zoi.struct/2now works with the newZoi.keyword/2type- Improved
Zoi.transform/2documentation
0.5.4 - 2025-08-29
Added
- Guide for converting keys from maps
- Guide for generating schema from JSON structure
0.5.3 - 2025-08-29
Changed
- Fix
transformandrefinementtypes
0.5.2 - 2025-08-28
Added
Zoi.prettify_errors/2added docsZoi.extend/3type
Changed
Zoi.map/3now parses key and value types correctly- Fix encapsulated types ignoring refinements and transforms when parsing
0.5.1 - 2025-08-17
Changed
Zoi.prettify_errors/1don't return\nat the end of the string anymore
0.5.0 - 2025-08-17
Added
Zoi.atom/1typeZoi.string_boolean/1typeZoi.union/2custom error messagesZoi.intersection/2custom error messagesZoi.to_struct/2transform
Changed
Zoi.boolean/1does not coerce values besides "true" and "false" anymore. For coercion of other values, useZoi.string_boolean/1type.
0.4.0 - 2025-08-14
Added
Zoi.Contextmodule to provide context when parsing data
Changed
Zoi.object/2will not automatically parse objects with inputs that differ from the string/atom keys map format. For example:
schema = Zoi.object(%{
name: Zoi.string(),
age: Zoi.integer()
})
Zoi.object(schema, %{"name" => "John", "age" => 30})
{:error, _errors}To make this API work, you can pass coerce: true option to Zoi.object/2. This will make the object parser to check from the Map input if the keys are strings or atoms and fetch it's values automatically.
schema = Zoi.object(%{
name: Zoi.string(),
age: Zoi.integer()
})
Zoi.object(schema, %{"name" => "John", "age" => 30}, coerce: true)
{:ok, %{name: "John", age: 30}}0.3.4 - 2025-08-09
Added
Zoi.min/2,Zoi.max/2,Zoi.gt/2,Zoi.gte/2,Zoi.lt/2,Zoi.lte/2refinements forZoi.time/1typeZoi.min/2,Zoi.max/2,Zoi.gt/2,Zoi.gte/2,Zoi.lt/2,Zoi.lte/2refinements forZoi.date/1typeZoi.min/2,Zoi.max/2,Zoi.gt/2,Zoi.gte/2,Zoi.lt/2,Zoi.lte/2refinements forZoi.datetime/1typeZoi.min/2,Zoi.max/2,Zoi.gt/2,Zoi.gte/2,Zoi.lt/2,Zoi.lte/2refinements forZoi.naive_datetime/1type
0.3.3 - 2025-08-09
Added
Zoi.time/1typeZoi.date/1typeZoi.datetime/1typeZoi.naive_datetime/1type
0.3.2 - 2025-08-09
Added
Zoi.decimal/1typeZoi.min/2,Zoi.max/2,Zoi.gt/2,Zoi.gte/2,Zoi.lt/2,Zoi.lte/2refinements forZoi.decimal/1type
0.3.1 - 2025-08-08
Added
Zoi.ISO.time/1typeZoi.ISO.date/1typeZoi.ISO.datetime/1typeZoi.ISO.to_time_struct/1transformZoi.ISO.to_date_struct/1transformZoi.ISO.to_datetime_struct/1transformZoi.ISO.to_naive_datetime/1transformZoi.prettify_errors/1function to format errors in a human-readable way
0.3.0 - 2025-08-07
Added
Zoi.email/0formatZoi.url/0formatZoi.uuid/1format
Changed
- Removed
Zoi.email/1, now useZoi.email/0that will automatically use theZoi.string/1type - All refinements now accept a
:messageoption to customize the error message
0.2.3 - 2025-08-06
Added
Zoi.map/3typeZoi.intersection/2typeZoi.gt/2refinementZoi.gte/2refinementZoi.lt/2refinementZoi.lte/2refinement
0.2.2 - 2025-08-06
Added
- Guides for using
Zoiin Phoenix controllers - New
Zoi.tuple/2type - New
Zoi.any/1type - New
Zoi.nullable/2type
Changed
- Improved error messages for all validations and types
Zoi.treefy_errors/1now returns a more human-readable structureZoi.optional/2cannot acceptnilas a value anymore. UseZoi.nullable/2instead.Zoi.optional/2insideZoi.object/2now handles optional fields correctly
0.2.1 - 2025-08-06
Added
- Custom error messages for primitive types
Changed
Zoi.number/2now returns proper error message
0.2.0 - 2025-08-05
Added
mfatoZoi.refine/2andZoi.transform/2functions- accumulator errors to
Zoi.refine/2andZoi.transform/2functions Zoi.array/2typeZoi.length/2,Zoi.min/2andZoi.max/2validators for arrays
Changed
- errors are now returned as a list of
%Zoi.Error{}structs