Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- graph op `visualizer`: documentation for specifying a document as root was
wrong

## [0.60.0] - 2026-10-06

### Added
Expand Down
21 changes: 17 additions & 4 deletions src/manipulator/visualize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::{borrow::Cow, collections::HashSet, path::PathBuf};

#[derive(Facet, Default, Deserialize, Serialize, Clone, PartialEq)]
#[derive(Facet, Default, Deserialize, Serialize, Clone, PartialEq, Debug)]
#[serde(rename_all = "snake_case")]
#[repr(u8)]
pub(crate) enum Include {
Expand Down Expand Up @@ -101,10 +101,10 @@ pub struct Visualize {
/// root = "first_document"
/// ```
///
/// Alternativly it can be configured to include all documents (`root = "all"`) or you can give the ID of the document as argument.
/// Alternativly it can be configured to include all documents (`root = "all"`) or you can configure it select a document by its ID.
/// ```toml
/// [graph_op.config]
/// root = "mycorpus/subcorpus1/mydocument"
/// root = {document = "mycorpus/subcorpus1/mydocument"}
/// ```
#[serde(default)]
root: Include,
Expand Down Expand Up @@ -400,7 +400,7 @@ mod tests {
workflow::execute_from_file,
};

use super::Visualize;
use super::*;

#[test]
fn serialize() {
Expand Down Expand Up @@ -524,4 +524,17 @@ mod tests {
};
assert_eq!("root/doc1", op.get_root_node_name(&g).unwrap());
}

#[test]
fn deserialize_document_root_config() {
let visualizer_config_str = r#"
limit_tokens = true
token_limit = 10
root = {document = "root/doc2"}
"#;
let op: Visualize = toml::from_str(visualizer_config_str).unwrap();
assert_eq!(true, op.limit_tokens);
assert_eq!(10, op.token_limit);
assert_eq!(Include::Document("root/doc2".to_string()), op.root);
}
}
Loading