Packages
xema
0.17.3
0.17.9
0.17.8
0.17.7
0.17.6
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.1
0.16.0
0.15.0
0.14.3
0.14.2
0.14.1
0.14.0
0.13.10
0.13.9
0.13.8
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.1
0.13.0
0.12.0
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.0
0.9.3
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.1
A schema validator inspired by JSON Schema.
Current section
Files
Jump to
Current section
Files
README.md
# Xema
[](https://hex.pm/packages/xema)
[](https://github.com/hrzndhrn/xema/actions)
[](https://coveralls.io/github/hrzndhrn/xema)
[](https://github.com/hrzndhrn/xema/blob/main/LICENSE.md)
Xema is a schema validator inspired by [JSON Schema](http://json-schema.org).
For now, Xema supports the features documented in draft 04, 06, and 07 of the
JSON-Schema specification.
Xema allows you to annotate and validate Elixir data structures.
If you search for a real JSON Schema validator give
[JsonXema](https://github.com/hrzndhrn/json_xema) a try.
Xema is in beta. If you try it and has an issue, report them.
## Installation
First, add `:xema` to your `mix.exs` dependencies:
```elixir
def deps do
[{:xema, "~> 0.14"}]
end
```
Then, update your dependencies:
```shell
$ mix deps.get
```
## Docs
The docs contains a [Usage](https://hexdocs.pm/xema/usage.html) page with a
short and compact description to use `Xema`.
Documentation can be generated with
[ExDoc](https://github.com/elixir-lang/ex_doc) by running `mix docs`. The
generated docs can be found at
[https://hexdocs.pm/xema](https://hexdocs.pm/xema).
## Tests
The test in the directory `xema/test/json_schema_test_suite` are generated from the
[JSON-Schema-Test-Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite).
The test suite can be generated with `mix gen.test_suite`. The mix task expected
the suite in the root directory in the folder `JSON-Schema-Test-Suite`.
## References
The home of JSON Schema: http://json-schema.org/
Specification:
* Draft-04
* [JSON Schema core](http://json-schema.org/draft-04/json-schema-core.html)
defines the basic foundation of JSON Schema
* [JSON Schema Validation](http://json-schema.org/draft-04/json-schema-validation.html)
defines the validation keywords of JSON Schema
* Draft-06
* [JSON Schema core](http://json-schema.org/draft-06/json-schema-core.html)
* [JSON Schema Validation](http://json-schema.org/draft-06/json-schema-validation.html)
* [JSON Schema Release Notes](http://json-schema.org/draft-06/json-schema-release-notes.html)
contains informations to migrate schemas.
* Draft-07
* [JSON Schema core](http://json-schema.org/draft-07/json-schema-core.html)
* [JSON Schema Validation](http://json-schema.org/draft-07/json-schema-validation.html)
* [JSON Schema Release Notes](http://json-schema.org/draft-07/json-schema-release-notes.html)
[Understanding JSON Schema](https://spacetelescope.github.io/understanding-json-schema/index.html)
a great tutorial for JSON Schema authors and a template for the description of
Xema.