Skip to content

Commit

Permalink
schemas: adding source extension for tracksection
Browse files Browse the repository at this point in the history
see #6997
bump version of schema to 0.8.11
  • Loading branch information
sim51 committed Apr 18, 2024
1 parent c645608 commit a7c30e3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
9 changes: 9 additions & 0 deletions editoast/src/schema/track_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct TrackSection {
#[serde(deny_unknown_fields)]
pub struct TrackSectionExtensions {
pub sncf: Option<TrackSectionSncfExtension>,
pub source: Option<TrackSectionSourceExtension>,
}

#[derive(Debug, Derivative, Clone, Deserialize, Serialize, PartialEq, Eq)]
Expand All @@ -49,6 +50,14 @@ pub struct TrackSectionSncfExtension {
pub track_name: NonBlankString,
}

#[derive(Debug, Derivative, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
#[derivative(Default)]
pub struct TrackSectionSourceExtension {
pub name: NonBlankString,
pub id: NonBlankString,
}

impl OSRDTyped for TrackSection {
fn get_type() -> ObjectType {
ObjectType::TrackSection
Expand Down
28 changes: 28 additions & 0 deletions front/src/reducers/osrdconf/infra_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,14 @@
}
],
"default": null
},
"source": {
"allOf": [
{
"$ref": "#/$defs/TrackSectionSourceExtension"
}
],
"default": null
}
},
"title": "TrackSectionExtensions",
Expand Down Expand Up @@ -1717,6 +1725,26 @@
"title": "TrackSectionSncfExtension",
"type": "object"
},
"TrackSectionSourceExtension": {
"properties": {
"id": {
"description": "ID used for the line in the source",
"title": "Id",
"type": "string"
},
"name": {
"description": "Name of the source",
"title": "Name",
"type": "string"
}
},
"required": [
"name",
"id"
],
"title": "TrackSectionSourceExtension",
"type": "object"
},
"Tvm300System": {
"properties": {
"conditional_parameters": {
Expand Down
4 changes: 4 additions & 0 deletions python/osrd_schemas/osrd_schemas/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,10 @@ class TrackSectionSncfExtension(BaseModel):
track_number: int = Field(description="Number corresponding to the track used", ge=0)
track_name: NonBlankStr = Field(description="Name corresponding to the track used")

@register_extension(object=TrackSection, name="source")
class TrackSectionSourceExtension(BaseModel):
name: str = Field(description="Name of the source")
id: str = Field(description="ID used for the line in the source")

@register_extension(object=OperationalPoint, name="sncf")
class OperationalPointSncfExtension(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion python/osrd_schemas/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "osrd_schemas"
version = "0.8.10"
version = "0.8.11"
description = ""
authors = ["OSRD <contact@osrd.fr>"]

Expand Down

0 comments on commit a7c30e3

Please sign in to comment.