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

removed temporary aliases in struct fields with serde #253

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions crates/api/src/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ pub enum ContentSource {
/// The URL of the content.
url: String,
/// Optional, server accepts for HTTP Range header.
/// TODO remove rename, see issue: https://github.com/bytecodealliance/registry/issues/221
#[serde(
default,
skip_serializing_if = "is_false",
rename = "accept_ranges",
alias = "acceptRanges"
Comment on lines -34 to -36
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one is technically breaking "forward compatibility" since 0.3.0 code is still serializing as accept_ranges. Better to just swap the rename and alias values now and drop the alias later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

)]
#[serde(default, skip_serializing_if = "is_false", alias = "accept_ranges")]
accept_ranges: bool,
/// Optional, provides content size in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
2 changes: 0 additions & 2 deletions crates/api/src/v1/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub struct MissingContent {
#[serde(rename_all = "camelCase")]
pub struct PublishRecordRequest<'a> {
/// The package name being published.
/// TODO: Remove the alias for `packageId` according to compatibility release schedule.
#[serde(alias = "packageId")]
pub package_name: Cow<'a, PackageName>,
/// The publish record to add to the package log.
pub record: Cow<'a, ProtoEnvelopeBody>,
Expand Down
4 changes: 0 additions & 4 deletions crates/client/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ pub struct OperatorInfo {
#[serde(rename_all = "camelCase")]
pub struct PackageInfo {
/// The package name to publish.
/// TODO: drop alias after sufficient time according to release policy.
#[serde(alias = "id")]
pub name: PackageName,
/// The last known checkpoint of the package.
#[serde(default, skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -288,8 +286,6 @@ pub enum PublishEntry {
#[serde(rename_all = "camelCase")]
pub struct PublishInfo {
/// The package name being published.
/// TODO: drop alias after sufficient time according to release policy.
#[serde(alias = "id")]
pub name: PackageName,
/// The last known head of the package log to use.
///
Expand Down
Loading