Elixir wrapper for the erldantic library, providing type-safe JSON serialization, deserialization, JSON schema generation, and OpenAPI specification generation for Elixir applications.
- Type-safe JSON conversion - Convert Elixir terms to/from JSON with validation
- JSON Schema generation - Generate JSON Schema specifications from type definitions
- OpenAPI specification - Create OpenAPI 3.0 specifications for REST APIs
- Detailed error reporting - Get precise error messages with location information
Add exdantic to your list of dependencies in mix.exs:
def deps do
[
{:exdantic, git: "https://github.com/andreashasse/exdantic.git"}
]
end# Convert Elixir term to JSON
{:ok, json} = Exdantic.JSON.to_json(MyModule, :user_type, user_data)
# Convert JSON to Elixir term
{:ok, user} = Exdantic.JSON.from_json(MyModule, :user_type, json_data){:ok, schema} = Exdantic.JSONSchema.generate_schema(MyModule, :user_type){:ok, spec} = Exdantic.OpenAPI.generate_spec(MyModule)The main Exdantic module provides delegated functions for easy access:
{:ok, json} = Exdantic.to_json(MyModule, :user_type, user_data)
{:ok, user} = Exdantic.from_json(MyModule, :user_type, json_data)
{:ok, schema} = Exdantic.generate_schema(MyModule, :user_type)
{:ok, spec} = Exdantic.generate_spec(MyModule)Exdantic.JSON- JSON serialization and deserialization with type validationExdantic.JSONSchema- JSON schema generation from type definitionsExdantic.OpenAPI- OpenAPI 3.0 specification generation
- Elixir ~> 1.18
- Erlang/OTP with built-in
:jsonmodule support - erldantic library
This project is licensed under the same terms as the underlying erldantic library.