Coverage for src/ipyvizzu/schema.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-10 09:30 +0000

1"""A module for storing the data schema.""" 

2 

3 

4NAMED_SCHEMA: dict = { 

5 "type": "array", 

6 "items": { 

7 "type": "object", 

8 "properties": { 

9 "name": {"type": "string"}, 

10 "values": {"type": "array", "optional": True}, 

11 "type": {"type": "string", "optional": True}, 

12 }, 

13 "required": ["name"], 

14 }, 

15} 

16"""Store the schema of the `series`, `dimensions` and `measures` data types.""" 

17 

18 

19RECORD_SCHEMA: dict = {"type": "array", "items": {"type": "array"}} 

20"""Store the schema of the `records` data type.""" 

21 

22 

23DATA_SCHEMA: dict = { 

24 "type": "object", 

25 "oneOf": [ 

26 { 

27 "properties": { 

28 "series": NAMED_SCHEMA, 

29 "records": RECORD_SCHEMA, 

30 "filter": {"optional": True}, 

31 }, 

32 "additionalProperties": False, 

33 }, 

34 { 

35 "properties": { 

36 "dimensions": NAMED_SCHEMA, 

37 "measures": NAMED_SCHEMA, 

38 "filter": {"optional": True}, 

39 }, 

40 "additionalProperties": False, 

41 "required": ["dimensions", "measures"], 

42 }, 

43 ], 

44} 

45"""Store the schema of the data animation."""