Coverage for src/data_api/api/schemas/responses.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-11-13 19:28 +0000

1"""Snapshot response metadata shared by canonical and compatibility routes.""" 

2 

3from data_api.api.schemas.errors import ErrorResponse 

4 

5DATA_VERSION_HEADERS = { 

6 "X-Data-Commit-Hash": { 

7 "description": "Opaque source version; omitted when the version is unknown", 

8 "schema": {"type": "string"}, 

9 }, 

10} 

11COUNT_HEADERS = { 

12 **DATA_VERSION_HEADERS, 

13 "X-Total-Count": { 

14 "description": "Number of matching records before pagination", 

15 "schema": {"type": "integer", "minimum": 0}, 

16 "required": True, 

17 }, 

18} 

19SNAPSHOT_RESPONSES = { 

20 200: {"headers": DATA_VERSION_HEADERS}, 

21 503: {"model": ErrorResponse, "description": "No usable dataset snapshot"}, 

22} 

23COUNTED_SNAPSHOT_RESPONSES = { 

24 **SNAPSHOT_RESPONSES, 

25 200: {"headers": COUNT_HEADERS}, 

26}