@@ -12,18 +12,24 @@ def inspect_page(hint_class) -> TypeInfo:
12
12
args = getattr (hint_class , '__args__' , None )
13
13
child_class = args [0 ] if args else str
14
14
extra_fields = set (dataclasses .fields (hint_class .__origin__ )) - set (dataclasses .fields (Page ))
15
+ child_type_info = inspect_type (child_class )
15
16
16
- return TypeInfo (openapi .TYPE_OBJECT , title = 'Page' , properties = {
17
- 'meta' : TypeInfo (openapi .TYPE_OBJECT , title = 'PageMeta' , properties = {
18
- 'total_count' : TypeInfo (openapi .TYPE_INTEGER ),
19
- 'limit' : TypeInfo (openapi .TYPE_INTEGER , nullable = True ),
20
- 'offset' : TypeInfo (openapi .TYPE_INTEGER , nullable = True ),
21
- 'previous' : TypeInfo (openapi .TYPE_STRING , openapi .FORMAT_URI , nullable = True ),
22
- 'next' : TypeInfo (openapi .TYPE_STRING , openapi .FORMAT_URI , nullable = True ),
23
- ** {
24
- extra_field .name : inspect_type (extra_field .type )
25
- for extra_field in extra_fields
26
- },
27
- }),
28
- 'objects' : inspect_type (List [child_class ]),
29
- })
17
+ return TypeInfo (
18
+ openapi .TYPE_OBJECT ,
19
+ title = f'PageOf{ child_type_info .title or child_type_info .type_ .capitalize ()} ' ,
20
+ properties = {
21
+ 'meta' : TypeInfo (
22
+ openapi .TYPE_OBJECT ,
23
+ title = 'PageMeta' ,
24
+ properties = {
25
+ 'total_count' : TypeInfo (openapi .TYPE_INTEGER ),
26
+ 'limit' : TypeInfo (openapi .TYPE_INTEGER , nullable = True ),
27
+ 'offset' : TypeInfo (openapi .TYPE_INTEGER , nullable = True ),
28
+ 'previous' : TypeInfo (openapi .TYPE_STRING , openapi .FORMAT_URI , nullable = True ),
29
+ 'next' : TypeInfo (openapi .TYPE_STRING , openapi .FORMAT_URI , nullable = True ),
30
+ ** {extra_field .name : inspect_type (extra_field .type ) for extra_field in extra_fields },
31
+ },
32
+ ),
33
+ 'objects' : inspect_type (List [child_class ]),
34
+ },
35
+ )
0 commit comments