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

Add serde helpers for base64 encoding/decoding #1921

Merged
merged 9 commits into from
Nov 20, 2024
Merged

Conversation

jhendrixMSFT
Copy link
Member

To be used in serde "with" derive macros for struct fields that contain base64 data.

pub struct Base64BytesProperty {
    #[serde(
        deserialize_with = "base64::deserialize",
        skip_serializing_if = "Option::is_none",
        serialize_with = "base64::serialize"
    )]
    pub value: Option<Vec<u8>>,
}

To be used in serde "with" derive macros for struct fields that contain
base64 data.
Copy link
Member

@heaths heaths left a comment

Choose a reason for hiding this comment

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

Nothing blocking, but please add some comments (all new code should; I'll do a pass on old stuff before we GA if not sooner) and maybe a round-trip test.

sdk/typespec/typespec_client_core/src/base64.rs Outdated Show resolved Hide resolved
@jhendrixMSFT jhendrixMSFT merged commit ad2d779 into main Nov 20, 2024
13 checks passed
@jhendrixMSFT jhendrixMSFT deleted the serde-base64 branch November 20, 2024 01:02
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