Skip to main content

devboy_yougile/
metadata.rs

1//! YouGile provider metadata types for dynamic schema enrichment.
2
3use serde::{Deserialize, Serialize};
4
5/// Workspace metadata used to enrich the YouGile tool schema at runtime.
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct YouGileMetadata {
8    /// Available boards in the current workspace/company.
9    #[serde(default)]
10    pub boards: Vec<YouGileBoard>,
11    /// Available columns across the scoped boards.
12    #[serde(default)]
13    pub columns: Vec<YouGileColumn>,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct YouGileBoard {
18    pub id: String,
19    pub title: String,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct YouGileColumn {
24    pub id: String,
25    pub title: String,
26    #[serde(default)]
27    pub board_id: Option<String>,
28}
29
30#[cfg(test)]
31mod tests {
32    use super::*;
33    use serde_json::json;
34
35    #[test]
36    fn metadata_deserializes_board_and_column_lists() {
37        let raw = json!({
38            "boards": [
39                { "id": "board-1", "title": "Platform" }
40            ],
41            "columns": [
42                { "id": "col-1", "title": "To Do", "board_id": "board-1" }
43            ]
44        });
45
46        let metadata: YouGileMetadata = serde_json::from_value(raw).unwrap();
47        assert_eq!(metadata.boards.len(), 1);
48        assert_eq!(metadata.columns.len(), 1);
49        assert_eq!(metadata.columns[0].board_id.as_deref(), Some("board-1"));
50    }
51}