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

postcard-schema: how to handle schemas conditional on is_human_readable() #197

Open
max-heller opened this issue Dec 25, 2024 · 1 comment
Labels
postcard-schema Related to the postcard-schema crate

Comments

@max-heller
Copy link
Collaborator

max-heller commented Dec 25, 2024

Some Serialize/Deserialize implementations (see e.g. uuid::Uuid) use different serde data model representations of the type depending on whether the underlying Serializer/Deserializer is human readable. For the most part, postcard should be able to think only in terms of the non-human-readable representation, but the distinction may matter for postcard-dyn in order to properly deserialize from human readable formats or serialize to human readable formats (e.g., json).

This could be captured in the schema as something like an IfHumanReadable { then: Type, else: Type } schema variant, though that feels somewhat clunky.

@max-heller
Copy link
Collaborator Author

Unfortunately postcard-dyn is probably out of luck here as there's no guarantee that serialized data can be transformed between its human-readable and compact forms, let alone in a universal way.

@max-heller max-heller added the postcard-schema Related to the postcard-schema crate label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postcard-schema Related to the postcard-schema crate
Projects
None yet
Development

No branches or pull requests

1 participant