Skip to content

Commit

Permalink
editoast: use macro annotate_unites
Browse files Browse the repository at this point in the history
Signed-off-by: Tristram Gräbener <[email protected]>
  • Loading branch information
Tristramg committed Dec 9, 2024
1 parent d5e9940 commit 84d100e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
25 changes: 21 additions & 4 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,9 @@ paths:
max_speed:
type: number
format: double
description: Maximum speed of the consist in km/h
description: |-
Maximum speed of the consist in km/h
Velocity in km·h⁻¹
nullable: true
maximum_departure_delay:
type: integer
Expand Down Expand Up @@ -2632,7 +2634,9 @@ paths:
total_length:
type: number
format: double
description: Total length of the consist in meters
description: |-
Total length of the consist in meters
Length in m
nullable: true
total_mass:
type: number
Expand Down Expand Up @@ -6927,6 +6931,7 @@ components:
comfort_acceleration:
type: number
format: double
description: Acceleration in m·s⁻²
const_gamma:
type: number
format: double
Expand All @@ -6945,6 +6950,7 @@ components:
length:
type: number
format: double
description: Length in m
loading_gauge:
$ref: '#/components/schemas/LoadingGaugeType'
locked:
Expand All @@ -6955,6 +6961,7 @@ components:
max_speed:
type: number
format: double
description: Velocity in m·s⁻¹
metadata:
allOf:
- $ref: '#/components/schemas/RollingStockMetadata'
Expand All @@ -6972,6 +6979,7 @@ components:
startup_acceleration:
type: number
format: double
description: Acceleration in m·s⁻²
startup_time:
type: number
format: double
Expand Down Expand Up @@ -8552,7 +8560,9 @@ components:
max_speed:
type: number
format: double
description: Maximum speed of the consist in km/h
description: |-
Maximum speed of the consist in km/h
Velocity in km·h⁻¹
nullable: true
maximum_departure_delay:
type: integer
Expand Down Expand Up @@ -8611,7 +8621,9 @@ components:
total_length:
type: number
format: double
description: Total length of the consist in meters
description: |-
Total length of the consist in meters
Length in m
nullable: true
total_mass:
type: number
Expand Down Expand Up @@ -8789,6 +8801,7 @@ components:
length:
type: number
format: double
description: Length in m
loading_gauge:
$ref: '#/components/schemas/LoadingGaugeType'
locked:
Expand Down Expand Up @@ -8918,6 +8931,7 @@ components:
comfort_acceleration:
type: number
format: double
description: Acceleration in m·s⁻²
const_gamma:
type: number
format: double
Expand All @@ -8939,6 +8953,7 @@ components:
length:
type: number
format: double
description: Length in m
loading_gauge:
$ref: '#/components/schemas/LoadingGaugeType'
locked:
Expand All @@ -8950,6 +8965,7 @@ components:
max_speed:
type: number
format: double
description: Velocity in m·s⁻¹
metadata:
allOf:
- $ref: '#/components/schemas/RollingStockMetadata'
Expand All @@ -8972,6 +8988,7 @@ components:
startup_acceleration:
type: number
format: double
description: Acceleration in m·s⁻²
startup_time:
type: number
format: double
Expand Down
1 change: 1 addition & 0 deletions editoast/src/models/rolling_stock_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ editoast_common::schemas! {
PowerRestriction,
}

#[editoast_derive::annotate_units]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Model, ToSchema)]
#[model(table = editoast_models::tables::rolling_stock)]
#[model(gen(ops = crud, batch_ops = r, list))]
Expand Down
1 change: 1 addition & 0 deletions editoast/src/models/towed_rolling_stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use validator::Validate;

use crate::models::prelude::*;

#[editoast_derive::annotate_units]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Model, ToSchema)]
#[model(table = editoast_models::tables::towed_rolling_stock)]
#[model(gen(ops = crud, batch_ops = r, list))]
Expand Down
1 change: 1 addition & 0 deletions editoast/src/views/rolling_stock/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::models::Changeset;
use crate::models::Model;
use crate::models::RollingStockModel;

#[editoast_derive::annotate_units]
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema, Validate)]
#[validate(schema(function = "validate_rolling_stock_form"))]
pub struct RollingStockForm {
Expand Down
1 change: 1 addition & 0 deletions editoast/src/views/rolling_stock/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ async fn get_by_name(
Ok(Json(light_rolling_stock_with_liveries))
}

#[editoast_derive::annotate_units]
#[derive(Debug, Serialize, ToSchema)]
#[cfg_attr(test, derive(Deserialize))]
struct LightRollingStock {
Expand Down
1 change: 1 addition & 0 deletions editoast/src/views/timetable/stdcm/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct StepTimingData {
}

/// An STDCM request
#[editoast_derive::annotate_units]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Validate, ToSchema)]
pub(super) struct Request {
/// Deprecated, first step arrival time should be used instead
Expand Down

0 comments on commit 84d100e

Please sign in to comment.