def _render_response_information(body):
"""
:param nodes.field_body body:
:rtype: dict|NoneType
"""
if len(body.children) > 1 or not isinstance(body[0], nodes.bullet_list):
return None
bullet_list = body[0]
response_obj = {
'description': '',
'schema': {
'type': 'object',
'required': [],
'properties': {},
},
}
for list_item in bullet_list.children:
assert isinstance(list_item, nodes.list_item)
assert len(list_item.children) == 1
para = list_item[0]
assert isinstance(para, nodes.paragraph)
obj_info = _parsed_typed_object(para)
if obj_info:
response_obj['schema']['required'].append(obj_info['name'])
response_obj['schema']['properties'][obj_info['name']] = {
'type': obj_info['type'],
'description': obj_info['description'],
}
return response_obj
评论列表
文章目录