Skip to content

Commit 3d31216

Browse files
committed
Pick a crazy madjong stone
1 parent 5410629 commit 3d31216

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

tests/winter_openapi/test_api_request_and_response_spec.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class IntegerValueEnum(Enum):
3737

3838
@dataclass
3939
class NestedDataclass:
40+
"""NestedDataclass"""
4041
nested_number: int
4142

4243

@@ -275,7 +276,7 @@ class RequestBodyWithUndefined:
275276
'responses': {},
276277
'schemas': {
277278
'NestedDataclass': {
278-
'description': 'NestedDataclass(nested_number: int)',
279+
'description': 'NestedDataclass',
279280
'properties': {'nested_number': {'format': 'int32', 'type': 'integer'}},
280281
'required': ['nested_number'],
281282
'title': 'NestedDataclass',
@@ -311,7 +312,7 @@ class RequestBodyWithUndefined:
311312
'required': ['nested_number'],
312313
'title': 'NestedDataclass',
313314
'type': 'object',
314-
'description': 'NestedDataclass(nested_number: int)',
315+
'description': 'NestedDataclass',
315316
},
316317
'DataclassWithOptionalField': {
317318
'description': 'DataclassWithOptionalField description',
@@ -344,10 +345,6 @@ class RequestBodyWithUndefined:
344345
'responses': {},
345346
'schemas': {
346347
'PageMetaOfNestedDataclass': {
347-
'description': (
348-
'PageMetaOfNestedDataclass(total_count: int, limit: Union[int, NoneType], '
349-
'offset: Union[int, NoneType], previous: Union[str, NoneType], next: Union[str, NoneType])'
350-
),
351348
'properties': {
352349
'limit': {'format': 'int32', 'nullable': True, 'type': 'integer'},
353350
'offset': {'format': 'int32', 'nullable': True, 'type': 'integer'},
@@ -360,18 +357,13 @@ class RequestBodyWithUndefined:
360357
'type': 'object',
361358
},
362359
'NestedDataclass': {
363-
'description': 'NestedDataclass(nested_number: int)',
360+
'description': 'NestedDataclass',
364361
'properties': {'nested_number': {'format': 'int32', 'type': 'integer'}},
365362
'required': ['nested_number'],
366363
'title': 'NestedDataclass',
367364
'type': 'object',
368365
},
369366
'PageOfNestedDataclass': {
370-
'description': (
371-
'PageOfNestedDataclass('
372-
'meta: winter_openapi.inspectors.page_inspector.PageMetaOfNestedDataclass, '
373-
'objects: List[test_api_request_and_response_spec.NestedDataclass])'
374-
),
375367
'properties': {
376368
'meta': {
377369
'$ref': '#/components/schemas/PageMetaOfNestedDataclass',
@@ -402,11 +394,6 @@ class RequestBodyWithUndefined:
402394
'responses': {},
403395
'schemas': {
404396
'PageMetaOfInteger': {
405-
'description': (
406-
'PageMetaOfInteger(total_count: int, limit: Union[int, NoneType], '
407-
'offset: Union[int, NoneType], previous: Union[str, NoneType], next: Union[str, NoneType], '
408-
'extra: str)'
409-
),
410397
'properties': {
411398
'extra': {'type': 'string'},
412399
'limit': {'format': 'int32', 'nullable': True, 'type': 'integer'},
@@ -419,10 +406,6 @@ class RequestBodyWithUndefined:
419406
'type': 'object',
420407
},
421408
'PageOfInteger': {
422-
'description': (
423-
'PageOfInteger(meta: winter_openapi.inspectors.page_inspector.PageMetaOfInteger, '
424-
'objects: List[int])'
425-
),
426409
'properties': {
427410
'meta': {
428411
'$ref': '#/components/schemas/PageMetaOfInteger',
@@ -448,7 +431,7 @@ class RequestBodyWithUndefined:
448431
'responses': {},
449432
'schemas': {
450433
'NestedDataclass': {
451-
'description': 'NestedDataclass(nested_number: int)',
434+
'description': 'NestedDataclass',
452435
'properties': {'nested_number': {'format': 'int32', 'type': 'integer'}},
453436
'required': ['nested_number'],
454437
'title': 'NestedDataclass',
@@ -529,7 +512,7 @@ def with_invalid_return_type(self) -> object: # pragma: no cover
529512
'responses': {},
530513
'schemas': {
531514
'NestedDataclassInput': {
532-
'description': 'NestedDataclass(nested_number: int)',
515+
'description': 'NestedDataclass',
533516
'properties': {'nested_number': {'format': 'int32', 'type': 'integer'}},
534517
'required': ['nested_number'],
535518
'title': 'NestedDataclassInput',
@@ -627,7 +610,7 @@ def method_4(self, data: Dataclass):
627610
'responses': {},
628611
'schemas': {
629612
'NestedDataclass': {
630-
'description': 'NestedDataclass(nested_number: int)',
613+
'description': 'NestedDataclass',
631614
'properties': {
632615
'nested_number': {
633616
'format': 'int32',
@@ -639,7 +622,7 @@ def method_4(self, data: Dataclass):
639622
'type': 'object',
640623
},
641624
'NestedDataclassInput': {
642-
'description': 'NestedDataclass(nested_number: int)',
625+
'description': 'NestedDataclass',
643626
'properties': {
644627
'nested_number': {
645628
'format': 'int32',

winter_openapi/inspectors/page_inspector.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def inspect_page(hint_class) -> TypeInfo:
3333
},
3434
),
3535
)
36+
PageMetaDataclass.__doc__ = ''
3637
PageDataclass = dataclasses.dataclass(
3738
type(
3839
f'PageOf{title}',
@@ -45,5 +46,6 @@ def inspect_page(hint_class) -> TypeInfo:
4546
},
4647
),
4748
)
49+
PageDataclass.__doc__ = ''
4850

4951
return inspect_type(PageDataclass)

0 commit comments

Comments
 (0)