Skip to content
Merged
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
12 changes: 9 additions & 3 deletions src/build/wit_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,10 @@ fn process_rust_project(project_path: &Path, api_dir: &Path) -> Result<Option<(S
let has_http = method.attrs.iter().any(|a| a.path().is_ident("http"));
let has_init = method.attrs.iter().any(|a| a.path().is_ident("init"));
let has_ws = method.attrs.iter().any(|a| a.path().is_ident("ws"));
let has_ws_client = method.attrs.iter().any(|a| a.path().is_ident("ws_client"));

if has_remote || has_local || has_http || has_init || has_ws {
debug!(remote=%has_remote, local=%has_local, http=%has_http, init=%has_init, ws=%has_ws, "Method attributes found");
if has_remote || has_local || has_http || has_init || has_ws || has_ws_client {
debug!(remote=%has_remote, local=%has_local, http=%has_http, init=%has_init, ws=%has_ws, ws_client=%has_ws_client, "Method attributes found");
// Validate original Rust function name
validate_name(&method_name, "Function")?; // Error early if name invalid
let func_kebab_name = to_kebab_case(&method_name);
Expand All @@ -920,6 +921,11 @@ fn process_rust_project(project_path: &Path, api_dir: &Path) -> Result<Option<(S
continue;
}

if has_ws_client {
debug!(method_name = %method_name, "Found [ws_client] function, skipping signature generation (websocket handlers are ignored by WIT generator)");
continue;
}

// Generate signature structs. `generate_signature_struct` calls `rust_type_to_wit`,
// which populates `global_used_types` with all custom types found in parameters/return types.
if has_remote {
Expand Down Expand Up @@ -952,7 +958,7 @@ fn process_rust_project(project_path: &Path, api_dir: &Path) -> Result<Option<(S
} else {
// Method in hyperprocess impl lacks required attribute - Error
return Err(eyre!(
"Method '{}' in the #[hyperprocess] impl block is missing a required attribute ([remote], [local], [http], [init], or [ws]). Only methods with these attributes should be included.",
"Method '{}' in the #[hyperprocess] impl block is missing a required attribute ([remote], [local], [http], [init], [ws] or [ws_client]). Only methods with these attributes should be included.",
method_name
));
}
Expand Down