Skip to content

drop json3#571

Merged
jd-lara merged 16 commits into
IS4from
jd/drop_json3
Apr 27, 2026
Merged

drop json3#571
jd-lara merged 16 commits into
IS4from
jd/drop_json3

Conversation

@jd-lara
Copy link
Copy Markdown
Member

@jd-lara jd-lara commented Apr 15, 2026

To support the upcoming usage of OpenAPI models. I am updating to JSON.jl from JSON3 according to the migration guidelines. This PR needs to be followed with a PSY one

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates InfrastructureSystems’ JSON serialization/deserialization stack to drop JSON3 (and StructTypes) in favor of JSON.jl, aligning with upcoming OpenAPI model usage and the JSON3→JSON migration guidance.

Changes:

  • Replaced JSON3 read/write/pretty calls across src and tests with JSON.parse / JSON.json.
  • Removed JSON3/StructTypes-specific enum and struct serialization hooks and updated corresponding deserialize paths.
  • Updated package dependencies (Project.toml + test/Project.toml) and test imports to use JSON.jl.

Reviewed changes

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

Show a summary per file
File Description
test/test_time_series.jl Switches metadata JSON encoding used in migration setup helpers.
test/test_serialization.jl Updates serialization round-trip tests to JSON.jl parse/encode APIs.
test/test_recorder.jl Updates event log parsing to JSON.jl.
test/test_generate_structs.jl Updates generated-struct tests to JSON.jl parsing.
test/test_function_data.jl Updates JSON “round-trip to Dict” test logic to JSON.jl.
test/Project.toml Replaces JSON3 test dependency with JSON.
test/InfrastructureSystemsTests.jl Replaces import JSON3 with import JSON.
src/validation.jl Switches descriptor JSON parsing to JSON.jl.
src/utils/utils.jl Replaces JSON3 usage; updates @scoped_enum JSON-related behavior; updates file-hash JSON write.
src/utils/test.jl Switches test helper JSON parsing to JSON.jl.
src/utils/recorder_events.jl Switches recorder event JSON encode/decode to JSON.jl.
src/utils/generate_structs.jl Switches descriptor JSON parsing to JSON.jl.
src/utils/generate_struct_files.jl Switches descriptor JSON parsing/writing and removes JSON3/StructTypes hooks for struct serialization.
src/time_series_parser.jl Switches time-series metadata JSON parsing to JSON.jl.
src/time_series_metadata_store.jl Switches metadata/features/scaling-factor JSON parse/write to JSON.jl.
src/serialization.jl Switches core to_json/from_json and ext validation to JSON.jl.
src/abstract_time_series.jl Switches feature-string JSON encoding to JSON.jl.
src/InfrastructureSystems.jl Replaces JSON3 import with JSON; removes StructTypes import.
Project.toml Replaces JSON3/StructTypes deps with JSON and updates compat accordingly.

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

Comment thread src/utils/generate_struct_files.jl
Comment thread src/serialization.jl Outdated
io = IOBuffer()
JSON3.pretty(io, serialize(obj), JSON3.AlignmentContext(; indent = indent))
JSON.json(io, serialize(obj); pretty = indent)
return take!(io)
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

to_json(obj; pretty=true) is documented as returning a JSON string, but this branch returns take!(io) (a Vector{UInt8}) while the non-pretty branch returns a String. This inconsistent return type can surprise callers and makes downstream parsing more brittle. Consider returning a String consistently (e.g., wrap the buffer with String(...)) or updating the docstring/return contract if bytes are intentional.

Suggested change
return take!(io)
return String(take!(io))

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 62.50000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.86%. Comparing base (94161b0) to head (14e304b).
⚠️ Report is 40 commits behind head on IS4.

Files with missing lines Patch % Lines
src/serialization.jl 60.86% 9 Missing ⚠️
src/utils/utils.jl 25.00% 3 Missing ⚠️
src/utils/recorder_events.jl 50.00% 1 Missing ⚠️
src/utils/test.jl 0.00% 1 Missing ⚠️
src/validation.jl 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              IS4     #571      +/-   ##
==========================================
- Coverage   82.04%   81.86%   -0.18%     
==========================================
  Files          74       74              
  Lines        6238     6304      +66     
==========================================
+ Hits         5118     5161      +43     
- Misses       1120     1143      +23     
Flag Coverage Δ
unittests 81.86% <62.50%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/InfrastructureSystems.jl 44.44% <ø> (ø)
src/abstract_time_series.jl 76.47% <100.00%> (+1.47%) ⬆️
src/time_series_metadata_store.jl 92.72% <100.00%> (+0.49%) ⬆️
src/time_series_parser.jl 73.78% <100.00%> (ø)
src/utils/generate_struct_files.jl 86.44% <100.00%> (-0.45%) ⬇️
src/utils/generate_structs.jl 88.03% <100.00%> (ø)
src/utils/recorder_events.jl 92.10% <50.00%> (ø)
src/utils/test.jl 73.33% <0.00%> (ø)
src/validation.jl 0.96% <0.00%> (ø)
src/utils/utils.jl 66.27% <25.00%> (-0.50%) ⬇️
... and 1 more

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jd-lara jd-lara requested a review from luke-kiernan April 22, 2026 06:35
@jd-lara jd-lara marked this pull request as ready for review April 22, 2026 06:36
Copy link
Copy Markdown
Contributor

@luke-kiernan luke-kiernan left a comment

Choose a reason for hiding this comment

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

A little bit outside what I typically deal with, but I see no issues.

@jd-lara jd-lara merged commit 5869e99 into IS4 Apr 27, 2026
9 of 10 checks passed
@jd-lara jd-lara deleted the jd/drop_json3 branch May 12, 2026 21:35
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.

3 participants