-
Notifications
You must be signed in to change notification settings - Fork 658
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
Conversation
The `yanked` state is based on the `default_version`. The `default_version` can only be yanked if all other versions are also yanked. 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>, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 😅
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
This PR expose the
yanked
field on the API. Theyanked
state is based on thedefault_version
. Thedefault_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.