Coverage for apps/kwai-api/src/kwai_api/v1/schemas.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module for defining common JSON:API schemas.""" 

2 

3from pydantic import BaseModel 

4 

5from kwai_api.schemas.resources import ( 

6 ApplicationResourceIdentifier, 

7 CountryResourceIdentifier, 

8) 

9 

10 

11class ApplicationAttributes(BaseModel): 

12 """Attributes of an application JSON:API resource.""" 

13 

14 name: str 

15 title: str 

16 

17 

18class ApplicationResource(ApplicationResourceIdentifier): 

19 """A JSON:API resource for an application.""" 

20 

21 attributes: ApplicationAttributes 

22 

23 

24class CountryAttributes(BaseModel): 

25 """Attributes for the country JSON:API resource.""" 

26 

27 iso_2: str 

28 iso_3: str 

29 name: str 

30 

31 

32class CountryResource(CountryResourceIdentifier): 

33 """A JSON:API resource for a country.""" 

34 

35 attributes: CountryAttributes 

36 

37 

38class CountryDocument(BaseModel): 

39 """A JSON:API document for one or more countries.""" 

40 

41 data: CountryResource