Skip to content

Conversation

Noah765
Copy link
Contributor

@Noah765 Noah765 commented Jun 4, 2025

Changes

Currently, annotating a variant or field with the #[serde(skip)], #[serde(skip_serializing)], #[serde(skip_serializing_if = "path")], or #[serde(skip_deserializing)] attributes results in successful compilation but causes runtime errors. Ignoring some fields or variants can be useful when exposing partially private data from the business logic in Rust to Dart.
This PR adds support for the #[serde(skip)] attribute and handles the #[serde(skip_serializing)], #[serde(skip_serializing_if = "path")] and #[serde(skip_deserializing)] attributes by throwing compile-time errors. It also adds a section to the documentation about ignoring fields or variants and adds a few cases to the tests.
Handling only the #[serde(skip)] attribute was a deliberate choice because it enables all the functionality of a skip attribute for this project. Supporting the other attributes quickly leads to implementation complexity and user confusion.

For more information on these attributes, see https://serde.rs/variant-attrs.html and https://serde.rs/field-attrs.html.

Before Committing

Please make sure that you've analyzed and formatted the files.

dart analyze flutter_package --fatal-infos
dart format .
cargo fmt
cargo clippy --fix --allow-dirty

@temeddix
Copy link
Member

temeddix commented Jun 4, 2025

This is exactly what was described in #580 ! Thank you for the pull request, and I'll publish a new version as soon as it gets merged.

@temeddix temeddix merged commit 645c542 into cunarist:main Jun 4, 2025
23 checks passed
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.

2 participants