View Source Changelog
0.17.5 - 2025/01/11
- Fix warnings by conditionally compiling Decimal support.
0.17.4 - 2024/07/04
- Mark
Decimaldep as optional again.
0.17.3 - 2024/07/03
- Fix typo in doc for
Xema.from_json_schema/2. - Fix spec for opts in
Xema.JsonSchema. - Remove all entries in
.dialyzer_ignore.exs. - Update test scripts to remove warnings when running with Elixir 1.17.
0.17.2 - 2024/05/17
0.17.1 - 2023/07/28
- Fix the ref inliner.
0.17.0 - 2022/09/19
- Require Elixir 1.8.0
- Update inspect implementations for
Xema.RefandXema.Schema.
0.16.1 - 2022/07/06
- Add implementation to cast maps with integer keys to lists. Thanks to @egze.
0.16.0 - 2022/05/11
Deprecated
@default trueto mark a schema as default. To set a default add the option:defaulttouse Xema.Example:
defmoudle MyApp.Schemas do use Xema, multi: true, default: :s1 xema :s1 do ... end xema :s2 do ... end endFix
$refapplicator to accept none-keywords in the path.
0.15.0 - 2022/01/09
Deprecate macro
Xema.Builder.xema/1in combination withXema.Builder.field/3. UseXema.Builde.xema_struct/1instead.This change makes it clearer in which case a struct is created. The functionality of
Xema.Builder.xema/1andXema.Builder.xema/2to create simple schemas stays the same.Example:
before 0.15.0:
defmoudle MyApp.User do use Xema xema do field :name, :string end endsince 0.15.0:
defmoudle MyApp.User do use Xema xema_struct do field :name, :string end end
0.14.3 - 2021/12/19
Xeam.from_json_schema/2sets nowkeys: :stringsfor any{"type": "object"}
0.14.2 - 2021/10/09
- Fix casting to struct.
0.14.1 - 2021/10/01
- Fix casting to
structwith required properties.
0.14.0 - 2021/08/07
Breaking changes
Refactoring the cast functionality with the combining operators
:any_ofand:one_of. Before 0.14.0Xematries to cast as many values from a data structure according to all sub-schemas as possible.Before 0.14.0
Xematries to cast as many values from a data structure according to all sub-schemas as possible. For this, any casting result in:any_ofandone_ofwas the input for the next casting. The new version takes the first valid cast as a result of the whole combining operator.
0.13.10 - 2021/06/05
- Fix: Add types with option
:allow.
0.13.9 - 2021/06/01
- Fix: Cast to boolean not working as expected.
0.13.8 - 2021/05/01
- Use the
:defaultoption to setdefstructdefault. Thanks to @garret-smith.
0.13.7 - 2021/03/14
- Fix inlining
0.13.6 - 2020/12/23
- Add
.formatter.exto package
0.13.5 - 2020/10/26
0.13.4 - 2020/10/14
- Updating
decimaldependency.
0.13.3 - 2020/10/12
- Relaxing format validation for URIs.
- Fixing keyword
:items.
0.13.2 - 2020/10/06
- Fixing docs for
Xema.Builder.strux/1. - Updating deps.
- Fixing tests.
0.13.1 - 2020/09/09
- Fixing minor issues.
0.13.0 - 2020/09/07
- Adding option
:failtoXema.validate/3. See also "Validate with option:fail"
0.12.0 - 2020/08/26
- Refactoring of the properties validation.
Breaking changes
- The error data structure for
listitemshas changed from alistoftuples to amap. This change allows you to convertreasondirectly to JSON.
since 0.12.0:
iex> schema = Xema.new({:list, items: :integer})
iex> Xema.validate(schema, [1, "foo", 2, :bar])
{:error,
%Xema.ValidationError{
message: nil,
reason: %{
items: %{
1 => %{type: :integer, value: "foo"},
3 => %{type: :integer, value: :bar}
}
}
}}before 0.12.0:
iex> schema = Xema.new({:list, items: :integer})
iex> Xema.validate(schema, [1, "foo", 2, :bar])
{:error,
%Xema.ValidationError{
message: nil,
reason: %{
items: [
{1, %{type: :integer, value: "foo"}},
{3, %{type: :integer, value: :bar}}
]
}
}}0.11.4 - 2020/08/19
- Fix an issue with circular references.
0.11.3 - 2020/08/18
- Fix an issue with circular references.
0.11.2 - 2020/07/31
- Fix a bug when
unique_itemsis explicit set tofalse.
0.11.1 - 2020/07/17
- Fix hostname format validation. Thanks to @romul.
0.11.0 - 2019/10/19
- Add
Xema.from_json_schema.
0.10.0 - 2019/09/8
- Refactor
Xema.castwith an improvement of the error messages. - Add macro
fieldandrequiredfor struct schemas.
0.9.3 - 2019/08/25
- Fix specs.
0.9.2 - 2019/08/21
- Update specs.
0.9.1 - 2019/06/16
- Silence warnings for
Decimal.
0.9.0 - 2019/06/16
New features
- Add
Xema.cast/2.
Breaking changes
- Add option
multito use multiple schema modules:use Xema, multi: true. - Remove
xema/2macro. - Add
xema/0andxema/1macro. - Change return value of
Xema.validate/2to{:error, Exception.t}in case of error. - Update
Xema.ValidationError.ValidationError.reasoncontains the error map of the previous versions with some changes.ValidationError.messagecontains an error message.
Bugfixes
- Fixes in
Xema.Validator. In some cases the validatorsany_of,one_of,all_of,enum,not,const, andif-then-elsewas be ignored.
O.8.1 - 2019/06/02
- Fix email format checker.
0.8.0 - 2019/03/10
- Inline references in schemas by default. Increased performance of reference handling by 30%.
- Rename
defxematoxemaand refactor macros. - Add custom
validator. - Add examples page.
- Add
@default true.
0.7.0 - 2019/02/10
- Increase
refperformance. - Fix option
:resolverinXema.new/2. - Refactor
refhandling, - Rename
resolvertoloader. - Remove deprecated function
Xema.is_valid/2. - Reduce public API docs.
- Add
Xema.Builderanduse Xema.
0.6.3 - 2019/01/15
- Ignore unknown formatters.
0.6.2 - 2019/01/13
- Change regex for email validation (~7x faster).
- Add
:resolveroption toXema.new. - Speed up string validator.
0.6.1 - 2019/01/06
Update docs.
0.6.0 - 2018/12/29
- Fixed and updated some specs.
- Remote check for references is moved to the
behaviour. - Key types in the schema are now matters for validation. See Usage - Key types
0.5.0 - 2018/12/25
- The function
Xema.is_valid?/2is deprecated. UseXema.valid?/2instead. - Add keyword
const. - Add keywords
if,then,else. - Add handling for none-keyword data.
- Add annotation keywords
examplescommentcontentEncodingcontentMediaTypecontentMediaType
- Add new
formatchecks. - Add validatiors for
atom,keyword,tupleandstruct - Add schema validator to validate data give to
Xema.new/1. Xema.new/2becomesXema.new/1. Migrate to 0.5.0:# < 0.5.0 Xema.new(:integer, minimum: 0) # >= 0.5.0 Xema.new({:integer, minimum: 0})- Add Xema.validate!/2