Changelog
View SourceAll notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.2.0 - 2026-03-20
Added
- External schema resolution control — the NIF no longer makes network calls by default
external_schemas: :ignore(default) — silently ignores all external$refs with a permissive empty schemaexternal_schemas: :http— opt-in to the Rust crate's built-in HTTP fetchingexternal_schemas: %{url => json}— pass a pre-resolved map of URI → JSON stringref_resolver: MyModule— behaviour-based resolver with automatic transitive ref resolution
ExJsonschema.RefResolverbehaviour — implementresolve/1to fetch external schemas from HTTP, database, filesystem, or any other sourceExJsonschema.extract_refs/1— pure-Elixir function that walks a schema and returns all external$refURIs (excludes local#/...fragment refs)- New
:ref_resolution_errortype inCompilationErrorfor resolver failures MetaValidator.valid?/2,validate/2,validate_simple/2,validate!/2— 2-arity variants accepting keyword opts
Fixed
- MetaValidator no longer deadlocks on schemas with external
$refs — previously,meta_validatecalled Rust NIFs that attempted HTTP fetching for all$refURIs, causing hangs when refs pointed to localhost or unreachable URLs. MetaValidator now routes through the same compile path withexternal_schemas: :ignore - Removed
preprocess_schema_for_rustworkaround and@safe_schema_urlswhitelist — no longer needed since meta-validation uses the compile path withIgnoreRetriever valid?/1now returnsfalseinstead of raisingArgumentErroron malformed JSON (consistent withvalid?semantics)
Changed
- Upgraded Rust
jsonschemacrate from 0.33 to 0.45 — picks up upstream bug fixes, performance improvements, and new JSON Schema spec coverage - Upgraded Rust
rustlercrate from 0.36 to 0.37 — aligns with the Elixir-siderustler ~> 0.37.1dependency - Improved validation error accuracy — error keyword, instance value, and constraint data are now extracted from the crate's structured
ValidationErrorKindenum instead of being guessed from schema path parsingerror.kind().keyword()replaces fragile last-segment-of-schema-path heuristicerror.instance()replaces manual JSON tree navigation for the failing value- Type constraint values now render as
"string"instead ofSingle(String)
- Requires Rust 1.91+ (due to rustler 0.37 MSRV)
Removed
- Removed hand-rolled
extract_keyword_from_errorpath-parsing logic (replaced byValidationErrorKind::keyword()) - Removed
get_schema_constraint_valueJSON tree navigation (replaced byextract_constraint_from_kind)
0.1.1 - 2024-12-17
Fixed
- Fixed precompiled NIF file extension for macOS targets - now correctly uses
.soinstead of.dylibto match Erlang/OTP conventions - Updated release workflow to generate correct file names for macOS precompiled binaries
0.1.0 - 2024-12-17
Added
- Initial release of ExJsonschema
- High-performance JSON Schema validation using Rust
jsonschemacrate v0.20 - Support for JSON Schema draft-07, draft 2019-09, and draft 2020-12
- Precompiled NIF binaries for major platforms (no Rust toolchain required)
- Comprehensive API with multiple validation functions:
compile/1andcompile!/1- Schema compilationvalidate/2andvalidate!/2- Full validation with detailed errorsvalid?/2- Fast boolean validation checkvalidate_once/2- One-shot compilation and validation
- Enhanced error handling with structured
CompilationErrorandValidationErrortypes - Detailed error messages with JSON path information and validation context
- Memory-safe NIF implementation with proper panic handling
- Comprehensive test suite with 27 tests covering all functionality
- Complete documentation with examples and API reference
- Zero-dependency installation for end users
Technical Details
- Built with Rustler v0.36 for safe Rust-Elixir interop
- Uses
rustler_precompiledv0.8 for precompiled binary distribution - Implements proper NIF resource management for compiled schemas
- Supports multiple architectures: x86_64 and aarch64 for macOS, Linux, and Windows
- Optimized for performance with compile-once, validate-many pattern