Skip to content

Commit

Permalink
feat: always send target info
Browse files Browse the repository at this point in the history
  • Loading branch information
daimond113 committed Aug 12, 2024
1 parent 3272f8a commit a286552
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion registry/src/endpoints/package_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub async fn get_package_version(
let mut response = serde_json::to_value(PackageResponse {
name: name.to_string(),
version: v_id.version().to_string(),
target: Some(entry.target.into()),
target: entry.target.into(),
description: entry.description.unwrap_or_default(),
published_at: entry.published_at,
license: entry.license.unwrap_or_default(),
Expand Down
2 changes: 1 addition & 1 deletion registry/src/endpoints/package_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub async fn get_package_versions(
.map(|(v_id, entry)| PackageResponse {
name: name.to_string(),
version: v_id.version().to_string(),
target: Some(entry.target.into()),
target: entry.target.into(),
description: entry.description.unwrap_or_default(),
published_at: entry.published_at,
license: entry.license.unwrap_or_default(),
Expand Down
2 changes: 1 addition & 1 deletion registry/src/endpoints/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub async fn search_packages(
PackageResponse {
name: id.to_string(),
version: version_id.version().to_string(),
target: None,
target: entry.target.into(),
description: entry.description.unwrap_or_default(),
published_at: entry.published_at,
license: entry.license.unwrap_or_default(),
Expand Down
3 changes: 1 addition & 2 deletions registry/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ impl From<Target> for TargetInfo {
pub struct PackageResponse {
pub name: String,
pub version: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<TargetInfo>,
pub target: TargetInfo,
#[serde(skip_serializing_if = "String::is_empty")]
pub description: String,
pub published_at: DateTime<Utc>,
Expand Down

0 comments on commit a286552

Please sign in to comment.