Skip to content

Expose the yanked field on the API #9817

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

Merged
merged 7 commits into from
Nov 4, 2024
Merged

Conversation

eth3lbert
Copy link
Contributor

This PR expose the yanked field on the API. The yanked state is based on the default_version. The default_version can only be yanked if all other versions are also yanked and a crate should only be yanked if all of its versions are yanked.

src/views.rs Outdated
@@ -209,6 +209,7 @@ pub struct EncodableCrate {
pub downloads: i64,
pub recent_downloads: Option<i64>,
pub default_version: Option<String>,
pub yanked: Option<bool>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this field always be serialized as a bool, with a default value of true?

Copy link
Member

Choose a reason for hiding this comment

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

I think I'd rather default it to false actually 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm also fine with false as the default value. I don't have a strong preference for the default value, as a yanked state of None most likely means that the default_version is also None, which shouldn't occur in our case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the change in a new commit, which should be easier to inspect and could also be squashed before merging.

@eth3lbert eth3lbert requested a review from Turbo87 November 1, 2024 11:39
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.83%. Comparing base (c6011c7) to head (c3ee544).
Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9817      +/-   ##
==========================================
- Coverage   88.83%   88.83%   -0.01%     
==========================================
  Files         289      289              
  Lines       29852    30020     +168     
==========================================
+ Hits        26519    26668     +149     
- Misses       3333     3352      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Nov 1, 2024
@Turbo87 Turbo87 merged commit 04cc94a into rust-lang:main Nov 4, 2024
10 checks passed
@eth3lbert eth3lbert deleted the krate-yanked branch November 4, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants