Skip to content

Loadflow Parameters .from_json is order-sensitive #1168

Description

@nicow-elia

Describe the current behavior

When storing and loading powsybl loadflow parameters, the from_json crashes if the order of keys in the json has been altered. See:

from pypowsybl.loadflow import Parameters
params = Parameters()
params_json = params.to_json()
ordered_json = json.dumps(json.loads(params_json), sort_keys=True)
# Passes:
Parameters.from_json(params_json)
# Crashes:
Parameters.from_json(ordered_json)

Describe the expected behavior

from_json should be insensitive to the order of keys in the json file.

Describe the steps

No response

Environment

  • pypowsybl 1.14.0

Relevant Log Output

No response

Extra Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions