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

Swift enum cases naming convention #2335

Closed
setoelkahfi opened this issue Nov 28, 2024 · 2 comments
Closed

Swift enum cases naming convention #2335

setoelkahfi opened this issue Nov 28, 2024 · 2 comments

Comments

@setoelkahfi
Copy link

setoelkahfi commented Nov 28, 2024

I tried to look at the documentation to find a macro to convert my Rust cases to follow the Swift naming convention, camelCase, but to no avail. What's the state of that case?

#[derive(Debug, Deserialize, Serialize, Error)]
#[serde(untagged)]
pub enum SessionError {
   // Should become `error` in Swift
    Error {
        #[serde(rename = "statusCode")]
        status_code: u16,
        error: ErrorDetail,
    },
}

#[derive(Serialize, Deserialize, Debug, Record)]
pub struct ErrorDetail {
    pub message: String,
    #[serde(rename = "errorCode")]
    pub error_code: String,
    pub code: ErrorResponseCode,
}


#[derive(Debug, Deserialize_repr, Serialize_repr, Error)]
#[repr(u16)]
pub enum ErrorResponseCode {
   // Should be #[uniffie::camelCased] or something here
    NoResponse = 12,
    ParseError = 13,
    ContentNotFound = 5100,
    CommunicationError = 22000,
}
@mhammond
Copy link
Member

Is this a dupe of #2262?

@setoelkahfi
Copy link
Author

Yes. I'll close this.

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