Coverage for api/constants/field_order.py: 100%
2 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 06:14 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 06:14 +0000
1"""
2This file hardcodes the logical order for serializer fields.
4This leads to the JSON output being more suitable for human consumption.
5"""
7json_fields = [
8 "id",
9 "title",
10 "indexed_on",
11 "foreign_landing_url",
12 "url",
13 "creator",
14 "creator_url",
15 "license",
16 "license_version",
17 "license_url",
18 "provider",
19 "source",
20 "category",
21 "genres", # audio-only
22 "filesize",
23 "filetype",
24 "tags",
25 "alt_files", # audio-only
26 "attribution",
27 # Hits
28 "fields_matched",
29 "mature",
30 # Image specific
31 "height",
32 "width",
33 # Audio specific
34 "audio_set",
35 "duration",
36 "bit_rate",
37 "sample_rate",
38 # Hyperlinks
39 "thumbnail",
40 "detail_url",
41 "related_url",
42 "waveform", # audio-only
43 # Add-ons
44 "peaks", # audio-only
45]
47field_position_map: dict[str, int] = {
48 field: idx for idx, field in enumerate(json_fields)
49}
50#: mapping of JSON fields to their sort positions