Skip to content

Commit

Permalink
missing serde rename for camelCase on the enum variants (#219)
Browse files Browse the repository at this point in the history
`accept_ranges` was not being serde renamed in camelCase. Per our 0.2.x compatibility policy, keeping the name as is but added serde `alias` to accept the `acceptRanges` as well.

#221
  • Loading branch information
calvinrp authored Oct 20, 2023
1 parent 61b33bd commit ec335e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/api/src/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ use serde::{Deserialize, Serialize};
#[serde(tag = "type", rename_all = "camelCase")]
pub enum ContentSource {
/// The content can be retrieved with an HTTP GET.
#[serde(rename_all = "camelCase")]
HttpGet {
/// The URL of the content.
url: String,
/// Optional, server accepts for HTTP Range header.
#[serde(default, skip_serializing_if = "is_false")]
/// TODO remove rename, see issue: https://github.com/bytecodealliance/registry/issues/221
#[serde(
default,
skip_serializing_if = "is_false",
rename = "accept_ranges",
alias = "acceptRanges"
)]
accept_ranges: bool,
/// Optional, provides content size in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
1 change: 1 addition & 0 deletions crates/api/src/v1/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use warg_protocol::{
#[serde(tag = "type", rename_all = "camelCase")]
pub enum UploadEndpoint {
/// Content may be uploaded via HTTP request to the given URL.
#[serde(rename_all = "camelCase")]
Http {
/// The http method for the upload request.
/// Only `POST` and `PUT` methods are supported.
Expand Down

0 comments on commit ec335e1

Please sign in to comment.