extension.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:flask-openapi 作者: remcohaszing 项目源码 文件源码
def _process_rule(self, rule):
        path = {}
        view_func = self.app.view_functions[rule.endpoint]
        schema = self._extract_schema(view_func)
        if schema:
            path['parameters'] = [{
                'in': 'body',
                'name': 'payload',
                'schema': schema
            }]
        with suppress(AttributeError):
            path['responses'] = view_func.responses
        add_optional(path, 'description', self._extract_description(view_func))
        add_optional(
            path,
            'deprecated',
            getattr(view_func, 'deprecated', None))
        with suppress(AttributeError):
            path['tags'] = sorted(view_func.tags)
        return path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号