JSON format modernisation and _shields_test removal (#3272)

* Modernised JSON format and removed _shields_test style

* Added logoWidth and labelColor fields to JSON response

* Reinstated and updated comment

* Extended expectBadge to accept Joi schemas for all fields
This commit is contained in:
Pierre-Yves B
2019-04-07 18:57:55 +01:00
committed by GitHub
parent 93333509c6
commit 25f8541e5b
75 changed files with 365 additions and 382 deletions

25
doc/json-format.md Normal file
View File

@@ -0,0 +1,25 @@
# JSON Format
Even though Shields is probably best known for its SVG badges, you can also retrieve
a JSON payload by replacing the `.svg` extension with `.json`.
For instance, hitting [this endpoint](https://img.shields.io/badge/hello-world-brightgreen.json)
will generate the following payload:
```
{
"name": "hello",
"label": "hello",
"value": "world",
"message": "world",
"color": "brightgreen"
}
```
Note that the values of the `name` and `value` fields are duplicates of the `label`
and `message` ones, respectively. As of April 2019, `name` and `value` are deprecated
and will be removed in a future release, please consider migrating your application
to use `label` and `message` instead.
Feel free to [open an issue](https://github.com/badges/shields/issues/new/choose)
if you have any queries regarding the JSON format.