Skip to content

Commit

Permalink
Expose has_lib and bin_names version fields on the API
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jul 3, 2024
1 parent 4d80592 commit 3dcd216
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: src/tests/krate/publish/manifest.rs
expression: response.into_json()
expression: response.json()
---
{
"version": {
Expand All @@ -17,13 +17,15 @@ expression: response.into_json()
}
}
],
"bin_names": [],
"checksum": "418c24c55cbcde274a5b1815d2c844203c7116e7f712008f4727d38bc7c82d8d",
"crate": "foo",
"crate_size": 170,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo/1.0.0/download",
"downloads": 0,
"features": {},
"has_lib": false,
"id": "[id]",
"license": "MIT",
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_show",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_show/1.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 1,
"license": null,
"links": {
Expand All @@ -72,13 +74,15 @@ expression: response.json()
},
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_show",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_show/0.5.1/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand All @@ -101,13 +105,15 @@ expression: response.json()
},
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_show",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_show/0.5.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 2,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c3",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c3/1.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c2",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c2/1.1.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c3",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c3/3.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand All @@ -64,13 +66,15 @@ expression: response.json()
},
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c2",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c2/2.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 2,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c2",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c2/1.0.18446744073709551615/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 2,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c2",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c2/2.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "c2",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/c2/2.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ expression: response.json()
"versions": [
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_versions",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_versions/1.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 2,
"license": null,
"links": {
Expand All @@ -29,13 +31,15 @@ expression: response.json()
},
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_versions",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_versions/0.5.1/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 1,
"license": null,
"links": {
Expand All @@ -58,13 +62,15 @@ expression: response.json()
},
{
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_versions",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_versions/0.5.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": 3,
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ expression: json
{
"version": {
"audit_actions": [],
"bin_names": null,
"checksum": " ",
"crate": "foo_vers_show_no_pb",
"crate_size": 0,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_vers_show_no_pb/1.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": "[id]",
"license": null,
"links": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ expression: json
{
"version": {
"audit_actions": [],
"bin_names": null,
"checksum": "c241cd77c3723ccf1aa453f169ee60c0a888344da504bee0142adb859092acb4",
"crate": "foo_vers_show",
"crate_size": 1234,
"created_at": "[datetime]",
"dl_path": "/api/v1/crates/foo_vers_show/2.0.0/download",
"downloads": 0,
"features": {},
"has_lib": null,
"id": "[id]",
"license": null,
"links": {
Expand Down
8 changes: 8 additions & 0 deletions src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ pub struct EncodableVersion {
pub audit_actions: Vec<EncodableAuditAction>,
pub checksum: String,
pub rust_version: Option<String>,
pub has_lib: Option<bool>,
pub bin_names: Option<Vec<Option<String>>>,
}

impl EncodableVersion {
Expand All @@ -587,6 +589,8 @@ impl EncodableVersion {
crate_size,
checksum,
rust_version,
has_lib,
bin_names,
..
} = version;

Expand All @@ -612,6 +616,8 @@ impl EncodableVersion {
crate_size,
checksum,
rust_version,
has_lib,
bin_names,
published_by: published_by.map(User::into),
audit_actions: audit_actions
.into_iter()
Expand Down Expand Up @@ -736,6 +742,8 @@ mod tests {
crate_size: Some(1234),
checksum: String::new(),
rust_version: None,
has_lib: None,
bin_names: None,
published_by: None,
audit_actions: vec![EncodableAuditAction {
action: "publish".to_string(),
Expand Down

0 comments on commit 3dcd216

Please sign in to comment.