cdnjs / cdnjs/api-server

/libraries returns wrong data for some libraries

Open
#56 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
121
Forks
42
Avg merge
18h 36m
Merged PRs (30d)
14

Description

Details

Description

The filename and latest (not sure if any other) fields return incorrect values via /libraries endpoint for some libraries, while correct data is returned via /libraries/:library endpoint.

Steps to reproduce

Data for a library "caf" as returned by https://api.cdnjs.com/libraries?fields=name,latest,version,filename:

{
    "name": "caf",
    "latest": "https://cdnjs.cloudflare.com/ajax/libs/caf/13.1.1/caf.js",
    "version": "13.1.1",
    "filename": "caf.js"
},

Data for the same library as returned by https://api.cdnjs.com/libraries/caf?fields=name,latest,version,filename:

{
    "name": "caf",
    "latest": "https://cdnjs.cloudflare.com/ajax/libs/caf/13.1.1/umd/caf.js",
    "version": "13.1.1",
    "filename": "umd/caf.js"
}
Expected behavior

/libraries should return the same data as /libraries/:library

Logs

N/A

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the /libraries and /libraries/:library endpoint implementations, focusing on how filename and latest are derived for the caf example. Reproduce both requests and verify that the collection endpoint returns the same values as the single-library endpoint for affected libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.