Skip to content

Conversation

@crazytonyli
Copy link
Contributor

What says in the title.

Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have uniffi export an auto-derived Codable implementation too – would that be preferable to this?

Why do we need it for these types specifically?

@crazytonyli
Copy link
Contributor Author

We can have uniffi export an auto-derived Codable implementation too

My concern is that you may have two different JSON structures: one expressed via the default Codable implementation in Swift, and the other via the serde attributes in the Rust layer. That means if we somehow pass JSON encoded by Swift to Rust, Rust would fail to decode it, and vice versa. Here is an example:

// In Rust
// The expected JSON schema is `{ "first_name": "Adam" }`
struct Person {
  first_name: String
}

// In Swift
// The expected JSON schema is `{ "firstName": "Adam" }`
struct Person {
  var firstName: String
}

Why do we need it for these types specifically?

Sorry, I should have provided more context. I need to store the taxonomy details on the app side.

@crazytonyli crazytonyli requested a review from jkmassel October 28, 2025 20:29
@crazytonyli
Copy link
Contributor Author

@jkmassel I have tried your suggestion of copying the properties to another type, instead of storing the original full JSON. That worked out well. So, I'll close this PR.

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

Successfully merging this pull request may close these issues.

3 participants