File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,8 @@ def convert_schema(schema, spec: APISpec):
134
134
return schema
135
135
elif isinstance (schema , Mapping ):
136
136
return map2properties (schema , spec )
137
+ elif isinstance (schema , Field ):
138
+ return field2property (schema , spec )
137
139
else :
138
140
raise TypeError (
139
141
"Unsupported schema type. Ensure schema is a Schema class, or dictionary of Field objects"
@@ -156,3 +158,12 @@ def map2properties(schema, spec: APISpec):
156
158
d [k ] = v
157
159
158
160
return {"properties" : d }
161
+
162
+
163
+ def field2property (field , spec : APISpec ):
164
+ marshmallow_plugin = next (
165
+ plugin for plugin in spec .plugins if isinstance (plugin , MarshmallowPlugin )
166
+ )
167
+ converter = marshmallow_plugin .converter
168
+
169
+ return converter .field2property (field )
You can’t perform that action at this time.
0 commit comments