File tree 3 files changed +18
-8
lines changed
sanic_ext/extensions/openapi
3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 2
2
import uuid
3
3
from datetime import date , datetime , time
4
4
from enum import Enum
5
- from inspect import getmembers , isfunction
5
+ from inspect import getmembers , isfunction , ismethod
6
6
from typing import (
7
7
Any ,
8
8
Dict ,
@@ -312,7 +312,7 @@ def _properties(value: object) -> Dict:
312
312
fields = {
313
313
x : val
314
314
for x , v in getmembers (value , _is_property )
315
- if (val := _extract (v ))
315
+ if (val := _extract (v )) and x in value . __dict__
316
316
}
317
317
except AttributeError :
318
318
fields = {}
@@ -333,4 +333,4 @@ def _extract(item):
333
333
334
334
335
335
def _is_property (item ):
336
- return not isfunction (item )
336
+ return not isfunction (item ) and not ismethod ( item )
Original file line number Diff line number Diff line change 1
1
[metadata]
2
2
name = sanic-ext
3
- version = 22.6.0
3
+ version = 22.6.1
4
4
url = http://github.com/sanic-org/sanic-ext/
5
5
license = MIT
6
6
author = Sanic Community
Original file line number Diff line number Diff line change @@ -12,16 +12,26 @@ class Foo:
12
12
list1 : List [int ]
13
13
list2 : list [int ]
14
14
15
- def no_show (self ) -> None :
16
- ...
17
-
18
15
@property
19
16
def show (self ) -> bool :
20
17
return True
21
18
19
+ def no_show_method (self ) -> None :
20
+ ...
21
+
22
+ @classmethod
23
+ def no_show_classmethod (self ) -> None :
24
+ ...
25
+
26
+ @staticmethod
27
+ def no_show_staticmethod () -> None :
28
+ ...
29
+
22
30
schema = Schema .make (Foo )
23
31
serialized = schema .serialize ()
24
- assert "no_show" not in serialized
32
+ assert "no_show_method" not in serialized
33
+ assert "no_show_classmethod" not in serialized
34
+ assert "no_show_staticmethod" not in serialized
25
35
assert serialized == {
26
36
"type" : "object" ,
27
37
"properties" : {
You can’t perform that action at this time.
0 commit comments