@@ -98,8 +98,23 @@ def _get_operation(operation_id, link, tags):
98
98
return operation
99
99
100
100
101
- def _get_schema_type (schema ):
102
- if schema is None :
101
+ def _get_field_description (field ):
102
+ if getattr (field , 'description' , None ) is not None :
103
+ # Deprecated
104
+ return field .description
105
+
106
+ if field .schema is None :
107
+ return ''
108
+
109
+ return field .schema .description
110
+
111
+
112
+ def _get_field_type (field ):
113
+ if getattr (field , 'type' , None ) is not None :
114
+ # Deprecated
115
+ return field .type
116
+
117
+ if field .schema is None :
103
118
return 'string'
104
119
105
120
return {
@@ -109,7 +124,7 @@ def _get_schema_type(schema):<
A3AE
/div>
109
124
coreschema .Boolean : 'boolean' ,
110
125
coreschema .Array : 'array' ,
111
126
coreschema .Object : 'object' ,
112
- }.get (schema .__class__ , 'string' )
127
+ }.get (field . schema .__class__ , 'string' )
113
128
114
129
115
130
def _get_parameters (link , encoding ):
@@ -122,8 +137,8 @@ def _get_parameters(link, encoding):
122
137
123
138
for field in link .fields :
124
139
location = get_location (link , field )
125
- field_description = field . schema . description if field . schema else ''
126
- field_type = _get_schema_type (field . schema )
140
+ field_description = _get_field_description ( field )
141
+ field_type = _get_field_type (field )
127
142
if location == 'form' :
128
143
if encoding in ('multipart/form-data' , 'application/x-www-form-urlencoded' ):
129
144
# 'formData' in swagger MUST be one of these media types.
0 commit comments