badges / badges/shields

Option for or default to using `max_stable_version` when fetching crate info

Open
#8,666 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
27.2k
Forks
5.6k
Avg merge
1d 8h
Merged PRs (30d)
46

Description

### Are you experiencing an issue with...

shields.io

### 🐞 Description

A Rust project I've contributed to, called [ucan](https://crates.io/crates/ucan) (and [ucan-key-support](https://crates.io/crates/ucan-key-support)), recently transitioned from (higher-versioned) alpha releases to a stable 0.1.0 release. However, the badge is not getting updated (https://img.shields.io/crates/v/ucan.svg), as it uses the max_version, per this line of code: https://github.com/badges/shields/blob/master/services/crates/crates-version.service.js#L22. In viewing the crate information via https://crates.io/api/v1/crates/ucan, should it use the `max_stable_version` if it exists, defaulting to `max_version` otherwise? Here's what the crate data returns:

```json
{
"crate":{
"badges":[],
"categories":[
"web-programming",
"cryptography",
"encoding"
],
"created_at":"2022-03-11T05:26:14.291552+00:00",
"description":"Implement UCAN-based authorization with conciseness and ease!",
"documentation":"https://docs.rs/ucan",
"downloads":1875,
"exact_match":false,
"homepage":"https://github.com/cdata/rs-ucan",
"id":"ucan",
"keywords":[
"jwt",
"ucan",
"pki",
"authz"
],
"links":{
"owner_team":"/api/v1/crates/ucan/owner_team",
"owner_user":"/api/v1/crates/ucan/owner_user",
"owners":"/api/v1/crates/ucan/owners",
"reverse_dependencies":"/api/v1/crates/ucan/reverse_dependencies",
"version_downloads":"/api/v1/crates/ucan/downloads",
"versions":null
},
"max_stable_version":"0.1.0",
"max_version":"0.7.0-alpha.1",
"name":"ucan",
"newest_version":"0.1.0",
"recent_downloads":1032,
"repository":"https://github.com/cdata/rs-ucan/",
"updated_at":"2022-11-29T18:39:54.791532+00:00",
"versions":[
634470,
552070,
525823,
525094,
520718,
519720,
517394,
517384,
514425,
514412,
673114
]
}
}
```

### 🔗 Link to the badge

https://img.shields.io/crates/v/ucan.svg
https://img.shields.io/crates/v/ucan-key-support.svg

### 💡 Possible Solution

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at services/crates/crates-version.service.js#L22 and inspect how the crates.io response is used for the version badge. Use the ucan response as the example; done means a crate with max_stable_version shows that version, while crates without it still use max_version.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
api, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.