1717)
1818
1919
20- class BasePatchJSONAPISchema (BaseModel ):
21- """Base PATCH JSON API schema."""
22- id : int = Field (description = "ID объекта" )
23- type : str = Field (description = "Тип ресурса" )
24- attributes : dict = Field (description = "Данные объекта" )
25-
26-
2720class BasePostJSONAPISchema (BaseModel ):
2821 """Base POST JSON API schema."""
2922
3023 type : str = Field (description = "Тип ресурса" )
3124 attributes : dict = Field (description = "Данные объекта" )
3225
3326
27+ class BaseJSONAPIObjectSchema (BasePostJSONAPISchema ):
28+ """Base JSON:API object schema."""
29+ id : int = Field (description = "ID объекта" )
30+
31+
32+ class BasePatchJSONAPISchema (BaseJSONAPIObjectSchema ):
33+ """Base PATCH JSON API schema."""
34+
35+
3436class JSONAPIResultListMetaSchema (BaseModel ):
3537 """JSON API list meta schema."""
3638
@@ -44,28 +46,29 @@ class JSONAPIResultListJSONAPISchema(BaseModel):
4446 version : str = Field (default = "1.0" , description = "json-api версия" )
4547
4648
47- class JSONAPIObjectSchema (BaseModel ):
49+ class JSONAPIObjectSchema (BaseJSONAPIObjectSchema ):
4850 """JSON API base object schema."""
4951
50- id : int = Field (description = "ID объекта" )
51- type : str = Field (description = "Тип ресурса" )
52- attributes : dict = Field (description = "Данные объекта" )
52+
53+ class BaseJSONAPIResultSchema (BaseModel ):
54+ """
55+ JSON:API Required fields schema
56+ """
57+
58+ meta : Optional [JSONAPIResultListMetaSchema ] = Field (description = "Meta данные json-api" )
59+ jsonapi : JSONAPIResultListJSONAPISchema = JSONAPIResultListJSONAPISchema ()
5360
5461
55- class JSONAPIResultListSchema (BaseModel ):
62+ class JSONAPIResultListSchema (BaseJSONAPIResultSchema ):
5663 """JSON API list base result schema."""
5764
5865 data : Sequence [JSONAPIObjectSchema ] = Field (description = "Список объектов" )
59- meta : Optional [JSONAPIResultListMetaSchema ]
60- jsonapi : JSONAPIResultListJSONAPISchema = JSONAPIResultListJSONAPISchema ()
6166
6267
63- class JSONAPIResultDetailSchema (BaseModel ):
68+ class JSONAPIResultDetailSchema (BaseJSONAPIResultSchema ):
6469 """JSON API base detail schema."""
6570
6671 data : JSONAPIObjectSchema = Field (description = "Данные объекта" )
67- meta : Optional [JSONAPIResultListMetaSchema ] = Field (description = "Meta данные json-api" )
68- jsonapi : JSONAPIResultListJSONAPISchema = JSONAPIResultListJSONAPISchema ()
6972
7073
7174class BasicPipelineActionSchema (BaseModel ):
0 commit comments