Changelog

View Source

All notable changes to this project will be documented in this file.

0.7.1 - 2025-10-12

Added

  • Zoi.to_json_schema/1 support for metadata (e.g., example, description)
  • guides/quickstart_guide.md added to the documentation

0.7.0 - 2025-10-10

Added

Changed

  • Zoi.array/2 fixed path in errors when parsing arrays
  • Zoi.regex/2 fixed 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

0.6.5 - 2025-10-07

Added

  • Zoi.example/1 option to add example values to types for documentation and testing purposes

0.6.4 - 2025-09-30

Added

  • Zoi.downcase/1 refinement to validate if a string is in lowercase
  • Zoi.upcase/1 refinement to validate if a string is in uppercase
  • Zoi.hex/1 refinement to validate if a string is a valid hexadecimal

0.6.3 - 2025-09-27

Added

  • keys in Zoi.object/2 data structure
  • Zoi.struct/2 type to parse structs and maps into structs
  • Zoi.Struct module 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 struct
    • Zoi.Struct.struct_keys/1: List of keys and their default values to be used with defstruct

0.6.2 - 2025-09-26

Added

Changed

  • Refactor all errors to be generated on type creation instead of parsing time

0.6.1 - 2025-09-08

Added

0.6.0 - 2025-09-07

Added

  • Zoi.required/2 type to enforce presence of a value in keyword and object types

Changed

  • Zoi.object/2 now uses mfa to call inner transform function
  • Zoi.keyword/2 have all fields set as optional by default, use Zoi.required/2 to enforce presence of a value

0.5.7 - 2025-09-06

Changed

0.5.6 - 2025-09-05

Added

  • Zoi.parse!/3 function that raises an error if parsing fails
  • Zoi.type_spec/2 function that returns the Elixir type spec for a given Zoi schema, implemented for all types

0.5.5 - 2025-09-03

Added

Changed

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 transform and refinement types

0.5.2 - 2025-08-28

Added

Changed

  • Zoi.map/3 now parses key and value types correctly
  • Fix encapsulated types ignoring refinements and transforms when parsing

0.5.1 - 2025-08-17

Changed

0.5.0 - 2025-08-17

Added

Changed

0.4.0 - 2025-08-14

Added

  • Zoi.Context module to provide context when parsing data

Changed

  • Zoi.object/2 will 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

0.3.3 - 2025-08-09

Added

0.3.2 - 2025-08-09

Added

0.3.1 - 2025-08-08

Added

0.3.0 - 2025-08-07

Added

Changed

  • Removed Zoi.email/1, now use Zoi.email/0 that will automatically use the Zoi.string/1 type
  • All refinements now accept a :message option to customize the error message

0.2.3 - 2025-08-06

Added

0.2.2 - 2025-08-06

Added

Changed

  • Improved error messages for all validations and types
  • Zoi.treefy_errors/1 now returns a more human-readable structure
  • Zoi.optional/2 cannot accept nil as a value anymore. Use Zoi.nullable/2 instead.
  • Zoi.optional/2 inside Zoi.object/2 now handles optional fields correctly

0.2.1 - 2025-08-06

Added

  • Custom error messages for primitive types

Changed

  • Zoi.number/2 now returns proper error message

0.2.0 - 2025-08-05

Added

Changed

  • errors are now returned as a list of %Zoi.Error{} structs