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):
134134 return schema
135135 elif isinstance (schema , Mapping ):
136136 return map2properties (schema , spec )
137+ elif isinstance (schema , Field ):
138+ return field2property (schema , spec )
137139 else :
138140 raise TypeError (
139141 "Unsupported schema type. Ensure schema is a Schema class, or dictionary of Field objects"
@@ -156,3 +158,12 @@ def map2properties(schema, spec: APISpec):
156158 d [k ] = v
157159
158160 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