-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use JSON schemas for JSON CRAC import #1175
Conversation
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
…/powsybl-open-rao into feature/json-crac-schema
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
@@ -47,26 +49,19 @@ public boolean exists(String filename, InputStream inputStream) { | |||
return false; | |||
} | |||
try { | |||
Map<Pair<Integer, Integer>, List<String>> validationErrorsPerVersion = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed with @phiedw
let's try reading the "version" field in the crac and then fetching the corresponding json schema. this has 3 advantages :
- you won't need to fetch all schema files anymore
- we do one validation per file
- the error messages will be specific for the crac version indicated by the user
To read the crac version, either do it manually by parsing the json first before validating it, or create a new validation schema that only read the version, and call it before the other version-specific schema
Co-authored-by: Peter Mitri <[email protected]> Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
…/powsybl-open-rao into feature/json-crac-schema
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
...crac/crac-io/crac-io-json/src/main/java/com/powsybl/openrao/data/cracio/json/JsonImport.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Signed-off-by: Thomas Bouquet <[email protected]>
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
Fixes #1165
Fixes #1171
Fixes #1074
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Other information:
This PR is the first step of a broader work of implementing a thorough and coherent Creation Context for JSON CRAC as presented in #1083 and #1098.
When importing a JSON CRAC file, there are two possible types of errors that can occur:
The latter are the types of erros that must be added to a Creation Context. Thanks to the JSON schemas, the JSON CRAC deserializer is called only is we are sure that the input file matches an accepted pattern for a JSON CRAC file. Then, we can simply handle minor business errors in the deserializer and add them to the Creation Context.
This is better than what is currently done because a structural error in the provided JSON files leads the importer to crash even though the JSON importer asserted that the format was right. This prevents for instance users to define another type of JSON Crac.