Coverage for src/ipyvizzu/schema.py: 100%
6 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-26 10:12 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-26 10:12 +0000
1"""A module for storing the data schema."""
3NAMED_SCHEMA: dict = {
4 "type": "array",
5 "items": {
6 "type": "object",
7 "properties": {
8 "name": {"type": "string"},
9 "values": {"type": "array", "optional": True},
10 "type": {"type": "string", "optional": True},
11 "unit": {"type": "string", "optional": True},
12 },
13 "required": ["name"],
14 },
15}
16"""Store the schema of the `series`, `dimensions` and `measures` data types."""
19RECORD_SCHEMA: dict = {
20 "type": "array",
21 "items": {"anyOf": [{"type": "array"}, {"type": "object"}]},
22}
23"""Store the schema of the `records` data type."""
26DATA_SCHEMA: dict = {
27 "type": "object",
28 "oneOf": [
29 {
30 "properties": {
31 "series": NAMED_SCHEMA,
32 "records": RECORD_SCHEMA,
33 "filter": {"optional": True},
34 },
35 "additionalProperties": False,
36 },
37 {
38 "properties": {
39 "dimensions": NAMED_SCHEMA,
40 "measures": NAMED_SCHEMA,
41 "filter": {"optional": True},
42 },
43 "additionalProperties": False,
44 "required": ["dimensions", "measures"],
45 },
46 ],
47}
48"""Store the schema of the data animation."""