diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd3c488..1ee52681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file. - Drop API support for GET, DELETE requests with a request body - Add missing @csrf_exempt annotations in API views - Fix the ping handler to reject status codes > 255 +- Add 'schemaVersion' field in the shields.io endpoint (#566) ## v1.22.0 - 2020-08-06 diff --git a/hc/api/tests/test_badge.py b/hc/api/tests/test_badge.py index cd2488e2..25e188fb 100644 --- a/hc/api/tests/test_badge.py +++ b/hc/api/tests/test_badge.py @@ -90,4 +90,7 @@ class BadgeTestCase(BaseTestCase): def test_it_returns_shields_json(self): doc = self.client.get(self.shields_url).json() - self.assertEqual(doc, {"label": "foo", "message": "up", "color": "success"}) + self.assertEqual( + doc, + {"schemaVersion": 1, "label": "foo", "message": "up", "color": "success"}, + ) diff --git a/hc/api/views.py b/hc/api/views.py index 660f3f5a..aec09cc6 100644 --- a/hc/api/views.py +++ b/hc/api/views.py @@ -461,7 +461,9 @@ def badge(request, badge_key, signature, tag, fmt): elif status == "late": color = "important" - return JsonResponse({"label": label, "message": status, "color": color}) + return JsonResponse( + {"schemaVersion": 1, "label": label, "message": status, "color": color} + ) if fmt == "json": return JsonResponse(