badges / badges/shields

JSON path support for endpoint

Open
#6,786 15 comments 0 reactions 0 assignees View on GitHub
needs-discussion
Dominant language
JavaScript
Stars
27.2k
Forks
5.6k
Avg merge
1d 8h
Merged PRs (30d)
46

Description

:clipboard: **Description**

The *dynamic* badge allows you to have a static JSON file containing multiple items, and allows you to select a part of that JSON file using the `query` parameter. You can generate multiple badges from the same JSON file, but it only lets you retrieve the message text from a particular JSON path; setting the color, label, logo, etc. must be done in the badges.io URL.

The *endpoint* badge allows you to have a static JSON file containing one item. You can set color, label, logo, and so on, but only for one item.

If the endpoint badge supported the `query` parameter, then a single file like this:

```json
[
{
"color": "brightgreen",
"label": "Outline Correctness Checks",
"message": "100%",
"schemaVersion": 1
},
{
"color": "inactive",
"label": "Shaping Checks",
"message": "SKIP",
"schemaVersion": 1
},
{
"color": "green",
"label": "Universal",
"message": "85%",
"schemaVersion": 1
},
{
"color": "green",
"label": "Fontbakery QA",
"message": "81%",
"schemaVersion": 1
}
]
```

could be used to generate four different badges dynamically.

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are named. Locate the endpoint badge handling and the existing dynamic badge query support, then compare how the query parameter selects JSON data. Done means an endpoint JSON collection can be queried to produce separate badges with each selected item's color, label, message, and other supported fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.