Repository navigation
fix: drop the unused JSON3 dependency - #16
Conversation
There was a problem hiding this comment.
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
:JSON3to:JSON. - Removed JSON3 from
Project.toml, added JSON as a test extra, and bumped version to0.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.
| function load_fixture_file(filepath::String) | ||
| return JSON3.read(read(filepath, String)) | ||
| return JSON.parse(read(filepath, String)) | ||
| end |
There was a problem hiding this comment.
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.
| """ | ||
| 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] |
There was a problem hiding this comment.
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).
johannschopplich
left a comment
There was a problem hiding this comment.
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.
| name = "ToonFormat" | ||
| uuid = "7e1e1c4e-8b9a-4f3d-9c1e-2f3a4b5c6d7e" | ||
| version = "0.1.1" | ||
| version = "0.2.0" |
There was a problem hiding this comment.
Please leave the version out – releases get their own commit, and dropping an unused dependency would be 0.1.2, not 0.2.0.
| """ | ||
| function normalize_json(val) | ||
| if val isa JSON3.Object | ||
| if val isa Dict |
There was a problem hiding this comment.
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.
| # 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],), |
There was a problem hiding this comment.
JSON is a test extra, not a package dependency, so stale_deps has nothing to ignore – here and on line 53.
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 ☂️ |
…0.2.0
Linked Issue
Closes #15
Closes #
Description
JSON3 has been deprecated. This PR migrates to JSON.jl v1
Type of Change
Changes Made
Change the usage of JSON3 to JSON
Testing
Pre-submission Checklist
Breaking Changes