Skip to content

Commit

Permalink
Added DeviceType to the OpenAPI documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Mar 4, 2024
1 parent 4372e11 commit 1f47214
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions rust/agama-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ thiserror = "1.0.39"
tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.14"
url = "2.5.0"
utoipa = "4.2.0"
zbus = { version = "3", default-features = false, features = ["tokio"] }
5 changes: 3 additions & 2 deletions rust/agama-lib/src/network/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use thiserror::Error;
use zbus;

/// Network device
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub struct Device {
pub name: String,
pub type_: DeviceType,
Expand All @@ -31,7 +32,7 @@ impl From<SSID> for Vec<u8> {
}
}

#[derive(Debug, PartialEq, Copy, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Copy, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub enum DeviceType {
Loopback = 0,
Ethernet = 1,
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-server/src/network/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ pub struct Device {
pub type_: DeviceType,
}

/// Represents an availble network connection.
/// Represents a known network connection.
#[serde_as]
#[skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, utoipa::ToSchema)]
Expand Down
3 changes: 2 additions & 1 deletion rust/agama-server/src/web/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use utoipa::OpenApi;
schemas(crate::l10n::TimezoneEntry),
schemas(crate::network::model::NetworkState),
schemas(crate::network::model::Device),
schemas(crate::network::model::Connection)
schemas(crate::network::model::Connection),
schemas(agama_lib::network::types::DeviceType)
)
)]
pub struct ApiDoc;

0 comments on commit 1f47214

Please sign in to comment.