sausage-plugin part 2: import! with typed clients (sausage_interface::client_rs), TCP endpoints with rpc.endpoint, examples

Part 1 fixes: complete stdout writes, buffered stdin, Rust type names
in schemas, enum variant docs, -32603 for serde errors in handlers,
crate docs and modules. End-to-end check of a generated consumer through
a fake core.
This commit is contained in:
2026-10-23 00:35:45 +01:00
parent ae1cb4cc99
commit 8d3c163992
42 changed files with 3020 additions and 856 deletions
+16
View File
@@ -0,0 +1,16 @@
//! Check the shared generator against a real example's discovered document.
#[test]
fn notes_client_preserves_names_and_docs() {
let document =
serde_json::from_str(include_str!("../../examples/consumer/imports/notes.json")).unwrap();
let code = sausage_interface::client_rs("notes", &document).unwrap();
assert!(code.contains("pub struct AddParams"));
assert!(code.contains("pub struct Added"));
assert!(!code.contains("AddedResult"));
assert!(code.contains("The complete note text"));
assert!(code.contains("pub fn add(params: AddParams)"));
syn::parse_file(&code).unwrap();
let target = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../target/sdk");
std::fs::create_dir_all(&target).unwrap();
std::fs::write(target.join("notes-client.rs"), code).unwrap();
}