use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RouteMetadata {
pub method: String,
pub path: String,
pub function_name: String,
pub module_path: String,
pub file_path: String,
pub signature: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_status: Option<Vec<u16>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StructMetadata {
pub name: String,
pub module_path: String,
pub file_path: String,
pub definition: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CollectedMetadata {
pub folder_name: String,
pub routes: Vec<RouteMetadata>,
pub structs: Vec<StructMetadata>,
}
impl CollectedMetadata {
pub fn new(folder_name: String) -> Self {
Self {
folder_name,
routes: Vec::new(),
structs: Vec::new(),
}
}
}
impl Default for CollectedMetadata {
fn default() -> Self {
Self::new("routes".to_string())
}
}