File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/labthings/server/spec Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -164,15 +164,11 @@ def map_to_properties(schema, spec: APISpec):
164164 Recursively convert any dictionary-like map of Marshmallow fields
165165 into a dictionary describing it's JSON schema
166166 """
167- marshmallow_plugin = next (
168- plugin for plugin in spec .plugins if isinstance (plugin , MarshmallowPlugin )
169- )
170- converter = marshmallow_plugin .converter
171167
172168 d = {}
173169 for k , v in schema .items ():
174170 if isinstance (v , Field ):
175- d [k ] = converter . field2property ( v )
171+ d [k ] = field_to_property ( v , spec )
176172 elif isinstance (v , Mapping ):
177173 d [k ] = map_to_properties (v , spec )
178174 else :
@@ -188,6 +184,10 @@ def field_to_property(field, spec: APISpec):
188184 )
189185 converter = marshmallow_plugin .converter
190186
187+ # We add 'required' to the field metadata so that
188+ # field2property recognises it as an additional parameter
189+ field .metadata ["required" ] = field .required
190+
191191 return converter .field2property (field )
192192
193193
You can’t perform that action at this time.
0 commit comments