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 17, 2024
1 parent c645608 commit 4f0dbc3
Show file tree
Hide file tree
Showing 3 changed files with 14 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
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 DetectorSncfExtension(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 4f0dbc3

Please sign in to comment.