@@ -144,33 +144,35 @@ def _get_property_type(the_schema):
144
144
145
145
146
146
def _field_properties_for_fields (properties ):
147
- field_properties = {}
148
- for k in properties :
149
- field_properties [k ] = {
150
- 'type' : _get_property_type (properties [k ])
147
+ result = {}
148
+ for prop , data in properties .items ():
149
+ result [prop ] = {
150
+ 'type' : _get_property_type (data ),
151
+ 'description' : _get_field_description (data ),
151
152
}
152
153
153
- if field_properties [ k ][ 'type' ] == "object" :
154
- field_properties [ k ]['properties ' ] = _field_properties_for_fields ( properties [ k ]. properties )
154
+ if hasattr ( data , 'required' ) :
155
+ result [ prop ]['required ' ] = getattr ( data , 'required' , False )
155
156
156
- elif field_properties [ k ]['type' ] == "array " :
157
- # field_properties[k ]['items '] = _field_properties_for_fields(properties[k].items )
157
+ if result [ prop ]['type' ] == "object " :
158
+ result [ prop ]['properties ' ] = _field_properties_for_fields (data . properties )
158
159
159
- if hasattr (properties [k ].items , 'properties' ):
160
+ elif result [prop ]['type' ] == "array" :
161
+ if hasattr (properties [prop ].items , 'properties' ):
160
162
# the array contains object instances, we need to inspect their properties
161
- field_properties [ k ]['items' ] = {
163
+ result [ prop ]['items' ] = {
162
164
'type' : 'object' ,
163
165
'properties' : _field_properties_for_fields (
164
- properties [ k ] .items .properties
166
+ data .items .properties
165
167
)
166
168
}
167
169
else :
168
170
# the array contains primitive types
169
- field_properties [ k ]['items' ] = {
170
- 'type' : _get_property_type (properties [ k ] .items ),
171
+ result [ prop ]['items' ] = {
172
+ 'type' : _get_property_type (data .items ),
171
173
}
172
174
173
- return field_properties
175
+ return result
174
176
175
177
176
178
def _get_parameters (link , encoding ):
0 commit comments