Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name = "ToonFormat"
uuid = "7e1e1c4e-8b9a-4f3d-9c1e-2f3a4b5c6d7e"
version = "0.1.1"
version = "0.2.0"
authors = ["TOON Format Organization"]

[deps]
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[compat]
Aqua = "0.8"
JSON3 = "1"
JSON = "1"
JSONSchema = "1"
LazyArtifacts = "1"
OrderedCollections = "1"
Expand All @@ -20,10 +19,10 @@ julia = "1.6"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "JSON3", "JSONSchema", "LazyArtifacts", "Test"]
test = ["Aqua", "JSON", "JSONSchema", "LazyArtifacts", "Test"]
8 changes: 4 additions & 4 deletions test/test_aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ using Aqua
undefined_exports = true,
# Check project structure (Project.toml, test setup, etc.)
project_extras = true,
# 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],),
# Check for missing dependencies
deps_compat = true,
# Check for piracies (type piracy is bad practice)
Expand Down Expand Up @@ -49,8 +49,8 @@ using Aqua
end

@testset "Stale Dependencies" begin
# Check for dependencies listed but not used - ignore JSON3 which is used only in tests
Aqua.test_stale_deps(ToonFormat; ignore = [:JSON3])
# Check for dependencies listed but not used - ignore JSON which is used only in tests
Aqua.test_stale_deps(ToonFormat; ignore = [:JSON])
end

@testset "Dependency Compatibility" begin
Expand Down
13 changes: 7 additions & 6 deletions test/test_spec_fixtures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Uses Julia Artifacts to download fixtures from the official spec repository.

using Test
using ToonFormat
using JSON3
using JSON
using JSONSchema
using LazyArtifacts

Expand Down Expand Up @@ -62,7 +62,7 @@ function get_fixture_schema()
if _FIXTURE_SCHEMA[] === nothing
if isfile(SCHEMA_PATH)
try
schema_json = JSON3.read(read(SCHEMA_PATH, String))
schema_json = JSON.parse(read(SCHEMA_PATH, String))
_FIXTURE_SCHEMA[] = JSONSchema.Schema(schema_json)
catch e
@warn "Failed to load fixtures schema: $e"
Expand Down Expand Up @@ -122,22 +122,23 @@ end
Load a fixture file and return parsed JSON.
"""
function load_fixture_file(filepath::String)
return JSON3.read(read(filepath, String))
return JSON.parse(read(filepath, String))
end
Comment on lines 124 to 126

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.

# =============================================================================
# Helper functions (existing, preserved)
# =============================================================================

"""
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]
Comment on lines 132 to 142

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.
else
return val
Expand Down