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

Feature request: Override Serde tags if TS ones are provided #375

Open
gluax opened this issue Dec 17, 2024 · 0 comments
Open

Feature request: Override Serde tags if TS ones are provided #375

gluax opened this issue Dec 17, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@gluax
Copy link

gluax commented Dec 17, 2024

Is your feature request related to a problem? Please describe.
Hi, I'm using this crate via the qubit, which has ts-rs with default features enabled.
I describe the issue here, but I think it might be nicer to have this crate support the behavior instead. Unless it does, and qubit is doing something under the hood to prevent this?

Describe the solution you'd like
Even with the serde feature enabled it would be nice if the ts tag could overwrite the serde tag.
For example:

#[derive(Debug, Serialize, Deserialize, Clone, TS)]
#[serde(rename_all = "snake_case")]
#[ts(rename_all = "camelCase")]
pub struct PubkeyParams {
    pub activation_delay:       String,
    pub activation_threshold_percent: u8,
}

This would be nice in cases where on the rust side I'm fetching data, and then sending it to the typescript side. Where the latter the linter yells at me for not using camel case.

Describe alternatives you've considered
I'm not sure. This could be done with the serde-compat feature disabled I imagine? But that might have other awkward implications.

Additional context
I'm being a bit concise here, because most of my information is in the linked issue on qubit.

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

No branches or pull requests

1 participant