Conversation
solves arg type error when passed to next function as json object but expecting dict
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
Replace this with a description of the changes (can just copy from CHANGELOG.md)