Skip to content

fix: drop the unused JSON3 dependency - #16

Merged
johannschopplich merged 4 commits into
toon-format:mainfrom
AbrJA:main
Oct 2, 2026
Merged

johannschopplich merged 4 commits into
toon-format:mainfrom
AbrJA:main

Conversation

@AbrJA

@AbrJA AbrJA commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

…0.2.0

Linked Issue

Closes #15

Closes #

Description

JSON3 has been deprecated. This PR migrates to JSON.jl v1

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Changes Made

Change the usage of JSON3 to JSON

Testing

  • All existing tests pass
  • Added new tests for changes
  • Tests cover edge cases and spec compliance

Pre-submission Checklist

  • My code follows the project's coding standards
  • I have run code formatting/linting tools
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation if needed
  • I have reviewed the TOON specification for relevant sections

Breaking Changes

  • No breaking changes
  • Breaking changes (describe migration path below)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the package away from the deprecated JSON3.jl dependency by updating test parsing code to use JSON.jl and updating package metadata accordingly.

Changes:

  • Replaced JSON3 usage in spec-fixture tests with JSON.jl parsing.
  • Updated Aqua stale-dependency ignore list from :JSON3 to :JSON.
  • Removed JSON3 from Project.toml, added JSON as a test extra, and bumped version to 0.2.0.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/test_spec_fixtures.jl Switches fixture/schema parsing from JSON3 to JSON.jl and updates normalization logic.
test/test_aqua.jl Updates Aqua stale-deps ignore list to reflect JSON.jl usage in tests.
Project.toml Removes JSON3 dep, adds JSON as a test extra/compat, and bumps package version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 124 to 126
function load_fixture_file(filepath::String)
return JSON3.read(read(filepath, String))
return JSON.parse(read(filepath, String))
end

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON.parse returns Dict/Vector with String keys, but the rest of this test file still treats parsed fixtures as JSON3-style objects (e.g., fixture_data.tests, get(fixture_data, :tests, ...), test.name, get(test, :shouldError, ...)). With Dict{String,Any} this will throw at runtime. Update the fixture accessors to use string keys/indexing (e.g., fixture_data["tests"], get(fixture_data, "tests", []), test["name"], etc.), or add an explicit conversion layer that preserves the existing symbol/getproperty access pattern.

Copilot uses AI. Check for mistakes.
Comment on lines 132 to 142
"""
Convert JSON3 objects to native Julia types for comparison.
Convert JSON objects to native Julia types for comparison.
Note: JSON.parse() already returns native Julia types (Dict, Array), so minimal conversion needed.
"""
function normalize_json(val)
if val isa JSON3.Object
if val isa Dict
return ToonFormat.JsonObject(
string(k) => normalize_json(v) for (k, v) in pairs(val)
)
elseif val isa JSON3.Array || val isa Vector
elseif val isa Vector
return [normalize_json(v) for v in val]

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring says JSON.parse() already returns native types so only minimal conversion is needed, but normalize_json still converts objects into ToonFormat.JsonObject (an OrderedDict) for comparisons. Consider updating the docstring to reflect the actual purpose (convert parsed JSON into ToonFormat’s canonical JSON model), and consider using AbstractDict/AbstractVector instead of Dict/Vector to avoid missing other dict/array implementations (e.g., OrderedDict).

Copilot uses AI. Check for mistakes.

@johannschopplich johannschopplich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow reply. Dropping JSON3 from [deps] is the part that matters – src/ never imports it, yet every install pulls it in. The suite passes locally on Julia 1.12; three small things before this goes in.

Comment thread Project.toml Outdated
name = "ToonFormat"
uuid = "7e1e1c4e-8b9a-4f3d-9c1e-2f3a4b5c6d7e"
version = "0.1.1"
version = "0.2.0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave the version out – releases get their own commit, and dropping an unused dependency would be 0.1.2, not 0.2.0.

Comment thread test/test_spec_fixtures.jl Outdated
"""
function normalize_json(val)
if val isa JSON3.Object
if val isa Dict

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON.parse returns a JSON.Object, not a Dict, so this branch never runs and fixture objects reach the comparison unconverted. val isa AbstractDict fixes it, and the note on line 134 can go.

Comment thread test/test_aqua.jl Outdated
# Check for stale dependencies - ignore JSON3 which is used only in tests
stale_deps = (ignore = [:JSON3],),
# Check for stale dependencies - ignore JSON which is used only in tests
stale_deps = (ignore = [:JSON],),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON is a test extra, not a package dependency, so stale_deps has nothing to ignore – here and on line 53.

@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@johannschopplich johannschopplich changed the title fix: update dependencies from JSON3 to JSON and increment version to … fix: drop the unused JSON3 dependency Oct 2, 2026
@johannschopplich
johannschopplich merged commit 9545b03 into toon-format:main Oct 2, 2026
9 checks passed
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.

JSON3.jl deps

3 participants