All notable changes to this project are documented here. The format follows Keep a Changelog and the project uses Semantic Versioning.
[Unreleased]
[0.3.5] - 2026-11-18
Added
- Public JSON Schema document checking and strict registration preflight via
Formata.Schema.JSONSchema.check_document/2andpreflight/2(#3). Audits include unused branches, scoped IDs/anchors, recursive pointers, explicit external registries/loaders and configurable resource limits. Loaded resources are captured for subsequent offline validation. - Public native schema wire export and conservative Draft 7 import through
Formata.Schema.Native.to_json_schema/2andfrom_json_schema/2(#2). Export supports metadata exclusion and explicit custom-validator omission; native unions useanyOf. Import rejects unsupported constraints and exclusiveoneOf, with structured errors and string-only property keys.
Fixed
- JSON Schema compilation checks built-in meta-schema keyword shapes, returning structured schema errors for malformed constraints before instance validation can raise.
[0.3.4] - 2026-11-18
Added
- Application JSON APIs for internal request #1:
Formata.JSON.decode/2returns structured errors and accepts exact float-token callbacks (such asfloats: &Decimal.new/1) andobjects: :ordered_objects. Both decode variants preserve strict duplicate-key rejection; the portable codecs retain their existing value domain and options. - Public
Formata.JSON.OrderedObjectwithAccess,Enumerable, andJSON.Encodersupport for order-preserving configuration edits. Encoding rejects duplicate encoded keys. pretty: trueonFormata.JSON.encode!/2andencode_to_iodata!/2, including atom keys/values, standard temporal values, derived structs, and nested ordered objects.
Changed
- Remove the imported backend namespaces without compatibility aliases.
Native schema definitions now use
Formata.NativeSchema(including itsErrorandWalkermodules);Formata.Schema.Nativeremains the adapter for compilation, pure validation, and casting. Recompile existing schemas to replace backend module references in compiled structs. - Rename internal backends to
Formata.JSON.Backend,Formata.TOML,Formata.YAML.Reader,Formata.YAML.Writer,Formata.JSONSchema, andFormata.JSONPointer. Erlang YAML modules, records, and headers useformata_yamlnames. Error metadata reflects the new backend modules; serialized YAML tag URIs and upstream license attribution are preserved. - Align test files, helper modules, and fixture directories with the current backend namespaces. Ported suites now live alongside the corresponding module tests, without a separate vendor test namespace.
[0.3.3] - 2026-11-14
Fixed
- Replace three deprecated Erlang catch expressions in the YAML binary
constructor and constructor-module probe. Invalid Base64 still returns
not_a_binarywith its token and location, including missing padding; module probing still attempts loading before checking exports.
Added
- Clean Erlang compilation gates in CI and Release with warnings treated
as errors and
warn_deprecated_catchexplicitly enabled on OTP 28. - Regression coverage for Base64 constructor modes and constructor-module probing, including available but unloaded modules.
[0.3.2] - 2026-11-14
Fixed
- YAML 1.2 implicit incomplete integers (
+,0x,0o) remain strings; invalid explicitly tagged integers return syntax errors. Explicit YAML 1.1 documents retain their separate resolution rules. - YAML decoding validates mapping keys and values before map construction. Null scalar keys work, duplicate normalized keys are rejected, and complex sequence/mapping keys return an explicit unsupported-key error instead of losing entries or exposing parser records. Encoder key types are unchanged.
- Quoted
"<<"and explicitly tagged!!str <<remain literal string keys; only the plain implicit merge convention remains unsupported. - YAML encoding preserves root
nil, numeric-looking strings such as.5, leading-space multiline strings, CRLF, controls and U+FEFF. Unsafe block values use complete YAML double-quoted escaping. The round-trip guard stays enabled, and the previously skipped leading-space emitter test is enabled. - Anchors before flow collections attach to the collection rather than a child or subsequent mapping key.
- Malformed escapes, raw control characters in flow scalars, and unfinished flow collections return structured syntax errors with source locations.
Added
- Per-call YAML
max_depth(default 128) andmax_nodes(default 100,000) limits, including mapping keys and repeated alias expansions. Decoding uses one detailed parse and bounded validation/conversion. Encoding checks its input and round-trip verification with the same limits. - Scoped fixtures from the tagged official YAML Test Suite and independent
YAML 1.2 typed-node emission checks using test-only
ruamel.yaml==0.18.16. See the YAML review for compatibility decisions, resource accounting and validation evidence.
[0.3.1] - 2026-11-13
Fixed
- TOML assignments reject comments before a value, including inside inline tables, while retaining comments in arrays and valid multiline values. Missing values at CRLF boundaries now return syntax errors with locations instead of an internal error-formatting failure.
- TOML numeric underscores require digits on both sides, including after exponent signs; incomplete fractions and exponents return syntax errors.
- TOML date-time separators accept only
T,t, or one ASCII space; standalone dates still allow trailing whitespace. - Encoding rejects invalid UTF-8 map keys with structured
:invalid_keyerrors before rendering, including nested and inline TOML tables. The shared check also protects JSON, JSON5, and YAML encoders.
Added
- Deterministic TOML grammar-boundary regressions and independent
tomllibdecoder comparisons, retaining all 208 valid and 509 invalid pinned conformance inputs. See the correctness review.
[0.3.0] - 2026-11-13
Added
Formata.JSON, a Phoenix/Plug JSON library module (config :phoenix, :json_library, Formata.JSON) withdecode!/1,2,encode!/1, andencode_to_iodata!/1. Decoding is Formata's strict JSON decoder (duplicate keys rejected, raisingFormata.Error); encoding delegates to Elixir'sJSON(JSON.Encoderfor structs).
[0.2.1] - 2026-11-13
Changed
Formata.Codec.JSON.Streamis faster, with the same API, events, and errors. Measured on Elixir 1.20 / OTP 28 (method and full results indocs/design.md): 2.0–3.7× on compact documents fed in 1-byte, 1–256-byte, 4 KiB, or 64 KiB chunks and on long strings; 1.65–2.0× on 1–16-byte token deltas; 1.4–1.8× on pretty-printed documents; 1.7× for a whole document in a single chunk; 1.7–6× less allocation. Position tracking no longer re-scans every chunk with a per-byte loop; the scanner reuses binary match contexts, keeps per-token state in a small record, caches container paths, and scans unescaped ASCII eight bytes at a time.bench/json_stream.exscovers token deltas, network chunks, long and escaped strings, deep nesting, pretty-printed documents,string_deltas,decode_stream/2, and OTP's:jsonincremental decoder for comparison.- Supported versions are documented as Elixir 1.18+ on Erlang/OTP 28+ (previously OTP 25+), and CI now tests the minimum combination, Elixir 1.18 on OTP 28, instead of OTP 27.
Fixed
Formata.Codec.JSON.Streamcopied the rest of the chunk for every number it finished, making large chunks with many numbers quadratic.
[0.2.0] - 2026-11-13
Added
:jsondecode optionscomments: true(//and/* */comments where whitespace is allowed) andtrailing_commas: true(one comma after the last element of an array or object). They are independent and default tofalse;:jsonstays strict RFC 8259 and encoding always produces strict JSON. There is no separate JSONC codec.Formata.Codec.JSON.Stream: an incremental, purely functional parser for a single JSON document received in arbitrary byte chunks (for example LLM output), withnew/1,feed/2,finish/1, and the lazydecode_stream/2. It emits structure, key, and complete scalar events (and optional string deltas), checks completeness atfinish/1, rejects duplicate keys, reports positions across chunks, and enforces depth, document, and token size limits.:json5codec (Formata.Codec.JSON5) for JSON5 1.0.0, with special numbers mapped to:infinity,:negative_infinity, and:nan.bench/json_stream.exsmeasures the stream parser by chunk size.
Changed
Formata.decode(input, :json, opts)now rejects unknown options and invalid option values with:unsupported/:invalid_optionerrors; previously all options were ignored.Formata.Jasondecoder (fork): opt-incommentsandtrailing_commasoptions.
[0.1.0]
Added
- JSON, TOML (TOML 1.0.0), and single-document YAML codecs with a documented portable value domain, duplicate-key rejection, and strict encoding that rejects unrepresentable values.
Formata.convert/4with explicit transformations (Formata.Transform).- Native schemas (
Formata.Backplane.Schema) with pure validation (validate/3) over a checked non-transforming subset, unknown-field allow/reject, and full casting (cast/3) with defaults, coercion, transforms, and stripping. - JSON Schema Draft 7 and Draft 2020-12 with dialect selection, local references, explicit remote loaders, and configurable format assertion.
- Structured
Formata.Errorvalues for parse, encode, schema, validation, transform, and unsupported-operation failures. - No runtime dependencies: the backends are maintained forks of
jason1.4.5,gsmlg_toml1.0.0,yaml_elixir2.12.2,yamerl0.10.0,ymlr5.1.6,backplane_schema1.10.76,backplane_json_schema1.10.76, andex_json_pointer0.9.0, renamed into theFormatanamespace (seeNOTICE.md), with their upstream test suites ported. - Conformance suites in the test run: toml-test 1.0.0 (208 valid, 509 invalid) and the required JSON-Schema-Test-Suite cases for Draft 7 and Draft 2020-12.
Changed in the forked backends (relative to the upstream releases)
- TOML decoder: offset date-times decode to the correct instant
(gsmlg-dev/gsmlg_umbrella#13); empty array-of-tables elements and their
subtables are kept (#14);
true/falseare valid bare keys (#15); local date-times may be followed by,(#16). It now passes the full toml-test 1.0.0 suite, including TOML 1.0 table-redefinition and inline-table rules, string escapes and line-ending backslashes, and lowercaset/zin date-times. Invalid UTF-8 and malformed\Uescapes return parse errors instead of crashing the caller;-nandecodes to:nan. - JSON Schema:
formatis an annotation by default when$schemais absent (gsmlg-opt/backplane#170); error paths render integer segments and escape~//(#172);multipleOfis exact and never raises; IDN-dependenthostname/emailchecks report:unsupported_formatinstead of raising; opaque base URIs (urn:) resolve references on Elixir 1.18. - Native schemas: permissive mode no longer duplicates fields under atom keys
(gsmlg-opt/backplane#171), so
cast(..., unknown: :allow)works for atom-keyed schemas over string-keyed data. - Optional
Decimal/:idnaintegrations, application environment, and yamerl's application/supervisor are removed.