Skip to content

Bug: Serialization error when using nested structs with a record id. #4844

@Quat3rnion

Description

@Quat3rnion

Describe the bug

Using nested structs, where RecordId is anywhere except the top level, results in a serialization error: untagged or internally tagged enums do not support enum input

Steps to reproduce

Using the following structs, attempt to client.create::<Option<UserEntity>>("table")

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserEntity {
    #[serde(flatten)]
    inner: User,
    pub password_hash: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct User {
    pub id: RecordId,
    #[serde(flatten)]
    inner: UserData,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserData {
    pub name: String,
}

Expected behaviour

No error, as it worked in 1.5.5

SurrealDB version

2.0.1 for linux on x86_64

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdk-issueIssues with the Rust SDK specificallytopic:rustThis is related to the Rust embedded library

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions