From a2865523a0ccbe93915850108a57b0d657c69f0a Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:41:09 +0200 Subject: [PATCH] feat: always send target info --- registry/src/endpoints/package_version.rs | 2 +- registry/src/endpoints/package_versions.rs | 2 +- registry/src/endpoints/search.rs | 2 +- registry/src/package.rs | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/registry/src/endpoints/package_version.rs b/registry/src/endpoints/package_version.rs index bd161ae..4a48db6 100644 --- a/registry/src/endpoints/package_version.rs +++ b/registry/src/endpoints/package_version.rs @@ -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(), diff --git a/registry/src/endpoints/package_versions.rs b/registry/src/endpoints/package_versions.rs index e48a113..b81ef9e 100644 --- a/registry/src/endpoints/package_versions.rs +++ b/registry/src/endpoints/package_versions.rs @@ -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(), diff --git a/registry/src/endpoints/search.rs b/registry/src/endpoints/search.rs index 8dfe3ef..42b6dae 100644 --- a/registry/src/endpoints/search.rs +++ b/registry/src/endpoints/search.rs @@ -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(), diff --git a/registry/src/package.rs b/registry/src/package.rs index 7772646..a7c7b76 100644 --- a/registry/src/package.rs +++ b/registry/src/package.rs @@ -34,8 +34,7 @@ impl From for TargetInfo { pub struct PackageResponse { pub name: String, pub version: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub target: Option, + pub target: TargetInfo, #[serde(skip_serializing_if = "String::is_empty")] pub description: String, pub published_at: DateTime,