Conversation
solves arg type error when passed to next function as json object but expecting dict
There was a problem hiding this comment.
Pull request overview
Ensures JSON scenario parsing consistently produces Dict{String,Any} (instead of JSON.Object) when loading scenario files, avoiding MethodError when passing parsed JSON into constructors like Scenario(d::Dict) / MPCScenario(d::Dict).
Changes:
- Added
dicttype = Dict{String, Any}toJSON.parsefilecalls across REopt and MPC file-path entry points. - Updated PV defaults JSON loading to use the same
dicttype. - Added a CHANGELOG entry describing the fix.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mpc/model.jl | Forces parsed MPC scenario JSON into a Dict{String,Any} before constructing MPCScenario. |
| src/mpc/inputs.jl | Forces parsed MPC inputs JSON into a Dict{String,Any} before constructing MPCScenario. |
| src/core/scenario.jl | Ensures Scenario(fp::String) parses JSON into a Dict{String,Any}. |
| src/core/reopt.jl | Ensures run_reopt(..., fp) and build_reopt!(..., fp) parse JSON into a Dict{String,Any}. |
| src/core/reopt_inputs.jl | Ensures REoptInputs(fp::String) parses JSON into a Dict{String,Any} (incl. docstring example). |
| src/core/pv.jl | Ensures PV defaults JSON is parsed into a Dict{String,Any}. |
| CHANGELOG.md | Documents the fix in the changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zolanaj
left a comment
There was a problem hiding this comment.
Thanks @hdunham! This looks good as is, and when testing this branch on the API all tests are passing.
This is good to merge but one question: do we want to update the test suite so that the JSON.parsefile(...) calls within are updated to call this new function?
Please check if the PR fulfills these requirements
Replace this with a description of the changes (can just copy from CHANGELOG.md)