diff --git a/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java b/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java index e84cde9b13a..d68bcfe0c1c 100644 --- a/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java +++ b/core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/RJSInfra.java @@ -18,7 +18,7 @@ public class RJSInfra { public static final JsonAdapter adapter = new Moshi.Builder().add(ID.Adapter.FACTORY).build().adapter(RJSInfra.class); - public static final transient String CURRENT_VERSION = "3.4.11"; + public static final transient String CURRENT_VERSION = "3.4.13"; /** The version of the infra format used */ public String version; diff --git a/editoast/editoast_schemas/src/infra/operational_point.rs b/editoast/editoast_schemas/src/infra/operational_point.rs index b3a0b452614..449086b329c 100644 --- a/editoast/editoast_schemas/src/infra/operational_point.rs +++ b/editoast/editoast_schemas/src/infra/operational_point.rs @@ -25,6 +25,8 @@ pub struct OperationalPoint { #[serde(default)] #[schema(inline)] pub extensions: OperationalPointExtensions, + #[serde(default)] + pub weight: Option, } #[derive(Debug, Derivative, Clone, Deserialize, Serialize, ToSchema)] diff --git a/editoast/editoast_schemas/src/infra/railjson.rs b/editoast/editoast_schemas/src/infra/railjson.rs index 0d719105ff6..5d91271caa0 100644 --- a/editoast/editoast_schemas/src/infra/railjson.rs +++ b/editoast/editoast_schemas/src/infra/railjson.rs @@ -15,7 +15,7 @@ use super::Switch; use super::SwitchType; use super::TrackSection; -pub const RAILJSON_VERSION: &str = "3.4.12"; +pub const RAILJSON_VERSION: &str = "3.4.13"; editoast_common::schemas! { RailJson, diff --git a/editoast/openapi.yaml b/editoast/openapi.yaml index 26268800a34..cfcfcbca823 100644 --- a/editoast/openapi.yaml +++ b/editoast/openapi.yaml @@ -7291,6 +7291,11 @@ components: type: array items: $ref: '#/components/schemas/OperationalPointPart' + weight: + type: integer + format: int32 + nullable: true + minimum: 0 additionalProperties: false OperationalPointExtensions: type: object diff --git a/editoast/osm_to_railjson/src/utils.rs b/editoast/osm_to_railjson/src/utils.rs index 814668a462b..a06cf8f8f26 100644 --- a/editoast/osm_to_railjson/src/utils.rs +++ b/editoast/osm_to_railjson/src/utils.rs @@ -476,6 +476,7 @@ pub fn operational_points( identifier: identifier(&rel.tags), sncf: None, }, + weight: None, }) } }) diff --git a/front/src/common/api/generatedEditoastApi.ts b/front/src/common/api/generatedEditoastApi.ts index 81789320b6f..30a1c4e6864 100644 --- a/front/src/common/api/generatedEditoastApi.ts +++ b/front/src/common/api/generatedEditoastApi.ts @@ -1992,6 +1992,7 @@ export type OperationalPoint = { }; id: string; parts: OperationalPointPart[]; + weight?: number | null; }; export type Waypoint = | { diff --git a/front/src/reducers/osrdconf/infra_schema.json b/front/src/reducers/osrdconf/infra_schema.json index a9b42093da9..0d1a39a5c7c 100644 --- a/front/src/reducers/osrdconf/infra_schema.json +++ b/front/src/reducers/osrdconf/infra_schema.json @@ -849,6 +849,20 @@ }, "title": "Parts", "type": "array" + }, + "weight": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "represents the significance of a PR", + "title": "Weight" } }, "required": [ @@ -2165,8 +2179,8 @@ "type": "array" }, "version": { - "const": "3.4.12", - "default": "3.4.12", + "const": "3.4.13", + "default": "3.4.13", "description": "Version of the schema", "title": "Version" } diff --git a/front/tests/assets/infra/infra.json b/front/tests/assets/infra/infra.json index e52b1b5ce6e..a3ac489edbd 100644 --- a/front/tests/assets/infra/infra.json +++ b/front/tests/assets/infra/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "track_sections": [ { "id": "TA1", diff --git a/python/osrd_schemas/osrd_schemas/infra.py b/python/osrd_schemas/osrd_schemas/infra.py index ff2712aa354..fda8d921049 100755 --- a/python/osrd_schemas/osrd_schemas/infra.py +++ b/python/osrd_schemas/osrd_schemas/infra.py @@ -8,7 +8,7 @@ ALL_OBJECT_TYPES = [] -RAILJSON_INFRA_VERSION_TYPE = Literal["3.4.12"] +RAILJSON_INFRA_VERSION_TYPE = Literal["3.4.13"] RAILJSON_INFRA_VERSION = get_args(RAILJSON_INFRA_VERSION_TYPE)[0] # Traits @@ -197,6 +197,7 @@ class OperationalPoint(BaseObjectTrait): """ parts: List[OperationalPointPart] + weight: Optional[int] = Field(description="represents the significance of a PR", ge=0, default=None) class TrackEndpoint(BaseModel): diff --git a/python/railjson_generator/pyproject.toml b/python/railjson_generator/pyproject.toml index 352a241b898..fa697e034f7 100644 --- a/python/railjson_generator/pyproject.toml +++ b/python/railjson_generator/pyproject.toml @@ -4,7 +4,7 @@ version = "0.4.8" [tool.poetry] name = "railjson_generator" -version = "0.4.8" +version = "0.4.9" description = "" authors = ["OSRD "] diff --git a/python/railjson_generator/railjson_generator/schema/infra/infra.py b/python/railjson_generator/railjson_generator/schema/infra/infra.py index 504dea87ab9..f1f47461868 100644 --- a/python/railjson_generator/railjson_generator/schema/infra/infra.py +++ b/python/railjson_generator/railjson_generator/schema/infra/infra.py @@ -24,7 +24,7 @@ class Infra: electrifications: List[Electrification] = field(default_factory=list) neutral_sections: List[NeutralSection] = field(default_factory=list) - VERSION = "3.4.12" + VERSION = "3.4.13" def add_route(self, *args, **kwargs): self.routes.append(Route(*args, **kwargs)) @@ -88,6 +88,7 @@ def make_rjs_operational_points(self): ), "identifier": infra.OperationalPointIdentifierExtension(uic=op.uic, name=op.label), }, + weight=None, ) ops.append(new_op) return ops diff --git a/python/railjson_generator/railjson_generator/schema/infra/operational_point.py b/python/railjson_generator/railjson_generator/schema/infra/operational_point.py index c4049651b6b..2e0a50a61d2 100644 --- a/python/railjson_generator/railjson_generator/schema/infra/operational_point.py +++ b/python/railjson_generator/railjson_generator/schema/infra/operational_point.py @@ -9,13 +9,15 @@ class OperationalPoint: label: str trigram: str parts: List + weight: Optional[int] uic: int - def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0): + def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0, weight: Optional[int] = None): self.label = label self.trigram = trigram or label[:3].upper() self.parts = list() self.uic = uic + self.weight = weight def add_part(self, track, offset): op_part = OperationalPointPart(self, offset) diff --git a/tests/data/infras/circle_infra/infra.json b/tests/data/infras/circle_infra/infra.json index f9e1920693a..b37881ba8c8 100644 --- a/tests/data/infras/circle_infra/infra.json +++ b/tests/data/infras/circle_infra/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [], "routes": [], "extended_switch_types": [], diff --git a/tests/data/infras/example_script/infra.json b/tests/data/infras/example_script/infra.json index 7dfde34e9f4..9abe7a11e21 100644 --- a/tests/data/infras/example_script/infra.json +++ b/tests/data/infras/example_script/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [ { "id": "my-op", @@ -13,6 +13,7 @@ "position": 500.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, diff --git a/tests/data/infras/nested_switches/infra.json b/tests/data/infras/nested_switches/infra.json index d4bf10bcdd1..364696c9ad7 100644 --- a/tests/data/infras/nested_switches/infra.json +++ b/tests/data/infras/nested_switches/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [], "routes": [ { diff --git a/tests/data/infras/one_line/infra.json b/tests/data/infras/one_line/infra.json index f2e2da0b553..f72cfc7689d 100644 --- a/tests/data/infras/one_line/infra.json +++ b/tests/data/infras/one_line/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [], "routes": [ { diff --git a/tests/data/infras/overlapping_routes/infra.json b/tests/data/infras/overlapping_routes/infra.json index dddf603a185..b2427c1511a 100644 --- a/tests/data/infras/overlapping_routes/infra.json +++ b/tests/data/infras/overlapping_routes/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [ { "id": "op.a1", @@ -9,6 +9,7 @@ "position": 0.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -31,6 +32,7 @@ "position": 1000.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -53,6 +55,7 @@ "position": 0.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -75,6 +78,7 @@ "position": 1000.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, diff --git a/tests/data/infras/small_infra/infra.json b/tests/data/infras/small_infra/infra.json index db98a242be0..2268f9e32c3 100644 --- a/tests/data/infras/small_infra/infra.json +++ b/tests/data/infras/small_infra/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [ { "id": "West_station", @@ -17,6 +17,7 @@ "position": 500.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -39,6 +40,7 @@ "position": 500.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -73,6 +75,7 @@ "position": 450.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -99,6 +102,7 @@ "position": 14000.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -125,6 +129,7 @@ "position": 1025.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -147,6 +152,7 @@ "position": 4300.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -173,6 +179,7 @@ "position": 1500.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -195,6 +202,7 @@ "position": 4400.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, diff --git a/tests/data/infras/three_trains/infra.json b/tests/data/infras/three_trains/infra.json index 08a736d56f0..bb32d4071cc 100644 --- a/tests/data/infras/three_trains/infra.json +++ b/tests/data/infras/three_trains/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [], "routes": [ { diff --git a/tests/data/infras/tiny_infra/infra.json b/tests/data/infras/tiny_infra/infra.json index ef06ee4ea48..f4f56001c3b 100644 --- a/tests/data/infras/tiny_infra/infra.json +++ b/tests/data/infras/tiny_infra/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "operational_points": [ { "id": "op.station_foo", @@ -13,6 +13,7 @@ "position": 100.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0, @@ -35,6 +36,7 @@ "position": 100.0 } ], + "weight": null, "extensions": { "sncf": { "ci": 0,