Skip to content

feat: replace thoas with Erlang/OTP json module#366

Open
Taure wants to merge 5 commits intomasterfrom
feat/replace-thoas-with-otp-json
Open

feat: replace thoas with Erlang/OTP json module#366
Taure wants to merge 5 commits intomasterfrom
feat/replace-thoas-with-otp-json

Conversation

@Taure
Copy link
Collaborator

@Taure Taure commented Mar 11, 2026

Summary

  • Remove thoas dependency in favor of the built-in json module from OTP 27+
  • Remove the json_lib configuration option (OTP json is always available)
  • Handle API differences: json:decode/1 returns term directly (vs thoas:decode/1 returning {ok, Term})
  • Convert charlist values to binaries for JSON encoding since OTP json treats charlists as arrays

Changes

  • rebar.config / nova.app.src — remove thoas dependency
  • nova_basic_handler — use json:encode/1 directly
  • nova_request_plugin — use try json:decode/1 with catch (replaces case thoas:decode/1 with {ok, _} match)
  • nova_jsonlogger — use json:encode/1 directly, update test assertions
  • nova_error_controller — use json:encode/1, add ensure_json_safe/1 for CrashInfo values, convert hardcoded strings to binaries
  • nova_test_helper — use json:encode/1, remove json_lib env setup
  • configuration.md — remove json_lib docs

Breaking changes

  • The json_lib application env option is no longer supported
  • Requires OTP 27+

Test plan

  • All 139 eunit tests pass
  • xref clean
  • dialyzer clean

🤖 Generated with Claude Code

Taure and others added 4 commits March 11, 2026 21:40
Remove the thoas dependency and use the built-in json module from
OTP 27+ for all JSON encoding/decoding. This removes the json_lib
configuration option since OTP json is always available.

Key changes:
- Replace all thoas:encode/1 calls with json:encode/1
- Replace thoas:decode/1 (returns {ok, Term}) with json:decode/1
  (returns Term directly, throws on error) in nova_request_plugin
- Convert charlist values to binaries in nova_error_controller since
  OTP json encodes charlists as JSON arrays, not strings
- Add ensure_json_safe/1 helper for CrashInfo values
- Update all tests for json module API differences
- Remove json_lib from configuration docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OTP 27+ is now required since the json module is used for JSON
encoding/decoding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump actions/cache from v4 to v5
- Bump actions/checkout from v4 to v6 in release workflow
- Bump OTP matrix from 27.1/28.0 to 27.3/28.3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
erlef/setup-beam@v1 still uses node20 which is deprecated June 2026.
Set FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 to opt in early.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant