Skip to content

Commit 54736c6

Browse files
author
EDWARDS Philippe
committed
changes after review
Signed-off-by: EDWARDS Philippe <edwardsphi@gm0winl1028.bureau.si.interne>
1 parent 63f3f03 commit 54736c6

7 files changed

Lines changed: 12 additions & 13 deletions

File tree

data/crac/crac-io/crac-io-json/src/main/java/com/powsybl/openrao/data/crac/io/json/serializers/StandardRangeSerializer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import com.fasterxml.jackson.core.JsonGenerator;
1111
import com.fasterxml.jackson.databind.SerializerProvider;
12-
import com.powsybl.openrao.data.crac.api.range.RangeType;
1312
import com.powsybl.openrao.data.crac.api.range.StandardRange;
1413
import com.powsybl.openrao.data.crac.io.json.JsonSerializationConstants;
1514

@@ -28,9 +27,7 @@ public void serialize(StandardRange value, JsonGenerator gen, SerializerProvider
2827
if (value.getMax() < Integer.MAX_VALUE) {
2928
gen.writeNumberField(JsonSerializationConstants.MAX, value.getMax());
3029
}
31-
if (value.getRangeType() != RangeType.ABSOLUTE) {
32-
gen.writeStringField(JsonSerializationConstants.RANGE_TYPE, JsonSerializationConstants.serializeRangeType(value.getRangeType()));
33-
}
30+
gen.writeStringField(JsonSerializationConstants.RANGE_TYPE, JsonSerializationConstants.serializeRangeType(value.getRangeType()));
3431
gen.writeEndObject();
3532
}
3633
}

data/crac/crac-io/crac-io-json/src/main/resources/schemas/counter-trade-range-action/counter-trade-range-action-v2.10.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema#",
3-
"$id": "resource:/schemas/counter-trade-range-action/counter-trade-range-action-v2.8.json",
3+
"$id": "resource:/schemas/counter-trade-range-action/counter-trade-range-action-v2.10.json",
44
"type": "object",
55
"properties": {
66
"id": {
@@ -42,6 +42,9 @@
4242
"items": {
4343
"type": "object",
4444
"properties": {
45+
"rangeType": {
46+
"$ref": "../range-type/range-type-v2.3.json"
47+
},
4548
"max": {
4649
"type": "number"
4750
},

data/crac/crac-io/crac-io-json/src/main/resources/schemas/counter-trade-range-action/counter-trade-range-action-v2.8.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
"items": {
4343
"type": "object",
4444
"properties": {
45-
"rangeType": {
46-
"$ref": "../range-type/range-type-v2.3.json"
47-
},
4845
"max": {
4946
"type": "number"
5047
},

data/crac/crac-io/crac-io-json/src/main/resources/schemas/hvdc-range-action/hvdc-range-action-v2.10.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema#",
3-
"$id": "resource:/schemas/hvdc-range-action/hvdc-range-action-v2.8.json",
3+
"$id": "resource:/schemas/hvdc-range-action/hvdc-range-action-v2.10.json",
44
"type": "object",
55
"properties": {
66
"id": {

data/crac/crac-io/crac-io-json/src/main/resources/schemas/injection-range-action/injection-range-action-v2.10.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema#",
3-
"$id": "resource:/schemas/injection-range-action/injection-range-action-v2.8.json",
3+
"$id": "resource:/schemas/injection-range-action/injection-range-action-v2.10.json",
44
"type": "object",
55
"properties": {
66
"id": {

data/crac/crac-io/crac-io-json/src/test/java/com/powsybl/openrao/data/crac/io/json/JsonRetrocompatibilityTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,10 @@ void importV2Point10WithMaxTso() throws IOException {
426426
String cracFilePath = "/crac2.10-with_maxtso.json";
427427
InputStream cracFile = getClass().getResourceAsStream(cracFilePath);
428428

429-
Crac crac = Crac.read(cracFilePath, cracFile, network);
430-
assertEquals(1, crac.getFlowCnecs().size());
429+
OpenRaoException exception = assertThrows(OpenRaoException.class, () -> Crac.read(cracFilePath, cracFile, network));
430+
assertEquals("JSON file is not a valid CRAC v2.10. Reasons: /ra-usage-limits-per-instant/0: " +
431+
"property 'max-tso' is not defined in the schema and the schema does not allow additional properties",
432+
exception.getMessage());
431433
}
432434

433435
private void testContentOfV1Point0Crac(Crac crac) {

data/crac/crac-io/crac-io-json/src/test/resources/crac2.10-with_maxtso.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"type": "CRAC",
3-
"version": "2.8",
3+
"version": "2.10",
44
"info": "Generated by PowSyBl OpenRAO https://powsybl.readthedocs.io/projects/openrao/",
55
"id": "bad-crac",
66
"name": "bad-crac",

0 commit comments

Comments
 (0)