Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow change generated code naming convention #105

Open
sbant opened this issue Jun 14, 2024 · 1 comment
Open

Allow change generated code naming convention #105

sbant opened this issue Jun 14, 2024 · 1 comment

Comments

@sbant
Copy link

sbant commented Jun 14, 2024

As Rust code use snake_case, but in tauri-specta's code use "to_lower_camel_case" to force convert all name to camelCase.

Is there any way to keep the original naming convention or change as user like in the generated bindings.ts

Tauri official can has "rename_all" to change the function name (https://tauri.app/v1/guides/features/command/)

#[tauri::command(rename_all = "snake_case")]
fn my_custom_command(invoke_message: String) {
  println!("I was invoked from JS, with this message: {}", invoke_message);
}

I've test tauri-specta with "rename_all" use both "snake_case" and "camelCase", but they don't change the code generated.

taurpc can use "alias" to change name as user like. (https://crates.io/crates/taurpc)

#[taurpc::procedures]
trait Api {
    // #[taurpc(skip)]
    #[taurpc(alias = "_hello_world_")]
    async fn hello_world();
}
@oscartbeaumont
Copy link
Member

Right now we don't have a way to do. Support for it is required in Specta and is tracked by issue specta-rs/specta#213.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants